我正在使用istanbul
进行代码覆盖。摘要已成功打印,但此后出现错误。
命令:
istanbul cover --print detail node_modules/mocha/bin/_mocha -- ./*
输出:
=============================================================================
Writing coverage object [E:\Node-Mocha\coverage\coverage.json]
Writing coverage reports at [E:\Node-Mocha\coverage]
=============================================================================
-------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
-------------|----------|----------|----------|----------|----------------|
Node-Mocha\ | 66.67 | 100 | 0 | 66.67 | |
app.js | 66.67 | 100 | 0 | 66.67 | 7,12 |
-------------|----------|----------|----------|----------|----------------|
All files | 66.67 | 100 | 0 | 66.67 | |
-------------|----------|----------|----------|----------|----------------|
module.js:549
throw err;
^
Error: Cannot find module 'E:\Node-Mocha\coverage'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at E:\Node-Mocha\node_modules\mocha\lib\mocha.js:250:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (E:\Node-Mocha\node_modules\mocha\lib\mocha.js:247:14)
at Mocha.run (E:\Node-Mocha\node_modules\mocha\lib\mocha.js:576:10)
at Object.<anonymous> (E:\Node-Mocha\node_modules\mocha\bin\_mocha:637:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
为什么会引发该错误?请分享您的想法。
生成报告后,为什么要在我的项目目录中寻找coverage
文件夹?
答案 0 :(得分:0)
您是否尝试过删除所有node_modules并再次安装npm?