Skip to content

test(cli): smoke-test the built CLI against a fixture scaffold - #178

Open
abhinav-phi wants to merge 2 commits into
mex-memory:mainfrom
abhinav-phi:test/cli-smoke
Open

test(cli): smoke-test the built CLI against a fixture scaffold#178
abhinav-phi wants to merge 2 commits into
mex-memory:mainfrom
abhinav-phi:test/cli-smoke

Conversation

@abhinav-phi

Copy link
Copy Markdown
Contributor

Resolves #57.

What

A smoke suite that spawns the built dist/cli.js in a temp project and asserts exit codes and output for the commands a user or agent reaches for first:

  • --version — strict equality against package.json's version
  • logtimelinetimeline --json — one event rendered end to end in both output modes
  • check and check --json — healthy fixture reports 100/100, JSON is parseable with the documented shape
  • heartbeat, doctor — run clean on the fixture
  • --help — lists the top-level commands

Fixture

Each test gets a fresh temp project with a minimal .mex/ scaffold: ROUTER.md plus an AGENTS.md tool anchor — the state mex setup leaves behind. The anchor matters: without it, check reports SCAFFOLD_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 --version test fail with expected '0.7.0' to be '0.8.0'. CI already runs npm run build before npm test, so the suite has the bundle it needs; the test also fails with an explicit message if dist/cli.js is missing.

No production code is touched — test + fixture only.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a CLI smoke test against a fixture scaffold

1 participant