表达式节点测试覆盖w Istanbul / mocha错误:ENOENT:没有这样的文件或目录node_modules / istanbul-reports / lib / html / assets

时间:2017-04-03 07:32:00

标签: node.js mocha istanbul coveralls

使用

"babel-cli": "6.18.0",
"babel-core": "6.18.0",
"babel-plugin-add-module-exports": "0.2.1",
"babel-preset-es2015": "6.16.0",
"babel-preset-stage-2": "6.18.0",

"coveralls": "^2.13.0",
"istanbul": "1.1.0-alpha.1",
"mocha": "3.2.0",

我运行脚本时

 "test:coverage": "cross-env NODE_ENV=test ./node_modules/.bin/istanbul cover _mocha -- --ui bdd --reporter spec --colors --compilers js:babel-core/register server/tests --recursive"

所有测试都在通过

    ...
15 passing (904ms)

但我从伊斯坦布尔报告模块中收到错误,欢迎任何提示...

fs.js:871
  return binding.readdir(pathModule._makeLong(path), options.encoding);
                 ^

Error: ENOENT: no such file or directory, scandir '..myApp/node_modules/istanbul-reports/lib/html/assets'
    at Object.fs.readdirSync (fs.js:871:18)
    at copyAssets (..myApp/node_modules/istanbul-reports/lib/html/index.js:156:16)
    at ..myApp/node_modules/istanbul-reports/lib/html/index.js:173:9
    at Array.forEach (native)
    at HtmlReport.onStart (..myApp/node_modules/istanbul-reports/lib/html/index.js:172:21)
    at LcovReport.(anonymous function) [as onStart] (..myApp/node_modules/istanbul-reports/lib/lcov/index.js:24:24)
    at Visitor.(anonymous function) [as onStart] (..myApp/node_modules/istanbul-lib-report/lib/tree.js:34:30)
    at Tree.visit (..myApp/node_modules/istanbul-lib-report/lib/tree.js:157:13)
    at ..myApp/node_modules/istanbul-api/lib/reporter.js:84:18
    at Array.forEach (native)
    at Reporter.write (..myApp/node_modules/istanbul-api/lib/reporter.js:82:35)
    at exitFn (..myApp/node_modules/istanbul-api/lib/run-cover.js:169:18)
    at Object.onceWrapper (events.js:290:19)
    at emitOne (events.js:101:20)
    at process.emit (events.js:188:7)
    at process.exit (internal/process.js:147:15)
    at done (..myApp/node_modules/mocha/bin/_mocha:474:15)
    at afterWrite (_stream_writable.js:386:3)
    at _combinedTickCallback (internal/process/next_tick.js:80:20)
    at process._tickCallback (internal/process/next_tick.js:98:9)
error Command failed with exit code 1.

1 个答案:

答案 0 :(得分:0)

已解决......

我在脚本中错过了伊斯坦布尔的--report选项!

"test:coverage": "cross-env NODE_ENV=test ./node_modules/.bin/istanbul cover 
 --report lcov --report json --report text --report html _mocha -- --ui bdd 
--reporter spec --colors --compilers js:babel-core/register server/tests --recursive",