Skip to content

test(cli): skip the node-dependent check when node is absent - #9

Merged
pluginslab merged 1 commit into
mainfrom
fix/cli-test-requires-node
Sep 21, 2026
Merged

pluginslab merged 1 commit into
mainfrom
fix/cli-test-requires-node

Conversation

@pluginslab

Copy link
Copy Markdown
Owner

Small, but it is the same bug we spent today removing from the hooks — reintroduced in a test written to guard against that very class.

tests/cli/test-substitutions.sh exercises the CLI's identity derivation by shelling out to node -e, with the error swallowed by 2>/dev/null. On a host without node it therefore did not skip — it failed, with a baffling:

✗ deriveIdentity → all four forms for acme-order-tracker: expected AcmeOrderTracker Acme_Order_Tracker ACME_ORDER_TRACKER acme_order_tracker, got ''

CI is green on main and did not catch it, because ubuntu-latest ships node. It only surfaced running the suite in debian:bookworm-slim after the merges.

Now guarded on node being present, and it says so when it skips. Dropping the 2>/dev/null means a genuine node failure surfaces as itself rather than masquerading as an empty string.

The rest of the file is plain bash and stays useful without node — which is the right split, since the CLI is a Node program and a host without node cannot run the scaffolder anyway.

Environment Result
macOS 145 passed
Linux, no node 144 passed, 1 correctly skipped

🤖 Generated with Claude Code

The deriveIdentity assertion shells out to `node -e` with the error
swallowed by 2>/dev/null, so on a host without node it did not skip --
it failed, with a baffling `got ''`.

CI never caught it because ubuntu-latest ships node. It only showed up
running the suite in debian:bookworm-slim.

That is precisely the "the test encodes the author's machine" trap that
hid the Linux mtime bug in the hooks, reintroduced in a test written to
guard against exactly that class of bug. It does not get a pass for being
ours.

Now guarded on node being installed, and says so when it skips. The
dropped 2>/dev/null means a real node failure surfaces instead of
masquerading as an empty string.

macOS 145 passed. Linux without node: 144 passed, 1 correctly skipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pluginslab
pluginslab merged commit 7b9b7cd into main Sep 21, 2026
1 check passed
@pluginslab
pluginslab deleted the fix/cli-test-requires-node branch September 21, 2026 16:46
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.

1 participant