当我尝试在 .istanbul.YML
中设置阈值时,我正在使用 Istanbul reporter 进行代码覆盖
check:
global:
statements: 60
lines: 100
branches: 50
functions: 60
excludes: []
each:
statements: 100
lines: 100
branches: 100
functions: 100
excludes: []
未达到阈值时的覆盖率文件,但运行 istanbul cover 和 istanbul check-coverage 的覆盖率不同,因此计划使用 nyc 我将其配置为
.nycrc
{
"lines": 50,
"statements": 50,
"functions": 50,
"branches": 50,
"reporter": [
"lcov",
"text-summary"
],
"extension": [
".jsx"
],
"check-coverage": true
}
我可以在全局范围内设置覆盖率阈值,但我如何设置每个文件的阈值或在 Istanbul 尔正确获取覆盖率百分比。
最佳答案
你应该使用
“每个文件”:true
关于unit-testing - 如何使用 nyc Istanbul CLI reporter 为每个文件设置阈值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42222013/