monocart-coverage-reports
Advanced tools
Comparing version 1.0.4 to 1.0.6
@@ -26,8 +26,8 @@ const fs = require('fs'); | ||
const p = fileURLToPath(url); | ||
const json = Util.readJSONSync(p); | ||
if (!json) { | ||
const content = Util.readFileSync(p); | ||
if (!content) { | ||
Util.logDebug(EC.red(`failed to load sourcemap ${p}`)); | ||
return; | ||
} | ||
return json; | ||
return JSON.parse(content); | ||
} | ||
@@ -34,0 +34,0 @@ |
@@ -14,2 +14,10 @@ | ||
export type Watermarks = [number, number] | { | ||
statements?: [number, number], | ||
functions?: [number, number], | ||
branches?: [number, number], | ||
lines?: [number, number], | ||
bytes?: [number, number] | ||
} | ||
export type ReportDescription = | ||
@@ -114,11 +122,14 @@ ['v8'] | | ||
// (Object) Istanbul: { statements:[50,80], functions:[50,80], branches:[50,80], lines:[50,80] }, V8: { bytes:[50,80] }. | ||
watermarks?: [number, number] | { | ||
statements?: [number, number], | ||
functions?: [number, number], | ||
branches?: [number, number], | ||
lines?: [number, number], | ||
bytes?: [number, number] | ||
} | ||
}; | ||
watermarks?: Watermarks | ||
} | ||
export type CoverageResults = { | ||
type: "v8" | "istanbul", | ||
reportPath: string, | ||
name: string, | ||
watermarks: Watermarks, | ||
summary: any, | ||
files: any | ||
} | ||
export class CoverageReport { | ||
@@ -131,3 +142,3 @@ constructor(options?: CoverageReportOptions); | ||
// generate report | ||
generate: () => Promise<any>; | ||
generate: () => Promise<CoverageResults>; | ||
@@ -134,0 +145,0 @@ // check if cache exists |
{ | ||
"name": "monocart-coverage-reports", | ||
"version": "1.0.4", | ||
"version": "1.0.6", | ||
"description": "Monocart coverage reports", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -26,4 +26,4 @@ # Monocart Coverage Reports | ||
await coverageReport.add(coverageData2); | ||
const report = await coverageReport.generate(); | ||
console.log(report.summary); | ||
const coverageResults = await coverageReport.generate(); | ||
console.log(coverageResults.summary); | ||
``` | ||
@@ -96,4 +96,4 @@ - [example v8](https://github.com/cenfun/monocart-coverage-reports/blob/main/tests/test-v8.js) | ||
const coverageReport = new CoverageReport(options); | ||
const report = await coverageReport.generate(); | ||
console.log(report.summary); | ||
const coverageResults = await coverageReport.generate(); | ||
console.log(coverageResults.summary); | ||
``` | ||
@@ -100,0 +100,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
519772
3930