node.js - Jest 不运行 - 无限期挂起
问题描述
我最初在使用 create-react-app 时遇到了这个问题,所以我只是开玩笑地做了一些简单的设置:
- 创建了新目录
- 该目录中的纱线初始化
- 纱线添加笑话
创建了新文件 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 运行测试也发生了同样的事情。react-scripts test 会显示,然后什么也没有。
这是我得到的:
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
推荐阅读
- python - Python REST 服务器与正在进行的子进程交互
- javascript - 返回 if 语句的变量 javascript
- javascript - 如何重命名 PWA 应用程序图标/调试多浏览器的快捷方式
- nginx - Nginx 邮件模块总是 smtp_auth 总是通过 PLAIN 方法
- json - 如何使用 $lte 从 json 中过滤掉字符串值
- javascript - 为什么使用“切片”复制的JS数组不等于其源数组
- python - 当我将 keras 导入 python 时,如何解决这个错误?
- angular - 侧边菜单中的更新指令 - Ionic4/Angular
- pine-script - 显示计算结果而不是输入
- c# - 如何使用 BoardCastReceiver 识别哪张 SIM 卡收到了短信?