Skip to content

test: assert command failures from the error runCommand returns - #3997

Merged
erika-wallace merged 1 commit into
mainfrom
ew/assert-runcommand-errors
Oct 15, 2026
Merged

erika-wallace merged 1 commit into
mainfrom
ew/assert-runcommand-errors

Conversation

@erika-wallace

Copy link
Copy Markdown
Contributor

Summary

This PR ensures unit tests actually check command failures.

runCommand never rejects. When a command throws, it resolves with {error, stderr, stdout}. Tests that wrapped runCommand in .catch() or try/catch never entered that catch, so the expect calls inside it never ran and the tests still passed. Those tests now read error off the resolved result, so a missing or unexpected error fails the test.

A few expected messages were also wrong and only showed up once the assertions ran: the accounts alias and current-account copy, and apps:leave, whose delete mock returned success. That delete now returns an error.

Type of Change

Breaking Changes (major semver update)

  • Add a ! after your change type to denote a change that breaks current behavior

Feature Additions (minor semver update)

  • feat: Introduces a new feature to the codebase

Patch Updates (patch semver update)

  • fix: Bug fix
  • deps: Dependency upgrade
  • revert: Revert a previous commit
  • chore: Change that does not affect production code
  • refactor: Refactoring existing code without changing behavior
  • test: Add/update/remove tests

Testing

Notes:

Steps:

  1. Passing CI suffices

Screenshots (if applicable)

Related Issues

GUS work item: W-24510107

@erika-wallace
erika-wallace requested a review from a team as a code owner October 15, 2026 17:22
@erika-wallace
erika-wallace deployed to AcceptanceTests October 15, 2026 17:22 — with GitHub Actions Active
@erika-wallace
erika-wallace deployed to AcceptanceTests October 15, 2026 17:22 — with GitHub Actions Active
@erika-wallace
erika-wallace deployed to AcceptanceTests October 15, 2026 17:22 — with GitHub Actions Active
@erika-wallace
erika-wallace deployed to AcceptanceTests October 15, 2026 17:22 — with GitHub Actions Active
@github-actions github-actions Bot added the size/L Large PR (code churn < 1000) label Oct 15, 2026

@jdodson jdodson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this!

Approved!

@erika-wallace
erika-wallace merged commit afc97fa into main Oct 15, 2026
20 checks passed
@erika-wallace
erika-wallace deleted the ew/assert-runcommand-errors branch October 15, 2026 19:50
eablack added a commit that referenced this pull request Oct 23, 2026
The merge from main reverted PR #3997's hardening in six unit tests,
dropping back to the try/catch (and .catch(() => {})) form that passes
vacuously when the command does not throw. Reapply the pattern to v12's
SDK-based test structure: capture the error from the result
(const {error} = await runCommand(...) / runWithCliArgv(...)) and assert
on it directly instead of swallowing it.

Files: addons/create, addons/upgrade, run/index, run/inside,
spaces/index, telemetry/add.

This branch was successfully deployed

1 active deployment
AcceptanceTests — 26122951 Deployed Oct 15, 2026 by erika-wallace via acceptance (22.x, ubuntu-latest) #9480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR (code churn < 1000)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants