jest: Jest hangs on Windows Git Bash
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Running Jest within Windows Git Bash. NPM will attempt to execute Jest, but then it sits and hangs without doing anything. Here is what shows after 30 minutes of waiting:
$ npm test
> itada-web-ui@0.1.0 test C:\dev\ITADA\web-ui
> jest
What is the expected behavior? I expect the tests to run.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Environment:
- OS: Windows 7
- Windows Git Bash: version 2.8
- npm: v3.7.3
- node: v5.9.0
package.json:
...
"jest": "^18.1.0",
"babel-jest": "^18.0.0"
},
"jest": {
"moduleDirectories": [
"node_modules",
"js"
],
"setupFiles": [
"<rootDir>/test/__env__/setup.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/js/",
"/src/",
"/dist/",
"/build/",
"/coverage/"
],
"collectCoverageFrom": [
"js/**/*.js",
"!**/node_modules/**",
"!**/build/**",
"!**/dist/**",
"!**/coverage/**"
],
"coverageDirectory": "coverage",
"coverageReporters": [
"json",
"lcov",
"text-summary",
"html"
]
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 10
- Comments: 27 (2 by maintainers)
If you want this to be fixed, figure out why it breaks and send a pull request. This is open source, not the place where you can ask me to fix problems you are running into. I’m sorry this is unfortunate to you. If Jest doesn’t work for you, either fix it or don’t use it.
@cpojer In @bennett000 's defense this isn’t some corner-case. This is support for the windows platform at large
I get that a lot of people demand things of OSS devs. I’m a big fan of “How to ask questions the smart way”.
Sorry for the extra stress. I’ll buy you a beer if I see you at a conference or something (not for fixing the issue just to help with your stress, as for the issue I love jest, and I’ll find a Windows machine and dig deeper)
I’ve got the same issue, using git bash, either through
npm run
,yarn run
or directly running thejest
global.However adding the
-i
‘–runInBand’ option fixes this for me, not sure why.FYI for anyone still following, it’s not just git bash.
For me it works in cmd but doesn’t work on our build server (Bamboo). Tests just hangs without any output. I killed the process after 90 minutes (tests usually complete in about 1 minute). All other npm & node tasks seem to work fine.
--runInBand
works for me in this scenario.I have the same problem. It hangs on when executing
npm test
,yarn test
or directlyjest
.Environment:
Config:
Edit: My tests started working when it runs in the same process (with
--runInBand
argument)For anyone on windows getting jest hang, make sure you are using the latest available version (at least 22.0.6). I was playing around with some 3rd party code that had a pre-commit hook with jest and it was just hanging and -i didn’t seem to help. Updating the jest dependency seems to have worked.
For the npm crowd, the fix from @sebinsua also works when adjusted like so:
(For
npm test
that callsjest
)We’ve moved off of Windows onto Mac. Never could get it to work on git bash for me, but others on the team could get it to run.
I don’t see much help for this issue as it appears to be limited solely to git bash. The tests ran just fine in CMD/Powershell.
update: we used
-i
on our team-member’s Windows machine and all is working well again.I ran into this issue too. runInBand fixes it but is clearly suboptimal. Also using -i and --watch causes all tests to get trigger upon just a modification of a single test file. (v20.0.4)
It seems like this is not a Jest issue but rather a Windows issue? What happens if you do
--no-watchman
?Same here. But it works very well with Yarn (
yarn test
).