1+ // This project uses ESM at runtime. Since ESM is very much unsupported in jest for now, we have to transform ESM things to CJS format
2+ // Jest is transforming own code using the babel-jest and we need to do the same for third party ESM code
3+ // If you add any third party ESM only modules from npm, be sure to add them here:
4+ const ESM_MODULES = [ '@octokit/.*' , 'before-after-hook' , 'universal-github-app-jwt' , 'universal-user-agent' ]
5+
16module . exports = {
2- testRegex : '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$' ,
3- moduleFileExtensions : [ 'ts' , 'tsx' , 'js' , 'jsx' , 'json' , 'node' ] ,
4- testEnvironment : 'node' ,
57 coverageReporters : [ 'lcovonly' , 'text' ] ,
68 collectCoverage : true ,
79 coverageDirectory : 'coverage' ,
8- restoreMocks : true ,
9- resetMocks : true ,
1010 collectCoverageFrom : [
1111 '**/*.ts' ,
1212 '**/*.js' ,
@@ -16,4 +16,13 @@ module.exports = {
1616 '!coverage/**' ,
1717 '!jest.config.js' ,
1818 ] ,
19+ moduleFileExtensions : [ 'ts' , 'tsx' , 'js' , 'jsx' , 'json' , 'node' ] ,
20+ moduleNameMapper : {
21+ '^(\\.{1,2}/.*)\\.js$' : '$1' ,
22+ } ,
23+ restoreMocks : true ,
24+ resetMocks : true ,
25+ testEnvironment : 'node' ,
26+ testRegex : '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$' ,
27+ transformIgnorePatterns : [ `/node_modules/(?!(${ ESM_MODULES . join ( '|' ) } )/)` ] ,
1928}
0 commit comments