@@ -12,13 +12,24 @@ const ignores = [
1212 '__mocks__' ,
1313]
1414
15+ const toGlob = extensions => `*.+(${ extensions . join ( '|' ) } )`
16+ const testMatchExtensions = [ 'js' , 'jsx' , 'ts' , 'tsx' ]
17+ const testMatchGlob = toGlob ( testMatchExtensions )
18+ const testMatchSuffixGlob = toGlob (
19+ testMatchExtensions . map ( extension => 'test.' . concat ( extension ) ) ,
20+ )
21+
1522const jestConfig = {
16- roots : [ fromRoot ( 'src' ) ] ,
23+ roots : [ fromRoot ( 'src' ) , fromRoot ( 'test' ) ] ,
1724 testEnvironment : ifAnyDep ( [ 'webpack' , 'rollup' , 'react' ] , 'jsdom' , 'node' ) ,
1825 testURL : 'http://localhost' ,
19- moduleFileExtensions : [ 'js' , 'jsx' , 'json' , 'ts' , 'tsx' ] ,
20- collectCoverageFrom : [ 'src/**/*.+(js|jsx|ts|tsx)' ] ,
21- testMatch : [ '**/__tests__/**/*.+(js|jsx|ts|tsx)' ] ,
26+ moduleFileExtensions : testMatchExtensions . concat ( 'json' ) ,
27+ collectCoverageFrom : [ `src/**/${ testMatchGlob } ` ] ,
28+ testMatch : [
29+ `**/__tests__/**/${ testMatchGlob } ` ,
30+ `test/**/${ testMatchGlob } ` ,
31+ `**/${ testMatchSuffixGlob } ` ,
32+ ] ,
2233 testPathIgnorePatterns : [ ...ignores ] ,
2334 coveragePathIgnorePatterns : [ ...ignores , 'src/(umd|cjs|esm)-entry.js$' ] ,
2435 transformIgnorePatterns : [ '[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$' ] ,
0 commit comments