āœ… test(pariksha): doc-links.ts passes the mutation gate

Merged
AT
10d ago
+69-27

Slice: #316

#309 fixed how lycheeRunner reports a lychee that exits before reading its file list, and added the tests for it. Because it changed doc-links.ts, the gate now judges the whole file. This pull request makes the file pass: no mutant Survived or NoCoverage against doc-links.test.ts alone. What the link check reports does not change.

Counts

Stryker 10.1.1 with the tap runner, mutate: ["src/doc-links.ts"], tap.testFiles: ["src/doc-links.test.ts"], incremental mode off. Run locally on macOS at --concurrency 6, each run in about 1.5 minutes.

RunMutantsKilledSurvivedNoCoverage
main (0b59b43)272260120
This branch25125100

None of the 12 were in lycheeRunner. The count drops because code that no test could observe is gone (below).

How

Following docs/lessons/stryker.md, code that a mutant could not change observably is reshaped, not suppressed:

  • treeFor: git and tar run through one quietly() helper with stdio: 'pipe', and the catch reuses release instead of its own rmSync. The bad-ref test now asserts three things: the error is git's own (status 128), nothing is copied to process.stderr (execFileSync without stdio would copy it), and nothing is left in a stand-in TMPDIR. Before, assert.throws accepted any error, including rmSync's own.
  • Report parser: a missing error_map gets a destructuring default, so it goes through the normal path instead of returning early. A null one is still refused, and the out-of-shape table now names that case. A span line is checked by an isLineNumber guard, without the typeof test that only TypeScript needed, since Number.isSafeInteger already refuses every other type.
  • Exemptions: the marker reads the line through an optional chain, which the tests for a line past the end and a missing doc exercise. The target regex drops a $ that no ref could tell apart.
  • Ignore filter: askedFor names the paths the ignore rules are asked about: the target as a file and as a directory. It names none for an in-doc anchor or a target outside the repository, so the two null branches are gone. A test wraps snapshot.ignored and asserts exactly what is asked.

Checks

  • pnpm --filter @veda-hq/pariksha check: green. 3910 tests pass, and doc-links.ts is at 100% lines, branches and functions.
  • ESLint on both files: clean. eslint-suppressions.json is unchanged.
  • No version bump.

šŸ¤– Generated with Claude Code


Summary by cubic

Reworks doc-links.ts so no Stryker mutant survives or lacks coverage when judged against doc-links.test.ts alone. The link check's behavior is unchanged; code no test could observe is reshaped instead of suppressed.

  • git and tar in treeFor share a quietly() helper with piped stdio, and the catch reuses release(). The bad-ref test now asserts git's own error, nothing copied to the process's stderr, and nothing left in TMPDIR.
  • A missing error_map goes through the normal path via a destructuring default; a null one is still refused.
  • Exemptions read the line through an optional chain, and the target regex drops a $ no ref could tell apart.
  • askedFor names the paths the ignore rules are asked about; an in-doc anchor and a target outside the repository are skipped, with a comment explaining why, and a test asserts exactly what is asked.