coverage-check 0.8.0 → 0.8.1

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/README.md CHANGED
@@ -137,6 +137,16 @@ Two common sources of confusion:
137
137
  The annotation affects only the stdout failure output. The GitHub PR sticky comment and Actions step
138
138
  summary are unchanged.
139
139
 
140
+ ### Renamed and relocated files
141
+
142
+ `coverage-check` asks Git to detect renames with no rename-attempt limit before parsing patch lines.
143
+ Pure file moves do not create patch-coverage obligations: unchanged relocated lines are not treated
144
+ as newly added lines. If a moved file also changes content, Git still emits normal hunks for the
145
+ edited new-side lines, and those lines must satisfy the matching patch-coverage rule.
146
+
147
+ Large rewrites that fall below Git's rename similarity threshold may still appear as delete/add
148
+ pairs. In that case the destination file's executable lines are checked as new patch lines.
149
+
140
150
  ### Merging LCOV files
141
151
 
142
152
  Use the `merge` subcommand to fold multiple `lcov.info` files into a single output that preserves function and branch records (`FN`, `FNDA`, `BRDA`) as well as summary counters (`LF/LH/FNF/FNH/BRF/BRH`):
@@ -14,6 +14,6 @@ export declare function decodeGitCString(s: string): string;
14
14
  */
15
15
  export declare function parseDiff(text: string): DiffLines;
16
16
  /** Runs git merge-base + git diff and returns the raw diff text. Internal shared helper. */
17
- export declare function runGitDiff(baseRef: string, headRef: string): Promise<string>;
17
+ export declare function runGitDiff(baseRef: string, headRef: string, cwd?: string): Promise<string>;
18
18
  /** Runs git diff and returns the parsed result. */
19
19
  export declare function getChangedLines(baseRef: string, headRef: string): Promise<DiffLines>;
@@ -113,14 +113,14 @@ export function parseDiff(text) {
113
113
  return result;
114
114
  }
115
115
  /** Runs git merge-base + git diff and returns the raw diff text. Internal shared helper. */
116
- export async function runGitDiff(baseRef, headRef) {
116
+ export async function runGitDiff(baseRef, headRef, cwd) {
117
117
  if (baseRef.startsWith("-") || headRef.startsWith("-")) {
118
118
  throw new Error("Git reference cannot start with a hyphen (prevents argument injection)");
119
119
  }
120
120
  const { spawn } = await import("node:child_process");
121
121
  const spawnProcess = (cmd, args) => new Promise((resolve, reject) => {
122
122
  const chunks = [];
123
- const proc = spawn(cmd, args, { stdio: ["ignore", "pipe", "inherit"] });
123
+ const proc = spawn(cmd, args, { stdio: ["ignore", "pipe", "inherit"], cwd });
124
124
  proc.stdout.on("data", (chunk) => chunks.push(chunk));
125
125
  proc.on("error", reject);
126
126
  proc.on("close", (code) => code === 0
@@ -132,6 +132,8 @@ export async function runGitDiff(baseRef, headRef) {
132
132
  // --src-prefix/--dst-prefix override diff.noprefix and diff.mnemonicPrefix git config
133
133
  return spawnProcess("git", [
134
134
  "diff",
135
+ "-M",
136
+ "-l0",
135
137
  "--unified=0",
136
138
  "--inter-hunk-context=0",
137
139
  "--no-color",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coverage-check",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Patch-coverage gate: checks that newly added lines meet per-path coverage thresholds. Supports per-suite LCOV accumulation for conditional CI.",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Ong",
@@ -38,10 +38,10 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/js-yaml": "^4.0.9",
41
- "@types/node": "^25.8.0",
41
+ "@types/node": "^26.0.1",
42
42
  "@vitest/coverage-v8": "^4.1.6",
43
43
  "husky": "^9.1.7",
44
- "oxfmt": "^0.53.0",
44
+ "oxfmt": "^0.56.0",
45
45
  "oxlint": "^1.65.0",
46
46
  "typescript": "^6.0.3",
47
47
  "vitest": "^4.1.6"