jest: Watch mode crashes with ProcessTerminatedError in new test pattern mode
git clone https://github.com/facebook/react.git
cd react
yarn
npm test -- --watch Perf
t
returns <Enter>

The watch mode crashes:
FAIL src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js
● Test suite failed to run
ProcessTerminatedError: cancel after 2 retries!
at Farm.<anonymous> (node_modules/worker-farm/lib/farm.js:81:25)
at Array.forEach (native)
at Farm.<anonymous> (node_modules/worker-farm/lib/farm.js:75:36)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
A worker process has quit unexpectedly! Most likely this an initialization error.
RUNS src/renderers/dom/shared/__tests__/findDOMNode-test.js
RUNS src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js
RUNS eslint-rules/__tests__/warning-and-invariant-args-test.js
RUNS src/renderers/__tests__/ReactMockedComponent-test.js
Test Suites: 79 skipped, 10 passed, 10 of 126 total
Tests: 1469 skipped, 19 passed, 1488 total
Snapshots: 0 total
Time: 6snpm ERR! Test failed. See above for more details.
If I just run npm test -- --watch ReactBrowserEventEmitter
I can’t reproduce this.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 33 (23 by maintainers)
Try adding
jest.useFakeTimers();
above yourit
blocks. You don’t need to make any global config changes that way.@hakimelek
Getting this issue in our app with react-native while running tests. Adding:
"jest": { ... "timers": "fake" ... }
resolved the issue. Stacktrace (without timers: fake ):TypeError: Cannot read property 'Object.<anonymous>' of null at Runtime._execModule (/opt/application/node_modules/jest-runtime/build/index.js:518:64) at Runtime.requireModule (/opt/application/node_modules/jest-runtime/build/index.js:332:14) at Runtime.requireModuleOrMock (/opt/application/node_modules/jest-runtime/build/index.js:408:19) at Function.bezier (/opt/application/node_modules/react-native/Libraries/Animated/src/Easing.js:228:13) at ease (/opt/application/node_modules/react-native/Libraries/Animated/src/Easing.js:94:14) at TimingAnimation._easing (/opt/application/node_modules/react-native/Libraries/Animated/src/Easing.js:260:8) at TimingAnimation.onUpdate (/opt/application/node_modules/react-native/Libraries/Animated/src/animations/TimingAnimation.js:138:6) at ontimeout (timers.js:469:11) at tryOnTimeout (timers.js:304:5) at Timer.listOnTimeout (timers.js:264:5)
Same error with 21.0.0.alpha.2: