-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Context
Parent: #160
The binary crate has ~320 lines of CLI dispatch logic in main.rs with ~1% test coverage. Functions like run_trace(), run_diff(), run_packages(), build_snapshot_from_working_tree(), and build_snapshot_from_ref() have zero tests. Three of eleven v0.4.0 bugs lived here (#142, #148, #150).
Expected Behavior
End-to-end tests that invoke the chainsaw binary with real arguments and assert on stdout, stderr, and exit codes.
Scope
- Add
assert_cmd(and optionallypredicates) as dev-dependencies - Create
tests/cli.rsintegration test file - Cover at minimum:
trace <entry>produces expected output formattrace --json <entry>produces valid JSON with expected field namestrace --chain <entry> <target>finds import chainstrace --cut <entry> <target>finds cut pointstrace --max-weight <n> <entry>returns error when exceededdiff <ref>with--entryproduces diff outputdiff --json <ref> --entry <entry>produces valid JSONpackages <entry>lists packagespackages --json <entry>produces valid JSON- Invalid flag combinations return non-zero exit code with helpful error message
- Missing entry file returns non-zero exit code
- Use a small fixture project (2-3 .ts files) committed under
tests/fixtures/
Reactions are currently unavailable