āœ… test(pariksha): cli.test.ts counts cli.ts's coverage, and its lychee stand-in reads its input

Merged
AT
10d ago
+12-13

Slice: #269
State: #302

Fixes main, red since #297 merged (5562165): CI run 44614782116, job "Typecheck, test, build", where the lychee test below was the one failing test. Both causes were in packages/pariksha/src/cli.test.ts, and only that file changes.

  1. cli.ts coverage read 36.58% of lines. The test that an import leaves the importer's exit code alone imported a second instance of cli.ts (cli.ts?import=…) into the suite's own process. Node's coverage report took that instance, which ran only the module's top level, for the file.
    • The test now runs in a child process, as the script test beside it does.
    • With the fix, pnpm --filter @veda-hq/pariksha check reads cli.ts at 100% lines, branches and functions, and all files at 99.97%. Before it, the same suite read cli.ts at 36.58% lines and 6.25% functions.
    • Stryker still kills the three mutants on those lines (--mutate src/cli.ts:1284-1285: Killed 3). The child gets the active mutant through its environment.
  2. "runs lychee from PATH when it is given no runner" failed with EPIPE. The stand-in lychee exited without reading the list pariksha writes to its stdin, so the write could hit a closed pipe.
    • It now reads its input first (cat > /dev/null), as the stand-in in cli.doc-references.test.ts does. It cannot exit until pariksha has written the list and closed the pipe.
    • The EPIPE did not reproduce on macOS, under load or under Stryker, so the fix rests on that ordering, not on a reproduction.

pnpm --filter @veda-hq/pariksha check is green.

Guard: the file's test count is unchanged (one it moves into a child process), so Guard can count it from the diff. If it cannot, #269's Guards: section now names the file, and this pull request waits for Alok's Decision: comment on #269.

šŸ¤– Generated with Claude Code