Skip to content

test(cli): show the CLI's exit status and output in e2e failures - #412

Merged
gregberge merged 2 commits into
mainfrom
fix/cli-e2e-command-error-output
Nov 6, 2026
Merged

gregberge merged 2 commits into
mainfrom
fix/cli-e2e-command-error-output

Conversation

@gregberge

Copy link
Copy Markdown
Member

Why

e2e-core has failed on every PR since late October, always on the same 11 CLI tests that use USER_ACCESS_TOKEN. The failure summary only says Command failed: node bin/argos-cli.js …, because run() in packages/cli/e2e/utils.ts puts only the command line in the error message. The CLI's stderr only shows up in the GitHub annotation block at the very end of the log, which is easy to miss.

What

The CommandError message now contains:

  • the exit status, or the signal that killed the child
  • the spawn error, if any (for example ENOBUFS)
  • the CLI's stderr, trimmed to its last 4000 characters
  • the CLI's stdout when it isn't empty, trimmed to its last 1000 characters

status, stdout and stderr are still set on the error, so the tests that read them don't change. Nothing new reads environment values; the command line already contained --token (which GitHub masks).

Example:

CommandError: Command failed (exit status 1): node bin/argos-cli.js build get not-a-build --token ***
stderr:
  Error: Build reference must be a valid build number or Argos build URL (…), got "not-a-build".

Testing

  • Throwaway local tests: a real CLI failure, and a mocked spawn with a signal, a spawn error and long stdout.
  • tsc --noEmit, eslint and prettier --check pass.
  • The 11 failing e2e tests will still fail on this PR. This change only makes their cause visible in the summary.

🤖 Generated with Claude Code

`run()` threw a `CommandError` whose message was only the command line.
Vitest's failure summary prints the message, so CI showed
"Command failed: node bin/argos-cli.js …" with no hint of the API error;
the stderr only surfaced in the GitHub annotations at the very end of
the log.

The message now includes the exit status (or the signal), any spawn
error, the CLI's stderr and, when non-empty, its stdout. Each stream
keeps only its last characters, since the CLI prints its error last and
`--json` output can be large. `status`, `stdout` and `stderr` are still
set on the error for the tests that read them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
argos-js-sdk-reference Ready Ready Preview Nov 5, 2026 1:41pm UTC

Request Review

Build the message inline in `run()` with one `tail()` helper instead of
two formatters and a hand-written copy of the spawnSync result type.
Blank streams are left out rather than shown as "(empty)", and the tail
is no longer trimmed to a whole line: the omitted-characters marker
already says it is cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gregberge
gregberge merged commit 1f946a1 into main Nov 6, 2026
77 checks passed
@gregberge
gregberge deleted the fix/cli-e2e-command-error-output branch November 6, 2026 09:12
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