Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Jest crashing on projects with large node_modules folders #2395

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/react-scripts/scripts/utils/createJestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ module.exports = (resolve, rootDir, isEjecting) => {
collectCoverageFrom: ['src/**/*.{js,jsx}'],
setupFiles: [resolve('config/polyfills.js')],
setupTestFrameworkScriptFile: setupTestsFile,
testMatch: [
'<rootDir>/src/**/__tests__/**/*.js?(x)',
'<rootDir>/src/**/?(*.)(spec|test).js?(x)',
],
// the `testMatches` option currently watches node_modules
// Which causes crashes on large projects on MacOS.
// Once this is fixes we can change from `modulePathIgnorePatterns` to `testMatches`.
// See facebook/jest/issues/1767 & facebookincubator/create-react-app/pull/2395
modulePathIgnorePatterns: ['<rootDir>\/(?!src).*\/.*'],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested, works for me. Thanks again

testEnvironment: 'node',
testURL: 'http://localhost',
transform: {
Expand Down