Repository navigation
test: hold src/ at 100% coverage in npm run check - #25
Merged
Merged
Conversation
The suite never measured coverage, and cli.ts — flags, output and every exit code the usage text promises — had no test at all, because it ran itself on import. cli.ts now exports main(argv, io) and src/bin.ts is the process boundary, so the CLI is tested in process, the checklist on a fake terminal. vitest.config.ts sets 100% statements, branches, functions and lines over src/, and npm run check runs it. Branches no input can reach are removed rather than excluded: fallbacks the types already rule out, an unused copyTarget, and a declined list that was remapped where it could only ever be empty. The --json shape is unchanged.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #24 (
fix/upstream-support-files); review that first. Retarget tomainonce it merges.Why
The suite never measured coverage, and
cli.ts(flags, human and--jsonoutput, every exit code the usage text promises) had no test at all, because it ran itself on import.Change
cli.tsexportsmain(argv, io).src/bin.tsis the process boundary: argv in, exit code out. The build entry moves to it, anddist/keeps its shebang and behaviour.vitest.config.tsholdssrc/at 100% statements, branches, functions and lines.npm run checknow runsnpm run coveragein place ofnpm test.@vitest/coverage-v8is a devDependency, andcoverage/is ignored.?? 'unknown',?? left,if (!tech) continue,?? 'not approved',cells[index] ?? '', a.catchon a directory known to exist);copyTarget;agentsMdcheck;declined, which was remapped under--json, where the checklist never runs. The--jsonshape is unchanged.AGENTS.mdrecords the gate and the remove-don't-exclude rule.Tests
tests/cli.test.tscatalog,resolve,generate,check; exit codes 0/2/3/64/65/130; the checklist on a fake terminaltests/cli-errors.test.tsError(exit 1)tests/catalog.test.tscatalog.yamlandupstream.yaml, duplicate ids, self-conflict, a content dir that is a file, symlinkstests/emit.test.tsAdditions to
prompt,resolver,tableandvalidator.fakeTtymoves totests/fake-tty.ts.Scope
scripts/*.mjsstays outside the gate: they are dev tools, andsyncneeds git and the network. Their pure helpers are tested.Verification
npm run check: 189 tests, 100% on all four metrics (877/877 statements, 455/455 branches). The bundled CLI was smoke-tested withgenerate,checkand a usage error.