jest: MacOS: Jest does not exit any more due to fsevents update
🐛 Bug Report
Jest does not exit any longer after the tests are done on MacOS.
I tracked it down to the Update of fsevents@2.2.0
. Not sure if it might be better to open an issue there, or if you can fix it on your end. (Edit: I created https://github.com/fsevents/fsevents/issues/345)
As a workaround, I added the following to my package.json
(through yarn
):
"resolutions": {
"**/jest-haste-map/fsevents": "2.1.3"
}
(Edit: Note that this workaround will fail installing on Windows and Linux. If you have a lock file (yarn.lock
or package-lock.json
), you should be able to set the version of fsevents
to 2.1.3
there, see https://github.com/facebook/jest/issues/10777#issuecomment-722270678 below)
To Reproduce
Steps to reproduce the behavior:
Just run jest
- I could reproduce it in a minimal repository with just Jest and a single test file.
package.json
{
"name": "foo",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"test": "jest"
},
"dependencies": {
"jest": "^26.6.2"
}
}
foo.test.js
describe('test', () => {
it('test', () => {
expect(true).toBe(true)
})
})
Expected behavior
Jest should exit after the tests are done.
envinfo
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Binaries:
Node: 12.16.3 - ~/.nvm/versions/node/v12.16.3/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v12.16.3/bin/npm
npmPackages:
jest: ^26.6.2 => 26.6.2
I also reproduced this on Node 14.1.0 and 15.0.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 61
- Comments: 20 (5 by maintainers)
Commits related to this issue
- chore: temp fix Waiting for https://github.com/facebook/jest/issues/9473 https://github.com/fsevents/fsevents/issues/345 https://github.com/facebook/jest/issues/10777 — committed to vuejs/router by posva 4 years ago
- chore: temp fix Waiting for https://github.com/facebook/jest/issues/9473 https://github.com/fsevents/fsevents/issues/345 https://github.com/facebook/jest/issues/10777 — committed to vuejs/router by posva 4 years ago
- Add A & B demo apps to help setup babel, jest, and typescript Note that fsevents is pinned to v2.1.3 for jest-haste-map, due to - https://github.com/facebook/jest/issues/10777 - https://github.com/fs... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- chore: force exit from npm run site:test — committed to ant-design/ant-design by afc163 4 years ago
- ci: workaround for jest not exit bug ref: https://github.com/facebook/jest/issues/10777 — committed to umijs/dumi by PeachScript 4 years ago
- Add A & B demo apps to help setup babel, jest, and typescript Note that fsevents is pinned to v2.1.3 for jest-haste-map, due to - https://github.com/facebook/jest/issues/10777 - https://github.com/fs... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- Add A & B demo apps to help setup babel, jest, and typescript Note that fsevents is pinned to v2.1.3 for jest-haste-map, due to - https://github.com/facebook/jest/issues/10777 - https://github.com/fs... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- Pin jest-haste-map instead of fsevents In working around https://github.com/facebook/jest/issues/10777, I pinned fsevents. However, that cannot be installed on Linux, and was blowing up on CI. Instea... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- Add demo apps to help setup babel, jest, and typescript Note that fsevents is pinned to v2.1.3 for jest-haste-map, due to - https://github.com/facebook/jest/issues/10777 - https://github.com/fsevents... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- Pin jest-haste-map instead of fsevents In working around https://github.com/facebook/jest/issues/10777, I pinned fsevents. However, that cannot be installed on Linux, and was blowing up on CI. Instea... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- Add demo apps to help setup babel, jest, and typescript Note that fsevents is pinned to v2.1.3 for jest-haste-map, due to - https://github.com/facebook/jest/issues/10777 - https://github.com/fsevents... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- Pin jest-haste-map instead of fsevents In working around https://github.com/facebook/jest/issues/10777, I pinned fsevents. However, that cannot be installed on Linux, and was blowing up on CI. Instea... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- Add demo apps to help setup babel, jest, and typescript Note that fsevents is pinned to v2.1.3 for jest-haste-map, due to - https://github.com/facebook/jest/issues/10777 - https://github.com/fsevents... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- Pin jest-haste-map instead of fsevents In working around https://github.com/facebook/jest/issues/10777, I pinned fsevents. However, that cannot be installed on Linux, and was blowing up on CI. Instea... — committed to chanzuckerberg/frontend-libs by ahuth 4 years ago
- fix: Updated tests Still need to force exit tests. Maybe related: https://github.com/facebook/jest/issues/10777 — committed to KTH/kurs-pm-web by falric 4 years ago
Fixed upstream in 2.2.1 👍
Still an ongoing issue for me. Can confirm I see this on node v12 and v14 with
jest@26.6.3
After hitting these same issues all day… I upgraded jest to 26.6.3.
My tests are now exiting without the need for --forceExit, or any other workaround.
Is it normally fixed in latest Jest version? Because I’m running 26.6.3 and the bug is still happening for me. Or is the fixed version not released yet?
Even with
fsevents@2.2.1
I’m still running into an issue where jest hangs indefinitely (with an incrementing timer) after encountering an error when running it with--watch --bail
. Anyone else having this behavior?We won’t be dropping
fsevents
(or rather, we’ll be removing the direct dependency, but it will still be pulled in viachokidar
in #10048).If you have a lockfile (which you probably do if using yarn resolutions) you can ensure fsevents is on 2.1.3 in there and avoid the bug.
Here’s a
yarn.lock
entry from my work project you can paste into your own lockfile. Ranges might vary, but as long as you also delete the entry for2.2
yarn should make sure to keep using 2.1 after aninstall
The reported issue is fixed, please open up a new bug report with a reproduction if you’re getting a similar error.
@SimenB Still an issue, can this be reopened please?
FWIW, if you can downgrade to node 10, that also seems to provide a temporary workaround.
26.6.3 didn’t fix the issue for me. But the Yarn
resolutions
fix resolved it.