diff-cover-js 0.1.0

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.
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getGitDiff = getGitDiff;
7
+ const child_process_1 = require("child_process");
8
+ const parse_diff_1 = __importDefault(require("parse-diff"));
9
+ const path_utils_1 = require("./path-utils");
10
+ /**
11
+ * Run `git diff <compareRef><rangeNotation>HEAD` and return added line numbers per file.
12
+ *
13
+ * Uses spawnSync (no shell) to prevent command injection from user-supplied compareRef.
14
+ * --no-color and --no-ext-diff prevent ANSI escape codes from corrupting parse-diff output.
15
+ * --unified=0 gives no context lines so every hunk line is purely + or -.
16
+ * --diff-filter=ACMR skips deleted files.
17
+ */
18
+ function getGitDiff(compareRef, rangeNotation = '...') {
19
+ var _a, _b, _c, _d, _e;
20
+ const args = [
21
+ // Suppress prefix and mnemonic-prefix config that could alter path format
22
+ '-c', 'diff.noprefix=no',
23
+ '-c', 'diff.mnemonicprefix=no',
24
+ // Force plain path output so parse-diff sees unquoted paths for non-ASCII filenames
25
+ '-c', 'core.quotePath=false',
26
+ 'diff',
27
+ `${compareRef}${rangeNotation}HEAD`,
28
+ '--unified=0',
29
+ '--diff-filter=ACMR',
30
+ '--no-color',
31
+ '--no-ext-diff',
32
+ ];
33
+ const proc = (0, child_process_1.spawnSync)('git', args, {
34
+ encoding: 'utf8',
35
+ maxBuffer: 50 * 1024 * 1024,
36
+ });
37
+ if (proc.error) {
38
+ const isNotFound = proc.error.code === 'ENOENT';
39
+ throw new Error(isNotFound
40
+ ? 'git not found. Make sure git is installed and available in your PATH.'
41
+ : `git diff failed: ${proc.error.message}\nMake sure "${compareRef}" is fetched before running diff-cover-js.`);
42
+ }
43
+ if (proc.status !== 0) {
44
+ const stderr = (_b = (_a = proc.stderr) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
45
+ throw new Error(`git diff exited with code ${proc.status}: ${stderr}\nMake sure "${compareRef}" is fetched before running diff-cover-js.`);
46
+ }
47
+ const diffOutput = (_c = proc.stdout) !== null && _c !== void 0 ? _c : '';
48
+ const files = (0, parse_diff_1.default)(diffOutput);
49
+ const result = [];
50
+ for (const file of files) {
51
+ if (file.deleted === true || file.to === '/dev/null')
52
+ continue;
53
+ const rawPath = (_e = (_d = file.to) !== null && _d !== void 0 ? _d : file.from) !== null && _e !== void 0 ? _e : '';
54
+ if (!rawPath)
55
+ continue;
56
+ const filePath = (0, path_utils_1.normalizePath)(rawPath);
57
+ const addedLines = new Set();
58
+ for (const chunk of file.chunks) {
59
+ for (const change of chunk.changes) {
60
+ if (change.type === 'add') {
61
+ addedLines.add(change.ln);
62
+ }
63
+ }
64
+ }
65
+ if (addedLines.size === 0)
66
+ continue;
67
+ result.push({ filePath, addedLines, isNew: file.new === true });
68
+ }
69
+ return result;
70
+ }
71
+ //# sourceMappingURL=git-diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-diff.js","sourceRoot":"","sources":["../src/git-diff.ts"],"names":[],"mappings":";;;;;AAuBA,gCA8DC;AArFD,iDAA0C;AAC1C,4DAAmC;AACnC,6CAA6C;AAa7C;;;;;;;GAOG;AACH,SAAgB,UAAU,CAAE,UAAkB,EAAE,gBAA+B,KAAK;;IAClF,MAAM,IAAI,GAAG;QACX,0EAA0E;QAC1E,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,wBAAwB;QAC9B,oFAAoF;QACpF,IAAI,EAAE,sBAAsB;QAC5B,MAAM;QACN,GAAG,UAAU,GAAG,aAAa,MAAM;QACnC,aAAa;QACb,oBAAoB;QACpB,YAAY;QACZ,eAAe;KAChB,CAAC;IAEF,MAAM,IAAI,GAAG,IAAA,yBAAS,EAAC,KAAK,EAAE,IAAI,EAAE;QAClC,QA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CAAC;YAChC,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBACnC,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;oBAC1B,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC;YAAE,SAAS;QAEpC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,13 @@
1
+ export { getGitDiff } from './git-diff';
2
+ export { parseLcov } from './lcov-parser';
3
+ export { calculateDiffCoverage, DEFAULT_EXCLUDES } from './calculator';
4
+ export { printReport } from './reporter';
5
+ export { normalizePath, findRepoRoot, clearRepoRootCache } from './path-utils';
6
+ export { generateJsonReport, generateMarkdownReport, generateHtmlReport, buildReportDict, combineAdjacentLines, parseFormatOption, writeFormats, } from './report-generator';
7
+ export { loadConfig } from './config';
8
+ export type { FileDiff, RangeNotation } from './git-diff';
9
+ export type { LcovFileCoverage } from './lcov-parser';
10
+ export type { FileStats, DiffCoverageResult, CalculatorOptions } from './calculator';
11
+ export type { ReportDict, SrcStats } from './report-generator';
12
+ export type { DiffCoverConfig } from './config';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EAAE,SAAS,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrF,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadConfig = exports.writeFormats = exports.parseFormatOption = exports.combineAdjacentLines = exports.buildReportDict = exports.generateHtmlReport = exports.generateMarkdownReport = exports.generateJsonReport = exports.clearRepoRootCache = exports.findRepoRoot = exports.normalizePath = exports.printReport = exports.DEFAULT_EXCLUDES = exports.calculateDiffCoverage = exports.parseLcov = exports.getGitDiff = void 0;
4
+ var git_diff_1 = require("./git-diff");
5
+ Object.defineProperty(exports, "getGitDiff", { enumerable: true, get: function () { return git_diff_1.getGitDiff; } });
6
+ var lcov_parser_1 = require("./lcov-parser");
7
+ Object.defineProperty(exports, "parseLcov", { enumerable: true, get: function () { return lcov_parser_1.parseLcov; } });
8
+ var calculator_1 = require("./calculator");
9
+ Object.defineProperty(exports, "calculateDiffCoverage", { enumerable: true, get: function () { return calculator_1.calculateDiffCoverage; } });
10
+ Object.defineProperty(exports, "DEFAULT_EXCLUDES", { enumerable: true, get: function () { return calculator_1.DEFAULT_EXCLUDES; } });
11
+ var reporter_1 = require("./reporter");
12
+ Object.defineProperty(exports, "printReport", { enumerable: true, get: function () { return reporter_1.printReport; } });
13
+ var path_utils_1 = require("./path-utils");
14
+ Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return path_utils_1.normalizePath; } });
15
+ Object.defineProperty(exports, "findRepoRoot", { enumerable: true, get: function () { return path_utils_1.findRepoRoot; } });
16
+ Object.defineProperty(exports, "clearRepoRootCache", { enumerable: true, get: function () { return path_utils_1.clearRepoRootCache; } });
17
+ var report_generator_1 = require("./report-generator");
18
+ Object.defineProperty(exports, "generateJsonReport", { enumerable: true, get: function () { return report_generator_1.generateJsonReport; } });
19
+ Object.defineProperty(exports, "generateMarkdownReport", { enumerable: true, get: function () { return report_generator_1.generateMarkdownReport; } });
20
+ Object.defineProperty(exports, "generateHtmlReport", { enumerable: true, get: function () { return report_generator_1.generateHtmlReport; } });
21
+ Object.defineProperty(exports, "buildReportDict", { enumerable: true, get: function () { return report_generator_1.buildReportDict; } });
22
+ Object.defineProperty(exports, "combineAdjacentLines", { enumerable: true, get: function () { return report_generator_1.combineAdjacentLines; } });
23
+ Object.defineProperty(exports, "parseFormatOption", { enumerable: true, get: function () { return report_generator_1.parseFormatOption; } });
24
+ Object.defineProperty(exports, "writeFormats", { enumerable: true, get: function () { return report_generator_1.writeFormats; } });
25
+ var config_1 = require("./config");
26
+ Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_1.loadConfig; } });
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAwC;AAA/B,sGAAA,UAAU,OAAA;AACnB,6CAA0C;AAAjC,wGAAA,SAAS,OAAA;AAClB,2CAAuE;AAA9D,mHAAA,qBAAqB,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAChD,uCAAyC;AAAhC,uGAAA,WAAW,OAAA;AACpB,2CAA+E;AAAtE,2GAAA,aAAa,OAAA;AAAE,0GAAA,YAAY,OAAA;AAAE,gHAAA,kBAAkB,OAAA;AACxD,uDAQ4B;AAP1B,sHAAA,kBAAkB,OAAA;AAClB,0HAAA,sBAAsB,OAAA;AACtB,sHAAA,kBAAkB,OAAA;AAClB,mHAAA,eAAe,OAAA;AACf,wHAAA,oBAAoB,OAAA;AACpB,qHAAA,iBAAiB,OAAA;AACjB,gHAAA,YAAY,OAAA;AAEd,mCAAsC;AAA7B,oGAAA,UAAU,OAAA"}
@@ -0,0 +1,18 @@
1
+ export interface LcovFileCoverage {
2
+ filePath: string;
3
+ /** lineNumber → hitCount (0 = not covered, >0 = covered) */
4
+ lines: Map<number, number>;
5
+ }
6
+ /**
7
+ * Parse an lcov.info file.
8
+ * Only SF: (source file) and DA: (line data) records matter for diff coverage.
9
+ *
10
+ * lcov format per file block:
11
+ * TN:<test name>
12
+ * SF:<source file path>
13
+ * DA:<line number>,<hit count>
14
+ * ...
15
+ * end_of_record
16
+ */
17
+ export declare function parseLcov(lcovPath: string): Map<string, LcovFileCoverage>;
18
+ //# sourceMappingURL=lcov-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lcov-parser.d.ts","sourceRoot":"","sources":["../src/lcov-parser.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CA+B1E"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseLcov = parseLcov;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ /**
9
+ * Parse an lcov.info file.
10
+ * Only SF: (source file) and DA: (line data) records matter for diff coverage.
11
+ *
12
+ * lcov format per file block:
13
+ * TN:<test name>
14
+ * SF:<source file path>
15
+ * DA:<line number>,<hit count>
16
+ * ...
17
+ * end_of_record
18
+ */
19
+ function parseLcov(lcovPath) {
20
+ var _a;
21
+ const content = fs_1.default.readFileSync(lcovPath, 'utf8');
22
+ const result = new Map();
23
+ let current = null;
24
+ for (const raw of content.split('\n')) {
25
+ const line = raw.trim();
26
+ if (line.startsWith('SF:')) {
27
+ current = { filePath: line.slice(3), lines: new Map() };
28
+ }
29
+ else if (line.startsWith('DA:') && current !== null) {
30
+ const [lineNumStr, hitCountStr] = line.slice(3).split(',');
31
+ const lineNum = parseInt(lineNumStr, 10);
32
+ const hitCount = parseInt(hitCountStr, 10);
33
+ if (!isNaN(lineNum) && !isNaN(hitCount)) {
34
+ // If the same line appears multiple times (branches), keep the max hit count
35
+ const existing = (_a = current.lines.get(lineNum)) !== null && _a !== void 0 ? _a : 0;
36
+ current.lines.set(lineNum, Math.max(existing, hitCount));
37
+ }
38
+ }
39
+ else if (line === 'end_of_record' && current !== null) {
40
+ result.set(current.filePath, current);
41
+ current = null;
42
+ }
43
+ }
44
+ // Flush the last block in case the file is truncated (no trailing end_of_record)
45
+ if (current !== null) {
46
+ result.set(current.filePath, current);
47
+ }
48
+ return result;
49
+ }
50
+ //# sourceMappingURL=lcov-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lcov-parser.js","sourceRoot":"","sources":["../src/lcov-parser.ts"],"names":[],"mappings":";;;;;AAmBA,8BA+BC;AAlDD,4CAAoB;AAQpB;;;;;;;;;;GAUG;AACH,SAAgB,SAAS,CAAE,QAAgB;;IACzC,MAAM,OAAO,GAAG,YAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,GAAG,EAA4B,CAA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QACjB,CAAC;IACH,CAAC;IAED,iFAAiF;IACjF,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare function clearRepoRootCache(): void;
2
+ export declare function findRepoRoot(): string;
3
+ /**
4
+ * Normalize a file path to a consistent relative posix form for comparison.
5
+ * Handles:
6
+ * - git diff a/b prefixes ("a/src/foo.ts" → "src/foo.ts")
7
+ * - absolute paths ("/vd/src/foo.ts" → "src/foo.ts")
8
+ * - leading ./ ("./src/foo.ts" → "src/foo.ts")
9
+ * - Windows backslashes ("src\\foo.ts" → "src/foo.ts")
10
+ */
11
+ export declare function normalizePath(filePath: string, repoRoot?: string): string;
12
+ //# sourceMappingURL=path-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,IAAK,IAAI,CAE1C;AAED,wBAAgB,YAAY,IAAK,MAAM,CAStC;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAuB1E"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.clearRepoRootCache = clearRepoRootCache;
7
+ exports.findRepoRoot = findRepoRoot;
8
+ exports.normalizePath = normalizePath;
9
+ const path_1 = __importDefault(require("path"));
10
+ const child_process_1 = require("child_process");
11
+ // Module-level cache — findRepoRoot() is called once per normalizePath() call,
12
+ // which happens for every LCOV entry. Cache avoids spawning hundreds of subprocesses.
13
+ let _repoRoot = null;
14
+ function clearRepoRootCache() {
15
+ _repoRoot = null;
16
+ }
17
+ function findRepoRoot() {
18
+ if (_repoRoot !== null)
19
+ return _repoRoot;
20
+ const proc = (0, child_process_1.spawnSync)('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8' });
21
+ _repoRoot = proc.status === 0 && proc.stdout
22
+ ? proc.stdout.trim()
23
+ : process.cwd();
24
+ return _repoRoot;
25
+ }
26
+ /**
27
+ * Normalize a file path to a consistent relative posix form for comparison.
28
+ * Handles:
29
+ * - git diff a/b prefixes ("a/src/foo.ts" → "src/foo.ts")
30
+ * - absolute paths ("/vd/src/foo.ts" → "src/foo.ts")
31
+ * - leading ./ ("./src/foo.ts" → "src/foo.ts")
32
+ * - Windows backslashes ("src\\foo.ts" → "src/foo.ts")
33
+ */
34
+ function normalizePath(filePath, repoRoot) {
35
+ let p = filePath;
36
+ // Strip a/ or b/ prefix from unified diff paths
37
+ if (/^[ab]\//.test(p)) {
38
+ p = p.slice(2);
39
+ }
40
+ // Strip absolute path to relative
41
+ if (path_1.default.isAbsolute(p)) {
42
+ const root = repoRoot !== null && repoRoot !== void 0 ? repoRoot : findRepoRoot();
43
+ p = path_1.default.relative(root, p);
44
+ }
45
+ // Strip leading ./
46
+ if (p.startsWith('./')) {
47
+ p = p.slice(2);
48
+ }
49
+ // Normalize Windows backslashes to forward slashes
50
+ p = p.replace(/\\/g, '/');
51
+ return p;
52
+ }
53
+ //# sourceMappingURL=path-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":";;;;;AAOA,gDAEC;AAED,oCASC;AAUD,sCAuBC;AArDD,gDAAwB;AACxB,iDAA0C;AAE1C,+EAA+E;AAC/E,sFAAsF;AACtF,IAAI,SAAS,GAAkB,IAAI,CAAC;AAEpC,SAAgB,kBAAkB;IAChC,SAAS,GAAG,IAAI,CAAC;AACnB,CAAC;AAED,SAAgB,YAAY;IAC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Covered: number | null;
4
+ /** Raw uncovered line numbers — matches diff-cover's integer-array JSON schema */
5
+ violationLines: number[];
6
+ coveredLines: number[];
7
+ coverableLines: number;
8
+ /** True when the file was in the diff but had no lcov entry (strict mode) */
9
+ missingFromLcov: boolean;
10
+ }
11
+ export interface ReportDict {
12
+ diffName: string;
13
+ srcStats: Record<string, SrcStats>;
14
+ totalNumLines: number;
15
+ totalNumViolations: number;
16
+ totalPercentCovered: number;
17
+ numChangedLines: number;
18
+ }
19
+ /**
20
+ * Collapse adjacent line numbers into range strings.
21
+ * [1, 2, 5, 6, 100] → ["1-2", "5-6", "100"]
22
+ * Mirrors diff-cover's TemplateReportGenerator.combine_adjacent_lines()
23
+ */
24
+ export declare function combineAdjacentLines(lineNumbers: number[]): string[];
25
+ export declare function buildReportDict(result: DiffCoverageResult, diffName: string): ReportDict;
26
+ export declare function generateJsonReport(result: DiffCoverageResult, diffName: string): string;
27
+ export declare function generateMarkdownReport(result: DiffCoverageResult, diffName: string): string;
28
+ /**
29
+ * @param failUnder - the --fail-under threshold, used to colour the summary green/red.
30
+ * Defaults to 0 (always green) when not provided.
31
+ */
32
+ export declare function generateHtmlReport(result: DiffCoverageResult, diffName: string, failUnder?: number): string;
33
+ /**
34
+ * Parse --format string the same way diff-cover does:
35
+ * "html:path/to/report.html,json:path/to/report.json"
36
+ * → { html: "path/to/report.html", json: "path/to/report.json" }
37
+ *
38
+ * Format name alone (no colon) uses the default path for that format.
39
+ * Unknown format names produce a warning.
40
+ */
41
+ export declare function parseFormatOption(raw: string): Record<string, string>;
42
+ export declare function writeFormats(formats: Record<string, string>, result: DiffCoverageResult, diffName: string, failUnder?: number): void;
43
+ //# sourceMappingURL=report-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-generator.d.ts","sourceRoot":"","sources":["../src/report-generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,MAAM,WAAW,QAAQ;IACvB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UN"}
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.combineAdjacentLines = combineAdjacentLines;
7
+ exports.buildReportDict = buildReportDict;
8
+ exports.generateJsonReport = generateJsonReport;
9
+ exports.generateMarkdownReport = generateMarkdownReport;
10
+ exports.generateHtmlReport = generateHtmlReport;
11
+ exports.parseFormatOption = parseFormatOption;
12
+ exports.writeFormats = writeFormats;
13
+ const fs_1 = __importDefault(require("fs"));
14
+ const path_1 = __importDefault(require("path"));
15
+ /**
16
+ * Collapse adjacent line numbers into range strings.
17
+ * [1, 2, 5, 6, 100] → ["1-2", "5-6", "100"]
18
+ * Mirrors diff-cover's TemplateReportGenerator.combine_adjacent_lines()
19
+ */
20
+ function combineAdjacentLines(lineNumbers) {
21
+ if (lineNumbers.length === 0)
22
+ return [];
23
+ const sorted = [...lineNumbers].sort((a, b) => a - b);
24
+ const ranges = [];
25
+ let start = sorted[0];
26
+ let end = sorted[0];
27
+ for (let i = 1; i < sorted.length; i++) {
28
+ if (sorted[i] === end + 1) {
29
+ end = sorted[i];
30
+ }
31
+ else {
32
+ ranges.push(start === end ? String(start) : `${start}-${end}`);
33
+ start = sorted[i];
34
+ end = sorted[i];
35
+ }
36
+ }
37
+ ranges.push(start === end ? String(start) : `${start}-${end}`);
38
+ return ranges;
39
+ }
40
+ function buildReportDict(result, diffName) {
41
+ const srcStats = {};
42
+ for (const file of result.files) {
43
+ // Include strict-mode files (inLcov: false) so JSON/HTML/Markdown are
44
+ // consistent with the console report — both show these files at 0%.
45
+ srcStats[file.filePath] = {
46
+ percentCovered: file.inLcov
47
+ ? (file.coverableAddedLines === 0 ? null : file.coveragePercent)
48
+ : 0,
49
+ violationLines: file.uncoveredLineNumbers,
50
+ coveredLines: file.coveredLineNumbers,
51
+ coverableLines: file.coverableAddedLines,
52
+ missingFromLcov: !file.inLcov,
53
+ };
54
+ }
55
+ return {
56
+ diffName,
57
+ srcStats,
58
+ totalNumLines: result.totalCoverable,
59
+ totalNumViolations: result.totalCoverable - result.totalCovered,
60
+ totalPercentCovered: result.overallPercent,
61
+ numChangedLines: result.totalAdded,
62
+ };
63
+ }
64
+ // ─── JSON Report (mirrors JsonReportGenerator) ────────────────────────────────
65
+ function generateJsonReport(result, diffName) {
66
+ return JSON.stringify(buildReportDict(result, diffName), null, 2);
67
+ }
68
+ // ─── Markdown Report (mirrors MarkdownReportGenerator) ────────────────────────
69
+ function generateMarkdownReport(result, diffName) {
70
+ const dict = buildReportDict(result, diffName);
71
+ const entries = Object.entries(dict.srcStats).sort(([a], [b]) => a.localeCompare(b));
72
+ const fileLines = entries.map(([srcPath, stats]) => {
73
+ if (stats.missingFromLcov) {
74
+ return `- ${srcPath} (0%): Not in coverage data`;
75
+ }
76
+ if (stats.percentCovered === null || stats.percentCovered === 100) {
77
+ return `- ${srcPath} (100%)`;
78
+ }
79
+ const missing = combineAdjacentLines(stats.violationLines).join(', ');
80
+ return `- ${srcPath} (${stats.percentCovered}%): Missing lines ${missing}`;
81
+ });
82
+ const noData = entries.length === 0;
83
+ const lineWord = (n) => n === 1 ? 'line' : 'lines';
84
+ return [
85
+ '# Diff Coverage',
86
+ `## Diff: ${dict.diffName}`,
87
+ '',
88
+ noData
89
+ ? 'No lines with coverage information in this diff.'
90
+ : fileLines.join('\n'),
91
+ '',
92
+ ...(noData ? [] : [
93
+ '## Summary',
94
+ '',
95
+ `- **Total**: ${dict.totalNumLines} ${lineWord(dict.totalNumLines)}`,
96
+ `- **Missing**: ${dict.totalNumViolations} ${lineWord(dict.totalNumViolations)}`,
97
+ `- **Coverage**: ${dict.totalPercentCovered}%`,
98
+ ]),
99
+ ].join('\n');
100
+ }
101
+ // ─── HTML Report (mirrors HtmlReportGenerator) ────────────────────────────────
102
+ /**
103
+ * @param failUnder - the --fail-under threshold, used to colour the summary green/red.
104
+ * Defaults to 0 (always green) when not provided.
105
+ */
106
+ function generateHtmlReport(result, diffName, failUnder = 0) {
107
+ const dict = buildReportDict(result, diffName);
108
+ const entries = Object.entries(dict.srcStats).sort(([a], [b]) => a.localeCompare(b));
109
+ const noData = entries.length === 0;
110
+ const lineWord = (n) => n === 1 ? 'line' : 'lines';
111
+ const tableRows = entries.map(([srcPath, stats]) => {
112
+ let pct;
113
+ let pctColor;
114
+ if (stats.missingFromLcov) {
115
+ pct = '0% (not collected)';
116
+ pctColor = '#c0392b';
117
+ }
118
+ else if (stats.percentCovered === null) {
119
+ pct = 'N/A';
120
+ pctColor = '#888';
121
+ }
122
+ else {
123
+ pct = `${stats.percentCovered}%`;
124
+ pctColor = stats.percentCovered === 100 ? '#27ae60' : '#c0392b';
125
+ }
126
+ const missing = stats.violationLines.length > 0
127
+ ? `<span style="color:#c0392b">${combineAdjacentLines(stats.violationLines).join(', ')}</span>`
128
+ : '&nbsp;';
129
+ return `
130
+ <tr>
131
+ <td style="padding:6px 12px;font-family:monospace">${escapeHtml(srcPath)}</td>
132
+ <td style="padding:6px 12px;color:${pctColor};font-weight:bold;text-align:center">${pct}</td>
133
+ <td style="padding:6px 12px;font-family:monospace;font-size:0.9em">${missing}</td>
134
+ </tr>`;
135
+ }).join('');
136
+ // Use --fail-under threshold for summary colour, not a hardcoded 80%
137
+ const summaryColor = dict.totalPercentCovered >= failUnder ? '#27ae60' : '#c0392b';
138
+ const summary = noData
139
+ ? '<p style="color:#666">No lines with coverage information in this diff.</p>'
140
+ : `
141
+ <ul>
142
+ <li><b>Total</b>: ${dict.totalNumLines} ${lineWord(dict.totalNumLines)}</li>
143
+ <li><b>Missing</b>: ${dict.totalNumViolations} ${lineWord(dict.totalNumViolations)}</li>
144
+ <li><b>Coverage</b>: <span style="font-weight:bold;color:${summaryColor}">${dict.totalPercentCovered}%</span></li>
145
+ </ul>`;
146
+ const table = noData ? '' : `
147
+ <table style="border-collapse:collapse;width:100%;margin-top:16px">
148
+ <thead>
149
+ <tr style="background:#f5f5f5">
150
+ <th style="padding:8px 12px;text-align:left;border-bottom:2px solid #ddd">Source File</th>
151
+ <th style="padding:8px 12px;text-align:center;border-bottom:2px solid #ddd">Diff Coverage (%)</th>
152
+ <th style="padding:8px 12px;text-align:left;border-bottom:2px solid #ddd">Missing Lines</th>
153
+ </tr>
154
+ </thead>
155
+ <tbody>${tableRows}
156
+ </tbody>
157
+ </table>`;
158
+ return `<!DOCTYPE html>
159
+ <html lang="en">
160
+ <head>
161
+ <meta charset="utf-8">
162
+ <title>Diff Coverage</title>
163
+ <style>
164
+ body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; max-width: 960px; margin: 40px auto; padding: 0 20px; color: #333; }
165
+ h1 { border-bottom: 2px solid #eee; padding-bottom: 8px; }
166
+ table { border: 1px solid #ddd; }
167
+ tr:nth-child(even) { background: #fafafa; }
168
+ tr:hover { background: #f0f4ff; }
169
+ </style>
170
+ </head>
171
+ <body>
172
+ <h1>Diff Coverage</h1>
173
+ <p style="color:#666">Diff: <code>${escapeHtml(dict.diffName)}</code></p>
174
+ ${summary}
175
+ ${table}
176
+ </body>
177
+ </html>`;
178
+ }
179
+ function escapeHtml(str) {
180
+ return str
181
+ .replace(/&/g, '&amp;')
182
+ .replace(/</g, '&lt;')
183
+ .replace(/>/g, '&gt;')
184
+ .replace(/"/g, '&quot;')
185
+ .replace(/'/g, '&#39;');
186
+ }
187
+ // ─── File writer ──────────────────────────────────────────────────────────────
188
+ const KNOWN_FORMATS = new Set(['html', 'json', 'markdown']);
189
+ const DEFAULT_PATHS = {
190
+ html: 'diff-cover.html',
191
+ json: 'diff-cover.json',
192
+ markdown: 'diff-cover.md',
193
+ };
194
+ /**
195
+ * Parse --format string the same way diff-cover does:
196
+ * "html:path/to/report.html,json:path/to/report.json"
197
+ * → { html: "path/to/report.html", json: "path/to/report.json" }
198
+ *
199
+ * Format name alone (no colon) uses the default path for that format.
200
+ * Unknown format names produce a warning.
201
+ */
202
+ function parseFormatOption(raw) {
203
+ var _a;
204
+ const formats = {};
205
+ if (!raw)
206
+ return formats;
207
+ for (const item of raw.split(',')) {
208
+ const trimmed = item.trim();
209
+ if (!trimmed)
210
+ continue;
211
+ const colonIdx = trimmed.indexOf(':');
212
+ const name = colonIdx === -1 ? trimmed : trimmed.slice(0, colonIdx).trim();
213
+ const outPath = colonIdx === -1
214
+ ? ((_a = DEFAULT_PATHS[name]) !== null && _a !== void 0 ? _a : `diff-cover.${name}`)
215
+ : trimmed.slice(colonIdx + 1).trim();
216
+ if (!KNOWN_FORMATS.has(name)) {
217
+ console.warn(`⚠ Unknown --format name "${name}". Known formats: html, json, markdown`);
218
+ }
219
+ formats[name] = outPath;
220
+ }
221
+ return formats;
222
+ }
223
+ function writeReport(outPath, content, label) {
224
+ try {
225
+ fs_1.default.mkdirSync(path_1.default.dirname(path_1.default.resolve(outPath)), { recursive: true });
226
+ fs_1.default.writeFileSync(outPath, content, 'utf8');
227
+ console.log(` ${label} report written to: ${outPath}`);
228
+ }
229
+ catch (err) {
230
+ console.error(`❌ Could not write ${label} report to ${outPath}: ${err instanceof Error ? err.message : String(err)}`);
231
+ process.exit(1);
232
+ }
233
+ }
234
+ function writeFormats(formats, result, diffName, failUnder = 0) {
235
+ if (formats.json) {
236
+ writeReport(formats.json, generateJsonReport(result, diffName), 'JSON');
237
+ }
238
+ if (formats.markdown) {
239
+ writeReport(formats.markdown, generateMarkdownReport(result, diffName), 'Markdown');
240
+ }
241
+ if (formats.html) {
242
+ writeReport(formats.html, generateHtmlReport(result, diffName, failUnder), 'HTML');
243
+ }
244
+ }
245
+ //# sourceMappingURL=report-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-generator.js","sourceRoot":"","sources":["../src/report-generator.ts"],"names":[],"mappings":";;;;;AA8BA,oDAkBC;AAED,0CAyBC;AAID,gDAEC;AAID,wDAkCC;AAQD,gDAkFC;AA6BD,8CAqBC;AAaD,oCAeC;AA/RD,4CAAoB;AACpB,gDAA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 import { DiffCoverageResult } from './calculator';
2
+ export declare function printReport(result: DiffCoverageResult): void;
3
+ //# sourceMappingURL=reporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,wBAAgB,WAAW,CAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAqD7D"}