如何使用nyc Istanbul CLI报告器为每个文件设置阈值?

问题描述 投票:4回答:1

当我试图在.istanbul.YML中设置阈值时,我正在使用伊斯坦布尔记者进行代码覆盖

check:
    global:
        statements: 60
        lines: 100
        branches: 50
        functions: 60
        excludes: []
    each:
        statements: 100
        lines: 100
        branches: 100
        functions: 100
        excludes: []

覆盖文件时,如果它不符合阈值,但运行伊斯坦布尔覆盖和伊斯坦布尔检查覆盖的覆盖百分比不同,所以计划使用nyc我将其配置为

    .nycrc

    {
    "lines": 50,
    "statements": 50,
    "functions": 50,
    "branches": 50,
    "reporter": [
        "lcov",
        "text-summary"
    ],
    "extension": [
      ".jsx"
    ],
    "check-coverage": true
}

我可以在全局设置覆盖阈值,但是如何在每个文件的基础上设置阈值或在istanbul中正确获取覆盖率百分比。

unit-testing testing code-coverage istanbul
1个回答
0
投票

你应该用

“per-file”:是的

© www.soinside.com 2019 - 2024. All rights reserved.