Mocha -chai 报道未知
Mocha -chai coverage Unknown
大家好,我正在尝试获取 mocha chai 单元测试覆盖率报告。
我的测试结果通过了。
还生成了 html 的覆盖范围,但是,它显示未知。请看下图。
Package.json
在脚本中添加了以下配置。
"scripts": {
"test": "mocha",
"test-with-coverage": "nyc --reporter=html mocha"
},
并使用以下命令进行 运行 测试。
npm run test-with-coverage
编辑:
当将报告更改为文本时,在终端中得到以下报告。
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
请尝试使用以下命令,
nyc -x \"**/tests/**\" --reporter=cobertura --reporter=html mocha 'your test folder path'
大家好,我正在尝试获取 mocha chai 单元测试覆盖率报告。
我的测试结果通过了。
还生成了 html 的覆盖范围,但是,它显示未知。请看下图。
Package.json
在脚本中添加了以下配置。
"scripts": {
"test": "mocha",
"test-with-coverage": "nyc --reporter=html mocha"
},
并使用以下命令进行 运行 测试。
npm run test-with-coverage
编辑: 当将报告更改为文本时,在终端中得到以下报告。
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
请尝试使用以下命令,
nyc -x \"**/tests/**\" --reporter=cobertura --reporter=html mocha 'your test folder path'