From 923741d9e6342cb4fa5fe16c24c93b4215c47eb5 Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Thu, 7 Mar 2024 18:22:14 +0900 Subject: [PATCH 1/2] update unit test coverage exclusions --- vitest.config.mts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/vitest.config.mts b/vitest.config.mts index bef32a8eb..c594f3c78 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -29,6 +29,30 @@ export default defineConfig({ }, coverage: { reportsDirectory: './vitest-coverage', + exclude: [ + 'coverage/**', + '{cypress,vitest}-coverage/**', + 'dist/**', + '.storybook-dist/**', + '.next/**', + '**/*.d.ts', + '{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', + 'vitest.{workspace,projects}.[jt]s?(on)', + '.{eslint,mocha,prettier}rc.{?(c|m)js,yml}', + 'node_modules/**', + 'cypress/**', + 'common/config/**', + 'common/styles/**', + 'common/constants/**', + 'scripts/**', + 'test-utils/**', + 'common/utils/api-utils.{[jt]s}', + 'components/ZipRecruiterJobs/ZipRecruiterJobs.{[jt]s}', + 'components/Press/PressLinks/Articles.{[jt]s}', + 'components/Timeline/historyData.{[jt]s}', + 'common/(.*)/index.{[jt]s}', + 'components/(.*)/index.{[jt]s}', + ], }, }, }); From dd8c2e97309ea5b19d02b48f4df7f7d0c05ccc73 Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Thu, 7 Mar 2024 18:46:00 +0900 Subject: [PATCH 2/2] update coverage targets (#1807) --- nyc.config.js | 9 +++++++-- vitest.config.mts | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/nyc.config.js b/nyc.config.js index 23705050b..80974cb91 100644 --- a/nyc.config.js +++ b/nyc.config.js @@ -1,4 +1,9 @@ module.exports = { - include: ['pages/**/*.js', 'common/**/*.js', 'components/**/*.js', 'decorators/**/*.js'], - exclude: ['pages/api/__coverage__.js'], + include: [ + 'pages/**/*.{js,ts,tsx}', + 'common/**/*.{js,ts,tsx}', + 'components/**/*.{js,ts,tsx}', + 'decorators/**/*.{js,ts,tsx}', + ], + exclude: ['pages/api/__coverage__.{js,ts}'], }; diff --git a/vitest.config.mts b/vitest.config.mts index c594f3c78..6c9a8f58a 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -29,7 +29,13 @@ export default defineConfig({ }, coverage: { reportsDirectory: './vitest-coverage', + include: [ + 'common/**/*.{js,ts,tsx}', + 'components/**/*.{js,ts,tsx}', + 'decorators/**/*.{js,ts,tsx}', + ], exclude: [ + // Irrelevant configs and local-only scripts 'coverage/**', '{cypress,vitest}-coverage/**', 'dist/**', @@ -39,17 +45,23 @@ export default defineConfig({ '{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', 'vitest.{workspace,projects}.[jt]s?(on)', '.{eslint,mocha,prettier}rc.{?(c|m)js,yml}', + 'scripts/**', + 'test-utils/**', + + // Folders covered by integration tests 'node_modules/**', 'cypress/**', 'common/config/**', 'common/styles/**', 'common/constants/**', - 'scripts/**', - 'test-utils/**', + + // No real logic to test here 'common/utils/api-utils.{[jt]s}', 'components/ZipRecruiterJobs/ZipRecruiterJobs.{[jt]s}', 'components/Press/PressLinks/Articles.{[jt]s}', 'components/Timeline/historyData.{[jt]s}', + + // Don't collect coverage from import/export mappers 'common/(.*)/index.{[jt]s}', 'components/(.*)/index.{[jt]s}', ],