Skip to content

Commit

Permalink
chore(test): Update coverage for watch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Nov 24, 2021
1 parent b5eeae9 commit 74cee51
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions jest.config.js
Expand Up @@ -7,6 +7,21 @@ const packages = fs

const docsSrc = '<rootDir>/packages/documentation/src';

const isWatchMode = /(-w|--watch)(\s?.+)?$/.test(process.argv);

let collectCoverageFrom = [];
if (!isWatchMode) {
collectCoverageFrom = [
'<rootDir>/packages/*/src/**/*.{ts,tsx}',
// internal usage and don't matter for the library coverage reports
'!<rootDir>/packages/{dev-utils,documentation,material-icons,react-md}/src/**/*',
// these are generated files
'!<rootDir>/packages/*/src/scssVariables.ts',
// index.ts files are always `export * from "./fileOrFolder"`
'!<rootDir>/packages/**/index.ts',
];
}

module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
Expand All @@ -31,15 +46,7 @@ module.exports = {
'^pages/(.*)$': `${docsSrc}/pages/$1`,
'^utils/(.*)$': `${docsSrc}/utils/$1`,
},
collectCoverageFrom: [
'<rootDir>/packages/*/src/**/*.{ts,tsx}',
// internal usage and don't matter for the library coverage reports
'!<rootDir>/packages/{dev-utils,documentation,material-icons,react-md}/src/**/*',
// these are generated files
'!<rootDir>/packages/*/src/scssVariables.ts',
// index.ts files are always `export * from "./fileOrFolder"`
'!<rootDir>/packages/**/index.ts',
],
collectCoverageFrom,
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
Expand Down

0 comments on commit 74cee51

Please sign in to comment.