Jest 不会 运行 -- 无限期挂起
Jest doesn't run -- hangs indefinitely
我最初在使用 create-react-app 时遇到了这个问题,所以我只是开玩笑地进行了简单的设置:
- 创建了新目录
- 那个目录中的 yarn init
- 纱加笑话
创建了新文件sum.js:
function sum(a, b) {
return a + b;
}
module.exports = sum;
已创建文件以测试上述功能
const sum = require('./sum');
test('adds 1 + 2 = 3' , () => {
expect(sum(1,2)).toBe(3);
});
添加到package.json:
"scripts": {
"test": "jest"
},
但是当我 运行 纱线测试时,我得到这个:
terry@terry-sharewalker:~/myProjects/test-jest$ yarn jest
yarn run v1.13.0
$ /home/terry/myProjects/test-jest/node_modules/.bin/jest
然后什么也没有发生。它只是挂起。来自 create-react-app 的 运行ning 测试也发生了同样的事情。 react-scripts 测试会显示,然后什么都没有。
这是我得到的:
Jest "^24.5.0"
Ubuntu 16.04
yarn 1.13.0
watchman 4.9.0
node 10.15.3
我已经重新安装和升级了所有我能想到的东西,包括 npm、node、watchman、linuxbrew、yarn。如果有人能帮助我,我将永远感激!!
我也遇到了同样的问题。可以通过更新或重新安装 watchman brew uninstall watchman
& brew install watchman
.
来修复
可以在此处找到更多详细信息https://github.com/facebook/jest/issues/4529
我不确定为什么这样做有效,但确实有效。我在我的系统上重新安装了一些全局包:
npm update npm -g
(至 6.9.0)
npm update -g
这次更新:
包裹捆绑器至 1.12.3
更新守望者:
brew update watchman
(至 4.9.0)
问题是由于 watchman 4.9
。
尝试 运行 watchman version
,如果挂起由 运行:
解决
brew reinstall watchman
如果你有 4.9,或者 brew update watchman
如果你更老。
参考:
https://github.com/facebook/jest/issues/4529#issuecomment-333512164
在 MacOS 上卸载并重新安装 watchman 对我不起作用
我不得不这样做:
launchctl unload ~/Library/LaunchAgents/com.github.facebook.watchman.plist
watchman version
https://github.com/facebook/watchman/issues/381#issuecomment-257673900
我最初在使用 create-react-app 时遇到了这个问题,所以我只是开玩笑地进行了简单的设置:
- 创建了新目录
- 那个目录中的 yarn init
- 纱加笑话
创建了新文件sum.js:
function sum(a, b) { return a + b; } module.exports = sum;
已创建文件以测试上述功能
const sum = require('./sum'); test('adds 1 + 2 = 3' , () => { expect(sum(1,2)).toBe(3); });
添加到package.json:
"scripts": { "test": "jest"
},
但是当我 运行 纱线测试时,我得到这个:
terry@terry-sharewalker:~/myProjects/test-jest$ yarn jest
yarn run v1.13.0
$ /home/terry/myProjects/test-jest/node_modules/.bin/jest
然后什么也没有发生。它只是挂起。来自 create-react-app 的 运行ning 测试也发生了同样的事情。 react-scripts 测试会显示,然后什么都没有。
这是我得到的:
Jest "^24.5.0"
Ubuntu 16.04
yarn 1.13.0
watchman 4.9.0
node 10.15.3
我已经重新安装和升级了所有我能想到的东西,包括 npm、node、watchman、linuxbrew、yarn。如果有人能帮助我,我将永远感激!!
我也遇到了同样的问题。可以通过更新或重新安装 watchman brew uninstall watchman
& brew install watchman
.
可以在此处找到更多详细信息https://github.com/facebook/jest/issues/4529
我不确定为什么这样做有效,但确实有效。我在我的系统上重新安装了一些全局包:
npm update npm -g
(至 6.9.0)
npm update -g
这次更新: 包裹捆绑器至 1.12.3
更新守望者:
brew update watchman
(至 4.9.0)
问题是由于 watchman 4.9
。
尝试 运行 watchman version
,如果挂起由 运行:
解决
brew reinstall watchman
如果你有 4.9,或者 brew update watchman
如果你更老。
参考: https://github.com/facebook/jest/issues/4529#issuecomment-333512164
在 MacOS 上卸载并重新安装 watchman 对我不起作用
我不得不这样做:
launchctl unload ~/Library/LaunchAgents/com.github.facebook.watchman.plist
watchman version
https://github.com/facebook/watchman/issues/381#issuecomment-257673900