From f8bc37eb2cfa6f84cf8b5a9741d702e197a3d3b8 Mon Sep 17 00:00:00 2001 From: Kurt von Laven Date: Mon, 27 Feb 2023 19:10:59 -0800 Subject: [PATCH] test(Jest): Update paths to reflect rootDir routes 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. --- .github/workflows/test.yaml | 2 +- .gitignore | 2 +- jest.config.ts | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2289cbdd..0f09f418 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -69,7 +69,7 @@ jobs: uses: EnricoMi/publish-unit-test-result-action@v2.4.1 if: always() with: - junit_files: reports/jest/junit.xml + junit_files: src/reports/jest/junit.xml comment_mode: off save-cache: name: Save Cache diff --git a/.gitignore b/.gitignore index e054d318..8cea9c3a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Jest -reports +src/reports # MegaLinter megalinter-reports diff --git a/jest.config.ts b/jest.config.ts index 9fea58ea..0c7292eb 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -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: "/reports/jest/" }], + ]; } export default config;