Skip to content

Commit cddbe73

Browse files
committed
Update regexes
* Fix exclusion regex to also exclude files without extension * Be over-cautious with Windows paths because I'm not sure how Jest handles them
1 parent 18427fd commit cddbe73

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: packages/react-scripts/utils/createJestConfig.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,23 @@ module.exports = (resolve, rootDir, isEjecting) => {
1717
// an absolute filename into configuration after ejecting.
1818
const setupTestsFile = pathExists.sync(paths.testsSetup) ? '<rootDir>/src/setupTests.js' : undefined;
1919

20+
// TODO: I don't know if it's safe or not to just use / as path separator
21+
// in Jest configs. We need help from somebody with Windows to determine this.
2022
const config = {
2123
collectCoverageFrom: ['src/**/*.{js,jsx}'],
2224
setupFiles: [resolve('config/polyfills.js')],
2325
setupTestFrameworkScriptFile: setupTestsFile,
24-
testPathIgnorePatterns: ['<rootDir>/(build|docs|node_modules)/'],
26+
testPathIgnorePatterns: [
27+
'<rootDir>[/\\\\](build|docs|node_modules)[/\\\\]'
28+
],
2529
testEnvironment: 'node',
2630
testURL: 'http://localhost',
2731
transform: {
2832
'^.+\\.css$': resolve('config/jest/cssTransform.js'),
29-
'^.+\\.(?!(js|jsx|css|json)$)[^\\.]+$': resolve('config/jest/fileTransform.js'),
33+
'^(?!.*\\.(js|jsx|css|json)$)': resolve('config/jest/fileTransform.js'),
3034
},
3135
transformIgnorePatterns: [
32-
'/node_modules/.+\.(js|jsx|json)$'
36+
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'
3337
],
3438
};
3539
if (rootDir) {

0 commit comments

Comments
 (0)