@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 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
- /** Include per-file coverage percentages (lines, stmts, branch, funcs) */
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 hasGaps = uncoveredLines.length > 0;
81
- if (!verbose && !hasGaps) continue;
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
- const fileSummary = fc.toSummary().toJSON();
88
- entry["lines%"] = fileSummary.lines?.pct ?? 0;
89
- entry["stmts%"] = fileSummary.statements?.pct ?? 0;
90
- entry["branch%"] = fileSummary.branches?.pct ?? 0;
91
- entry["funcs%"] = fileSummary.functions?.pct ?? 0;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epicat/toon-reporter",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "A minimal Vitest reporter optimized for LLM consumption",
5
5
  "repository": {
6
6
  "type": "git",