Skip to content

Commit

Permalink
test(Jest): Update paths to reflect rootDir routes
Browse files Browse the repository at this point in the history
coverageDirectory is relative to rootDir, so Jest outputs test coverage
reports to src/reports/jest/ rather than reports/jest/. outputDirectory
is not relative to rootDir, so include rootDir explicitly in the path so
that unit tests are reported to the same directory as test coverage.
  • Loading branch information
Kurt-von-Laven committed Feb 28, 2023
1 parent 30f485d commit f8bc37e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
uses: EnricoMi/[email protected]
if: always()
with:
junit_files: reports/jest/junit.xml
junit_files: src/reports/jest/junit.xml
comment_mode: off
save-cache:
name: Save Cache
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Jest
reports
src/reports

# MegaLinter
megalinter-reports
Expand Down
4 changes: 3 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const config: JestConfigWithTsJest = {
if (process.env["CI"] === "true") {
config.ci = true;
config.collectCoverageFrom = ["**/*.ts"];
config.reporters = [["jest-junit", { outputDirectory: "reports/jest/" }]];
config.reporters = [
["jest-junit", { outputDirectory: "<rootDir>/reports/jest/" }],
];
}

export default config;

0 comments on commit f8bc37e

Please sign in to comment.