在Jest中测试失败时,它总是退出并抛出npm错误“ errno 1”。我觉得这很丑陋,而且看起来很令人震惊。这是开玩笑的标准吗?我更希望只看到前5行。
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 failed, 3 passed, 4 total
Snapshots: 0 total
Time: 41.881s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! applitoolsci@1.0.0 test: `jest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the applitoolsci@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nicklee/.npm/_logs/2019-04-30T19_33_00_584Z-debug.log
答案 0 :(得分:1)
实际上,这不是问题,在测试用例失败时,玩笑会以状态代码1退出。当任何测试或规范文件失败时,会出现该错误,然后在状态为1(model.predict()
)时退出成功通过所有测试用例,然后以0退出。
这是基于节点的Exit status 1
工具的常见行为。也请检查此closed issue
但是您可以使用CLI
或jest-stare
软件包来查找哪个套件在作为解决方法运行时失败了。