files-coverage-check
v0.1.1
Published
check files unit coverage
Downloads
18
Readme
FilesCoverageCheck
检查指定文件单元测试结果,目前支持单元测试报告:istanbul
Usage
tnpm install --save @tencent/files-coverage-check
import { 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
: 是否通过