files-coverage-check
v0.1.1
Published
check files unit coverage
Readme
FilesCoverageCheck
检查指定文件单元测试结果,目前支持单元测试报告:istanbul
Usage
tnpm install --save @tencent/files-coverage-checkimport { check } from "@tencent/files-coverage-check";
const result = await check({
summary: "./coverage/json-summary.json",
checkFiles: "./chenged.txt",
summaryPrefix: "/workdir/",
waterLine: {
lines: 80,
statements: 80,
functions: 80,
branches: 80
}
});
console.log(result.pass);输入
summary:string|json必选,从指定文件读取单元测试json报告或者json报告对象checkFiles:string|Array<string>可选,从指定文件读取需要检查的文件列表或者直接为文件列表,为空检查全部summaryPrefix:string可选,测试报告里的文件path相对于检查文件path的前缀waterLine:object可选,需要检查的水平线lines:number可选,要求最低Lines覆盖率,默认为0statements:number可选,要求最低Statements覆盖率,默认为0functions:number可选,要求最低Functions覆盖率,默认为0branches:number可选,要求最低Branches覆盖率,默认为0
输出
pass:boolean是否全部文件覆盖率在水平线以上detail:Map<filepath, Result>每个文件的详情filepath: 单个文件路径Result: 单个文件结果pass:boolean是否通过lines: 行覆盖率pct: 覆盖率pass: 是否通过
statements: 语句覆盖率pct: 覆盖率pass: 是否通过
functions: 方法覆盖率pct: 覆盖率pass: 是否通过
branches: 分支覆盖率pct: 覆盖率pass: 是否通过
