diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b9c80a9b62..b198104856 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -204,7 +204,7 @@ jobs: env: NODE_V8_COVERAGE: './coverage/jest' run: | - mkdir -p ./.nyc_output + mkdir -p ./coverage/jest npm run test -- --watchAll=false --coverage - name: Run Vitest Tests @@ -212,13 +212,17 @@ jobs: env: NODE_V8_COVERAGE: './coverage/vitest' run: | + mkdir -p ./coverage/vitest npm run test:vitest:coverage - name: Merge Coverage Reports if: steps.changed-files.outputs.only_changed != 'true' run: | mkdir -p coverage - npx lcov-result-merger 'coverage/*/lcov.info' > 'coverage/lcov.info' + if ! npx lcov-result-merger 'coverage/*/lcov.info' > 'coverage/lcov.info'; then + echo "Failed to merge coverage reports" + exit 1 + fi - name: TypeScript compilation for changed files run: | diff --git a/jest.config.js b/jest.config.js index 008cf43616..3083bcda4f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,16 @@ export default { roots: ['/src'], - collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/index.tsx'], + collectCoverageFrom: [ + 'src/**/*.{ts,tsx}', + '!src/index.tsx', + '!node_modules', + '!dist', + '!**/*.{spec,test}.{js,jsx,ts,tsx}', + '!coverage/**', + '!**/index.{js,ts}', + '!**/*.d.ts', + '!src/test/**', + '!vitest.config.ts',], // setupFiles: ['react-app-polyfill/jsdom'], setupFiles: ['whatwg-fetch'], setupFilesAfterEnv: ['/src/setupTests.ts'],