test(cli): comprehensive behavior + contract test suite (79 cases)#401
Merged
Conversation
- Add cli/tests/helpers.ts with subprocess runner, golden file comparator, JSON shape validator, and makeTempRepo() fixture with valid KG structure - Add cli/tests/behavior/exit_code_test.ts (31 cases): exit 0/1 for all top-level flags, unknown commands, kg/pack/auth subcommands, in-repo ops - Add cli/tests/behavior/error_test.ts (13 cases): error messages, --help hints, not-implemented stubs, invalid NDJSON, out-of-repo commands - Add cli/tests/behavior/parse_test.ts (21 cases): flag parsing for stats (--json), validate (--format json, --quiet, --no-rules), doctor (--json), log (-n, --json), diff (--json, --name-only), pack stubs - Add cli/tests/contract/help_test.ts (17 cases): golden file comparisons for --help at top-level, kg, pack, auth groups; content assertions - Add cli/tests/contract/output_test.ts (8 cases): version semver check, kg stats --json shape, kg validate --format json shape, kg doctor --json - Add golden files: help_toplevel.txt, help_kg.txt, help_pack.txt, help_auth.txt - Add deno.json tasks: test:behavior and test:contract Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
Author
Self-review (lambda:khive)Verdict: APPROVE Checked
Suggestions (non-blocking)
Recommend merge once Ocean approves the slice batch. |
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.
Summary
Slice 2/9 from PR #399 (v022-polish show).
CLI test surface went from 0 → 79 black-box subprocess tests with golden file comparisons. All Deno/TypeScript — no Rust changes.
What's added
cli/tests/helpers.ts— subprocess runner, golden comparator, JSON shape validator,makeTempRepo()fixturecli/tests/behavior/exit_code_test.ts(31 cases) — exit 0/1 for all flags, unknown commands, kg/pack/auth subcommandscli/tests/behavior/error_test.ts(13 cases) — error messages, --help hints, invalid NDJSON, out-of-repocli/tests/behavior/parse_test.ts(21 cases) — flag parsing for stats/validate/doctor/log/diffcli/tests/contract/help_test.ts(17 cases) — golden file comparisons for --helpcli/tests/contract/output_test.ts(8 cases) — version semver, kg stats/validate/doctor JSON shapedeno.jsontasks:test:behaviorandtest:contractDependencies
None. TypeScript-only. Mergeable independently.
Test plan
deno task test:behaviorpassesdeno task test:contractpasses