test(cli): smoke-test the built CLI against a fixture scaffold - #178
Open
abhinav-phi wants to merge 2 commits into
Open
test(cli): smoke-test the built CLI against a fixture scaffold#178abhinav-phi wants to merge 2 commits into
abhinav-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
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.
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.