Skip to content

fix(cli): return non-zero exit code on uncaught runtime exceptions - #5465

Open
mmustafasenoglu wants to merge 3 commits into
boa-dev:mainfrom
mmustafasenoglu:fix/issue-4962-exitcode-upstream
Open

fix(cli): return non-zero exit code on uncaught runtime exceptions#5465
mmustafasenoglu wants to merge 3 commits into
boa-dev:mainfrom
mmustafasenoglu:fix/issue-4962-exitcode-upstream

Conversation

@mmustafasenoglu

Copy link
Copy Markdown
Contributor

Summary

Fixes the CLI exiting with code 0 when an uncaught runtime exception occurs. Syntax errors already returned non-zero; this extends the same behavior to runtime errors.

Changes

  • ****: Added after printing uncaught errors in (3 paths: job errors, evaluation errors, parsing errors) and (1 path).
  • ****: New integration tests verifying non-zero exit codes for stdin, -e expression, and file execution uncaught errors.

Before/After

127
127

Fixes #4962
Closes #4964 (supersedes stalled PR)

Previously, uncaught runtime exceptions (e.g. ReferenceError,
throw statements) were printed to stderr but the process still
exited with code 0. Syntax errors already returned non-zero.

Add error propagation via eyre::Result in evaluate_expr and
evaluate_file so that any uncaught error causes the CLI to
exit with a non-zero status code.

Also adds integration tests verifying non-zero exit codes for
stdin, -e expression, and file execution uncaught errors.

Fixes boa-dev#4962

Signed-off-by: Mustafa Senoglu <mmustafasenoglu0@gmail.com>
@mmustafasenoglu
mmustafasenoglu requested a review from a team as a code owner July 29, 2026 10:48
@github-actions github-actions Bot added the Waiting On Review Waiting on reviews from the maintainers label Jul 29, 2026
@github-actions github-actions Bot added this to the v1.0.0 milestone Jul 29, 2026
@github-actions github-actions Bot added C-CLI Issues and PRs related to the Boa command line interface. C-Tests Issues and PRs related to the tests. labels Jul 29, 2026
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

Test262 conformance changes

Test result main count PR count difference
Total 53,125 53,125 0
Passed 51,073 51,073 0
Ignored 1,482 1,482 0
Failed 570 570 0
Panics 0 0 0
Conformance 96.14% 96.14% 0.00%

Tested main commit: 4fc75c6ae9d85f2b8065c6716f88e9b35318438c
Tested PR commit: 77ce9a1014e0b9d28ae455792067c938975bdcaa
Compare commits: 4fc75c6...77ce9a1

…rop lint

The MSRV and Lint CI jobs fail because `let _ = fs::remove_file(...)`
triggers the `let-underscore-drop` lint (implied by `-D warnings`).
Replace with an explicit `drop()` call which is the idiomatic way to
signal intentional discard of a Drop type.

Fixes CI for boa-dev#5465

Signed-off-by: Mustafa Senoglu <mmustafasenoglu0@gmail.com>
The test binary only uses std but Cargo.toml exposes all cli
dependencies, causing unused_extern_crates warnings under -D warnings.

Signed-off-by: Mustafa Senoglu <mmustafasenoglu0@gmail.com>
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.87%. Comparing base (6ddc2b4) to head (77ce9a1).
⚠️ Report is 1012 commits behind head on main.

Files with missing lines Patch % Lines
cli/src/main.rs 0.00% 10 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5465       +/-   ##
===========================================
+ Coverage   47.24%   62.87%   +15.63%     
===========================================
  Files         476      530       +54     
  Lines       46892    59109    +12217     
===========================================
+ Hits        22154    37165    +15011     
+ Misses      24738    21944     -2794     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-CLI Issues and PRs related to the Boa command line interface. C-Tests Issues and PRs related to the tests. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

boa_cli exit code 0 on uncaught runtime exceptions

1 participant