@epicat/toon-reporter 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +15 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { Reporter, TestRunEndReason, Vitest } from "vitest/node";
|
|
|
5
5
|
interface ToonReporterOptions {
|
|
6
6
|
outputFile?: string;
|
|
7
7
|
color?: boolean;
|
|
8
|
-
/**
|
|
8
|
+
/** When true, shows all files and all coverage metrics. When false (default), only shows files with gaps and only metrics < 100% */
|
|
9
9
|
verbose?: boolean;
|
|
10
10
|
/** @internal Used for testing to capture output */
|
|
11
11
|
_captureOutput?: (output: string) => void;
|
package/dist/index.mjs
CHANGED
|
@@ -76,19 +76,27 @@ var ToonReporter = class {
|
|
|
76
76
|
const verbose = this.options.verbose;
|
|
77
77
|
for (const file of map.files()) {
|
|
78
78
|
const fc = map.fileCoverageFor(file);
|
|
79
|
+
const fileSummary = fc.toSummary().toJSON();
|
|
79
80
|
const uncoveredLines = fc.getUncoveredLines();
|
|
80
|
-
const
|
|
81
|
-
|
|
81
|
+
const lines = fileSummary.lines?.pct ?? 100;
|
|
82
|
+
const stmts = fileSummary.statements?.pct ?? 100;
|
|
83
|
+
const branch = fileSummary.branches?.pct ?? 100;
|
|
84
|
+
const funcs = fileSummary.functions?.pct ?? 100;
|
|
85
|
+
if (!verbose && lines === 100 && stmts === 100 && branch === 100 && funcs === 100) continue;
|
|
82
86
|
const entry = {
|
|
83
87
|
file: relative(rootDir, file),
|
|
84
88
|
uncoveredLines: this.formatLineRanges(uncoveredLines)
|
|
85
89
|
};
|
|
86
90
|
if (verbose) {
|
|
87
|
-
|
|
88
|
-
entry["
|
|
89
|
-
entry["
|
|
90
|
-
entry["
|
|
91
|
-
|
|
91
|
+
entry["lines%"] = lines;
|
|
92
|
+
entry["stmts%"] = stmts;
|
|
93
|
+
entry["branch%"] = branch;
|
|
94
|
+
entry["funcs%"] = funcs;
|
|
95
|
+
} else {
|
|
96
|
+
if (lines < 100) entry["lines%"] = lines;
|
|
97
|
+
if (stmts < 100) entry["stmts%"] = stmts;
|
|
98
|
+
if (branch < 100) entry["branch%"] = branch;
|
|
99
|
+
if (funcs < 100) entry["funcs%"] = funcs;
|
|
92
100
|
}
|
|
93
101
|
entries.push(entry);
|
|
94
102
|
}
|