From a375268951934d7e1703ee8106dba854727b47c1 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 7 Feb 2025 12:35:14 -0500 Subject: [PATCH 1/6] feat(ci): Add junit reporters to jest/vitest, codecov test results --- .github/workflows/build.yml | 24 ++++++++++++++++++++++++ jest/jest.config.js | 9 +++++++++ package.json | 1 + vite/vite.config.ts | 1 + yarn.lock | 15 +++++++++++++++ 5 files changed, 50 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5972af74bb89..788a89dfa3a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -381,6 +381,14 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} + - name: Upload test results to Codecov + if: cancelled() == false + continue-on-error: true + uses: codecov/test-results-action@v1 + with: + directory: packages/remix + token: ${{ secrets.CODECOV_TOKEN }} + job_bun_unit_tests: name: Bun Unit Tests needs: [job_get_metadata, job_build] @@ -701,6 +709,14 @@ jobs: working-directory: dev-packages/node-integration-tests run: yarn test + - name: Upload test results to Codecov + if: cancelled() == false + continue-on-error: true + uses: codecov/test-results-action@v1 + with: + directory: dev-packages/node-integration-tests + token: ${{ secrets.CODECOV_TOKEN }} + job_remix_integration_tests: name: Remix (Node ${{ matrix.node }}) Tests needs: [job_get_metadata, job_build] @@ -737,6 +753,14 @@ jobs: cd packages/remix yarn test:integration:ci + - name: Upload test results to Codecov + if: cancelled() == false + continue-on-error: true + uses: codecov/test-results-action@v1 + with: + directory: packages/remix + token: ${{ secrets.CODECOV_TOKEN }} + job_e2e_prepare: name: Prepare E2E tests # We want to run this if: diff --git a/jest/jest.config.js b/jest/jest.config.js index 495035994b37..d16abc5fe033 100644 --- a/jest/jest.config.js +++ b/jest/jest.config.js @@ -28,6 +28,15 @@ module.exports = { ...(process.env.CI ? { coverageReporters: ['json', 'lcov', 'clover'], + reporters: [ + 'default', + [ + 'jest-junit', + { + outputName: 'jest.junit.xml', + }, + ], + ], } : {}), }; diff --git a/package.json b/package.json index 73ae7f18495d..e0f4b475efd2 100644 --- a/package.json +++ b/package.json @@ -119,6 +119,7 @@ "eslint": "7.32.0", "jest": "^27.5.1", "jest-environment-node": "^27.5.1", + "jest-junit": "^16.0.0", "jsdom": "^21.1.2", "lerna": "7.1.1", "madge": "7.0.0", diff --git a/vite/vite.config.ts b/vite/vite.config.ts index a5be84382388..935facd76918 100644 --- a/vite/vite.config.ts +++ b/vite/vite.config.ts @@ -10,6 +10,7 @@ export default defineConfig({ enabled: true, reportsDirectory: './coverage', }, + reporters: ['default', 'junit'], typecheck: { tsconfig: './tsconfig.test.json', }, diff --git a/yarn.lock b/yarn.lock index 83ff270a83f9..c9b3e2e1cf8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19066,6 +19066,16 @@ jest-jasmine2@^27.5.1: pretty-format "^27.5.1" throat "^6.0.1" +jest-junit@^16.0.0: + version "16.0.0" + resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-16.0.0.tgz#d838e8c561cf9fdd7eb54f63020777eee4136785" + integrity sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ== + dependencies: + mkdirp "^1.0.4" + strip-ansi "^6.0.1" + uuid "^8.3.2" + xml "^1.0.1" + jest-leak-detector@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz#6ec9d54c3579dd6e3e66d70e3498adf80fde3fb8" @@ -30490,6 +30500,11 @@ xml-name-validator@^4.0.0: resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== +xml@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" + integrity sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw== + xmlchars@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" From 3c54638f572a80fc15c3f621b0b532db422859c8 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 7 Feb 2025 14:31:23 -0500 Subject: [PATCH 2/6] try glob --- .github/workflows/build.yml | 10 +++++++++- vite/vite.config.ts | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 788a89dfa3a7..2780e09ff5f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -386,7 +386,7 @@ jobs: continue-on-error: true uses: codecov/test-results-action@v1 with: - directory: packages/remix + files: packages/**/*.xml token: ${{ secrets.CODECOV_TOKEN }} job_bun_unit_tests: @@ -492,6 +492,14 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} + - name: Upload test results to Codecov + if: cancelled() == false + continue-on-error: true + uses: codecov/test-results-action@v1 + with: + files: packages/**/*.junit.xml + token: ${{ secrets.CODECOV_TOKEN }} + job_browser_playwright_tests: name: Playwright ${{ matrix.bundle }}${{ matrix.project && matrix.project != 'chromium' && format(' {0}', matrix.project) || ''}}${{ matrix.shard && format(' ({0}/{1})', matrix.shard, matrix.shards) || ''}} Tests needs: [job_get_metadata, job_build] diff --git a/vite/vite.config.ts b/vite/vite.config.ts index 935facd76918..8d907dc5725d 100644 --- a/vite/vite.config.ts +++ b/vite/vite.config.ts @@ -11,6 +11,9 @@ export default defineConfig({ reportsDirectory: './coverage', }, reporters: ['default', 'junit'], + outputFile: { + junit: `vitest.junit.xml`, + }, typecheck: { tsconfig: './tsconfig.test.json', }, From 455666a80b3164fd62f3cda8e088227d282f4573 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 7 Feb 2025 14:50:12 -0500 Subject: [PATCH 3/6] tweaks --- .github/workflows/build.yml | 2 +- packages/angular/vitest.config.ts | 1 - packages/replay-internal/vitest.config.ts | 1 - vite/vite.config.ts | 4 ++-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2780e09ff5f5..7733c451171f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -386,7 +386,7 @@ jobs: continue-on-error: true uses: codecov/test-results-action@v1 with: - files: packages/**/*.xml + files: packages/**/*.junit.xml token: ${{ secrets.CODECOV_TOKEN }} job_bun_unit_tests: diff --git a/packages/angular/vitest.config.ts b/packages/angular/vitest.config.ts index 82015893133b..4b3cb2ffacfa 100644 --- a/packages/angular/vitest.config.ts +++ b/packages/angular/vitest.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ coverage: {}, globals: true, setupFiles: ['./setup-test.ts'], - reporters: ['default'], environment: 'jsdom', }, }); diff --git a/packages/replay-internal/vitest.config.ts b/packages/replay-internal/vitest.config.ts index 976d9c37074d..3aa37d27166c 100644 --- a/packages/replay-internal/vitest.config.ts +++ b/packages/replay-internal/vitest.config.ts @@ -7,6 +7,5 @@ export default defineConfig({ test: { ...baseConfig.test, setupFiles: ['./test.setup.ts'], - reporters: ['default'], }, }); diff --git a/vite/vite.config.ts b/vite/vite.config.ts index 8d907dc5725d..bcff15b2b0b0 100644 --- a/vite/vite.config.ts +++ b/vite/vite.config.ts @@ -10,9 +10,9 @@ export default defineConfig({ enabled: true, reportsDirectory: './coverage', }, - reporters: ['default', 'junit'], + reporters: ['default', ...(process.env.CI ? ['junit'] : [])], outputFile: { - junit: `vitest.junit.xml`, + junit: 'vitest.junit.xml', }, typecheck: { tsconfig: './tsconfig.test.json', From 5cc79795feff6637beb700d82eec693add5e81c0 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 7 Feb 2025 15:57:01 -0500 Subject: [PATCH 4/6] Update jest/jest.config.js Co-authored-by: joseph-sentry <136376984+joseph-sentry@users.noreply.github.com> --- jest/jest.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jest/jest.config.js b/jest/jest.config.js index d16abc5fe033..804519918182 100644 --- a/jest/jest.config.js +++ b/jest/jest.config.js @@ -34,6 +34,7 @@ module.exports = { 'jest-junit', { outputName: 'jest.junit.xml', + classNameTemplate: '{filepath}', }, ], ], From 8095394f46449390db06594020d29aa85a017554 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 7 Feb 2025 16:00:29 -0500 Subject: [PATCH 5/6] classnameTemplate for vitest --- vite/vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite/vite.config.ts b/vite/vite.config.ts index bcff15b2b0b0..1592262d803a 100644 --- a/vite/vite.config.ts +++ b/vite/vite.config.ts @@ -10,7 +10,7 @@ export default defineConfig({ enabled: true, reportsDirectory: './coverage', }, - reporters: ['default', ...(process.env.CI ? ['junit'] : [])], + reporters: ['default', ...(process.env.CI ? [['junit', {classnameTemplate: '{filepath}'}] : [])], outputFile: { junit: 'vitest.junit.xml', }, From 076501377be8217f9bf8fccc47459d430ae707f5 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 7 Feb 2025 16:01:43 -0500 Subject: [PATCH 6/6] formatting --- vite/vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite/vite.config.ts b/vite/vite.config.ts index 1592262d803a..2717ad778e1d 100644 --- a/vite/vite.config.ts +++ b/vite/vite.config.ts @@ -10,7 +10,7 @@ export default defineConfig({ enabled: true, reportsDirectory: './coverage', }, - reporters: ['default', ...(process.env.CI ? [['junit', {classnameTemplate: '{filepath}'}] : [])], + reporters: ['default', ...(process.env.CI ? [['junit', { classnameTemplate: '{filepath}' }]] : [])], outputFile: { junit: 'vitest.junit.xml', },