test(cli): smoke-test the built CLI against a fixture scaffold - #178
test(cli): smoke-test the built CLI against a fixture scaffold#178abhinav-phi wants to merge 2 commits into
Conversation
Two version bugs shipped because CI exercised library code and the packed install, but never ran the real CLI against a scaffold inside the suite. The smoke test spawns dist/cli.js in a temp project with a minimal .mex scaffold (ROUTER.md plus an AGENTS.md tool anchor, as setup would leave it) and asserts exit codes and output for the commands a user or agent reaches for first: --version, log, timeline (human and --json), check (human and --json), heartbeat, doctor, and --help. --version is asserted as strict equality against package.json, so a version that drifts from the published version fails the suite — verified by injecting a hard-coded literal into the bundle and watching the test catch it. Resolves mex-memory#57
|
@theDakshJaitly @theyashasvipandey — status: everything on this PR is done and green. Rebased-clean against current For reviewers: the suite spawns the built |
Resolves #57.
What
A smoke suite that spawns the built
dist/cli.jsin a temp project and asserts exit codes and output for the commands a user or agent reaches for first:--version— strict equality againstpackage.json's versionlog→timeline→timeline --json— one event rendered end to end in both output modescheckandcheck --json— healthy fixture reports100/100, JSON is parseable with the documented shapeheartbeat,doctor— run clean on the fixture--help— lists the top-level commandsFixture
Each test gets a fresh temp project with a minimal
.mex/scaffold:ROUTER.mdplus anAGENTS.mdtool anchor — the statemex setupleaves behind. The anchor matters: without it,checkreportsSCAFFOLD_ORPHANED(exit 1), which is correct product behavior and exactly the kind of drift the smoke test should be able to express, not fight.Why this would have caught the shipped bugs
The two version regressions shipped because CI exercised library code and the packed install, but never ran the real CLI against a scaffold inside the suite. I verified the detection property directly: injecting a hard-coded
VERSION = "0.7.0"into the bundle (reproducing the original hard-coded-literal bug) makes the--versiontest fail withexpected '0.7.0' to be '0.8.0'. CI already runsnpm run buildbeforenpm test, so the suite has the bundle it needs; the test also fails with an explicit message ifdist/cli.jsis missing.No production code is touched — test + fixture only.