Skip to content

Commit

Permalink
Update regexes
Browse files Browse the repository at this point in the history
* Fix exclusion regex to also exclude files without extension
* Be over-cautious with Windows paths because I'm not sure how Jest handles them
  • Loading branch information
gaearon committed Dec 7, 2016
1 parent 18427fd commit 16cdfc0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/react-scripts/utils/createJestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ module.exports = (resolve, rootDir, isEjecting) => {
// an absolute filename into configuration after ejecting.
const setupTestsFile = pathExists.sync(paths.testsSetup) ? '<rootDir>/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: ['<rootDir>/(build|docs|node_modules)/'],
testPathIgnorePatterns: [
'<rootDir>[/\\\\](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) {
Expand Down

0 comments on commit 16cdfc0

Please sign in to comment.