diff --git a/packages/react-scripts/utils/createJestConfig.js b/packages/react-scripts/utils/createJestConfig.js index 99aef0408d9..57bc797d173 100644 --- a/packages/react-scripts/utils/createJestConfig.js +++ b/packages/react-scripts/utils/createJestConfig.js @@ -17,19 +17,24 @@ module.exports = (resolve, rootDir, isEjecting) => { // an absolute filename into configuration after ejecting. const setupTestsFile = pathExists.sync(paths.testsSetup) ? '/src/setupTests.js' : undefined; + // TODO: I don't know if it's safe or not to just use / as path separator + // in Jest configs. We need help from somebody with Windows to determine this. const config = { collectCoverageFrom: ['src/**/*.{js,jsx}'], setupFiles: [resolve('config/polyfills.js')], setupTestFrameworkScriptFile: setupTestsFile, - testPathIgnorePatterns: ['/(build|docs|node_modules)/'], + testPathIgnorePatterns: [ + '[/\\\\](build|docs|node_modules)[/\\\\]' + ], testEnvironment: 'node', testURL: 'http://localhost', transform: { '^.+\\.css$': resolve('config/jest/cssTransform.js'), - '^.+\\.(?!(js|jsx|css|json)$)[^\\.]+$': resolve('config/jest/fileTransform.js'), + // http://jsbin.com/bojusakico/1/edit?js,console + '^(?!.*\\.js$)': resolve('config/jest/fileTransform.js'), }, transformIgnorePatterns: [ - '/node_modules/.+\.(js|jsx|json)$' + '[/\\\\]node_modules[/\\\\].+\.(js|jsx)$' ], }; if (rootDir) {