Javascript grunt代码覆盖率强制执行器不';不要在阈值限制上失败
我正在运行Jasmine测试和Karma coverage来生成lcov文件。我可以在coverage reports和console中看到,许多JavaScript文件的行覆盖率很差Javascript grunt代码覆盖率强制执行器不';不要在阈值限制上失败,javascript,gruntjs,code-coverage,Javascript,Gruntjs,Code Coverage,我正在运行Jasmine测试和Karma coverage来生成lcov文件。我可以在coverage reports和console中看到,许多JavaScript文件的行覆盖率很差 ------------------------------------|-----------|-----------|-----------|-----------| File | % Stmts |% Branches | % Funcs
------------------------------------|-----------|-----------|-----------|-----------|
File | % Stmts |% Branches | % Funcs | % Lines |
------------------------------------|-----------|-----------|-----------|-----------|
./src/accountDetails/controller\ | 9.09 | 100 | 0 | 9.09 |
AccountDetailsController.js | 9.09 | 100 | 0 | 9.09 |
伊斯坦布尔并没有停止grunt进程,所以我添加了grunt代码覆盖率执行器。配置如下所示:
'code-coverage-enforcer': { /* doesn't seem to work either */
options: {
lcovfile: "build/lcov/PhantomJS 1.9.7 (Windows 7)/lcov.info",
lines: 99,
functions: 99,
branches: 99,
src: "src",
includes: ['src/**/*.js'],
excludes: []
}
}
我很确定enforcer正在运行,因为它最初没有找到lcov.info文件。如果我使用--verbose运行enforcer任务,我会看到这样的情况(删除了很多无关的内容,比如它重申了输入选项,看起来是正确的):
因此,我的问题是:
- 这是正确的吗
- 输出中排除的>>是关于什么的
- 这个执行者任务是否会使我的构建过程失败
- 我是否可以让它在构建过程中失败(或者我是否误解了JavaScript应用程序中的代码覆盖率强制是为了什么)
行:66.67%|函数:100%|分支:100%|>>排除
文件:./src/accountDetails/controller/accountDetails controller.js
>失败的文件:src/accountDetails/controller/accountDetails.js::没有代码覆盖率数据。确保源文件在测试覆盖率(lcov)数据中表示
Reading the lcov file ....
Processing File:build/lcov/PhantomJS 1.9.7 (Windows 7)/lcov.info
Checking if file exists ... build/lcov/PhantomJS 1.9.7 (Windows 7)/lcov.info
processing callback with [
{
"file": "./src/accountDetails/controller/AccountDetailsController.js",
"lines": {
"found": 11,
"hit": 1
},
"functions": {
"hit": 0,
"found": 3
},
"branches": {
"hit": 0,
"found": 0
}
}
]
------------------------------------------------------------------
Scanning folder for files
------------------------------------------------------------------
Collecting directory:src\accountDetails\controller
------------------------------------------------------------------
Threshold configuration: lines:99%, functions:99%, branches:99%
------------------------------------------------------------------
File:./src/accountDetails/controller/AccountDetailsController.js
lines:9.09% | functions:100% | branches:100% | >> EXCLUDED
Done, without errors.