Skip to content

fix: prevent bun test exit code 1 when all tests pass#67

Merged
sroussey merged 3 commits intofeat/cli-v2from
copilot/sub-pr-65-again
Mar 6, 2026
Merged

fix: prevent bun test exit code 1 when all tests pass#67
sroussey merged 3 commits intofeat/cli-v2from
copilot/sub-pr-65-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 6, 2026

bun test reported exit code 1 on every run despite 434 pass, 0 fail. The CI failure was a false negative with no actionable test output.

Root cause

runCommand.test.ts directly asserts on process.exitCode (set to 1 in error-case tests). The afterEach cleanup used process.exitCode = undefined, which Bun's test worker does not reliably treat as a reset to 0. The worker exited with code 1, propagating to the bun test process exit code.

Fix

// before
afterEach(() => {
  process.exitCode = undefined;  // not reliably reset in Bun workers
});

// after
afterEach(() => {
  process.exitCode = 0;
});

afterAll(() => {
  process.exitCode = 0;  // safety net for the worker's final exit
});

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…exit code 1

Co-authored-by: sroussey <127349+sroussey@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor CLI with nested commands and improved output fix: prevent bun test exit code 1 when all tests pass Mar 6, 2026
@sroussey sroussey marked this pull request as ready for review March 6, 2026 21:21
@sroussey sroussey merged commit 43e8221 into feat/cli-v2 Mar 6, 2026
1 check passed
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.

2 participants