Skip to content

fix/902 - enhancement in CLI: --bail flag not stopping execution when a test fails - #8103

Merged
bijin-bruno merged 7 commits into
usebruno:mainfrom
sharan-bruno:fix/bail_flag_not_stopping-execution_when_a_test_fails_in_a_CSV_file
May 28, 2026
Merged

bijin-bruno merged 7 commits into
usebruno:mainfrom
sharan-bruno:fix/bail_flag_not_stopping-execution_when_a_test_fails_in_a_CSV_file

Conversation

@sharan-bruno

@sharan-bruno sharan-bruno commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

CLI run command now prints a cli-table3 execution summary table and handles --bail cleanly:

New 📊 Execution Summary table with Status / Requests / Tests / Assertions / Duration columns.
Requests cell breaks down counts inline, e.g. 4 (1 Passed, 1 Failed, 2 Skipped (Bail)).
On --bail, the run synthesizes skipReason: 'bail' placeholder results for remaining requests so they're counted as skipped, and prints an inline orange notice:
Bail: Stopping run, test failure in "2nd API". Remaining 2 request(s) skipped.

Before:
image

After
image

Adds cli-table3 dependency to print the table similar to golden edition.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • New Features

    • Execution summary now displays as a formatted table with passed, failed, skipped, and duration metrics.
    • Added a distinct "Skipped (Bail)" count to show items skipped due to bail and a clear bail reason in run output.
  • Chores

    • Added a runtime dependency to support table formatting in CLI output.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Displays a table-based execution summary, adds an ORANGE color constant and the cli-table3 dependency, and synthesizes skipped results when --bail triggers so the summary shows "Skipped (Bail)" counts.

Changes

Execution Summary with Bail Reporting

Layer / File(s) Summary
Color constant and table dependency
packages/bruno-cli/src/constants.js, packages/bruno-cli/package.json
Adds COLORS with ORANGE: '#FFA500' and adds cli-table3 (^0.6.5) as a runtime dependency.
Summary table formatting helpers
packages/bruno-cli/src/commands/run.js
Imports Table from cli-table3, replaces the text summary with table-based printRunSummary and helpers that compute requests/pass/fail/skipped counts and return the runner summary augmented with skippedByBail.
Bail handling and result synthesis
packages/bruno-cli/src/commands/run.js
Initializes bailInfo, extends --bail logic to determine a bailReason, synthesize placeholder skipped results for remaining requests marked with skipReason: 'bail', populate bailInfo (bailedAt, skippedByBail), and print an orange bail message before stopping the run.
Runner summary and types
packages/bruno-common/src/runner/runner-summary.ts, packages/bruno-common/src/runner/types/index.ts
Adds skippedByBail counter to getRunnerSummary return shape and increments it for results with skipReason === 'bail'; extends T_RunnerRequestExecutionResult with skipReason?: string and T_RunSummary with skippedByBail: number.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • usebruno/bruno#6780: Both PRs modify packages/bruno-cli/src/commands/run.js to incorporate skipped results in the run flow and summary output.

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • sid-bruno

Poem

🍊 When bail rings out, the runner stalls,
A table tallies passes, fails, and falls.
Skipped rows sprout where work was stalled,
Orange flags flash where bail was called.
The summary sings of runs recalled.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: implementing the --bail flag to stop execution when a test fails, which aligns with the primary changes in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bruno-cli/package.json`:
- Line 62: The repo's lockfile is out of sync after adding "cli-table3" to
packages/bruno-cli/package.json; run npm install from the repository root to
regenerate package-lock.json (ensuring the new dependency is resolved into the
lock), verify the updated package-lock.json includes the "cli-table3" entry, and
commit and push the updated lockfile so CI can pass.

In `@packages/bruno-cli/src/commands/run.js`:
- Around line 729-744: The bail placeholder objects pushed in the remainingItems
loop are missing required fields (test, request, iterationIndex) causing
reporters like JUnit to crash; update the object created in that loop inside
run.js so it matches the skipped shape used by createSkippedFileResults: include
iterationIndex (e.g., 0 or same default used elsewhere), a request object with
the same empty/default structure as createSkippedFileResults, and a test object
containing filename set from ri.pathname (or ri.name as appropriate) so
reporters can safely access result.test.filename and result.request.url.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8fa99dcf-5ac2-41ff-8fa4-0c30d22dbb50

📥 Commits

Reviewing files that changed from the base of the PR and between 809f951 and 90dc2c4.

📒 Files selected for processing (3)
  • packages/bruno-cli/package.json
  • packages/bruno-cli/src/commands/run.js
  • packages/bruno-cli/src/constants.js

Comment thread packages/bruno-cli/package.json Resolved
Comment thread packages/bruno-cli/src/commands/run.js Resolved
Comment thread packages/bruno-cli/src/commands/run.js Resolved

@bijin-bruno bijin-bruno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please update package-lock file

Comment thread packages/bruno-cli/src/constants.js Resolved

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/bruno-cli/src/commands/run.js (1)

693-699: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Double hrtime call introduces timing drift.

process.hrtime(start) is invoked twice, returning slightly different values each time. Store the result once for accurate duration.

Proposed fix
+      const elapsed = process.hrtime(start);
       results.push({
         ...result,
-        runDuration: process.hrtime(start)[0] + process.hrtime(start)[1] / 1e9,
+        runDuration: elapsed[0] + elapsed[1] / 1e9,
         suitename: pathname.replace('.bru', ''),
         name,
         path: result.test?.filename || path.relative(collectionPath, pathname)
       });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-cli/src/commands/run.js` around lines 693 - 699, The
runDuration calculation in the results.push block calls process.hrtime(start)
twice (in runDuration: process.hrtime(start)[0] + process.hrtime(start)[1] /
1e9) which can cause small timing drift; capture the hrtime result once into a
local variable (e.g., hr = process.hrtime(start)) and compute runDuration from
hr[0] and hr[1] before pushing the object in results.push so runDuration uses
the single consistent measurement; update the block that constructs the pushed
object (referencing results.push, runDuration, and start) to use that stored hr
value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/bruno-cli/src/commands/run.js`:
- Around line 693-699: The runDuration calculation in the results.push block
calls process.hrtime(start) twice (in runDuration: process.hrtime(start)[0] +
process.hrtime(start)[1] / 1e9) which can cause small timing drift; capture the
hrtime result once into a local variable (e.g., hr = process.hrtime(start)) and
compute runDuration from hr[0] and hr[1] before pushing the object in
results.push so runDuration uses the single consistent measurement; update the
block that constructs the pushed object (referencing results.push, runDuration,
and start) to use that stored hr value.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: af89a3d3-a9c1-4956-9d8a-49c31798d0b6

📥 Commits

Reviewing files that changed from the base of the PR and between a44db21 and f101266.

📒 Files selected for processing (2)
  • packages/bruno-cli/src/commands/run.js
  • packages/bruno-cli/src/constants.js

@sharan-bruno

Copy link
Copy Markdown
Contributor Author

Please update package-lock file

done, updated

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
packages/bruno-cli/src/commands/run.js (1)

761-766: 💤 Low value

bailInfo is assigned but never used.

This variable is populated with bail metadata but isn't read, returned, or passed anywhere afterward. Consider removing it or utilizing it if intended for future features.

♻️ Proposed removal if not needed
-          bailInfo = {
-            bailed: true,
-            bailReason,
-            bailedAt: name,
-            skippedByBail: remainingItems.length
-          };

Also remove the declaration at line 662: let bailInfo = null;

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-cli/src/commands/run.js` around lines 761 - 766, The variable
bailInfo is being assigned but never used; either remove the unused declaration
and assignment or wire it into the function's output/callback so the metadata is
consumed. Locate the bailInfo declaration (let bailInfo = null) and the later
assignment where bailInfo = { bailed: true, bailReason, bailedAt: name,
skippedByBail: remainingItems.length } and either delete both lines (and any
dead-code dependent on it) or modify the surrounding function to return or emit
this bailInfo (e.g., include it in the resolved object or pass it to the
existing result/emit path) so the metadata is actually consumed. Ensure no other
references to bailInfo remain after removal.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/bruno-cli/src/commands/run.js`:
- Around line 761-766: The variable bailInfo is being assigned but never used;
either remove the unused declaration and assignment or wire it into the
function's output/callback so the metadata is consumed. Locate the bailInfo
declaration (let bailInfo = null) and the later assignment where bailInfo = {
bailed: true, bailReason, bailedAt: name, skippedByBail: remainingItems.length }
and either delete both lines (and any dead-code dependent on it) or modify the
surrounding function to return or emit this bailInfo (e.g., include it in the
resolved object or pass it to the existing result/emit path) so the metadata is
actually consumed. Ensure no other references to bailInfo remain after removal.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2256a15f-2dd7-44b4-ad09-332fd68a892f

📥 Commits

Reviewing files that changed from the base of the PR and between f101266 and a84c065.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • packages/bruno-cli/src/commands/run.js

Comment thread packages/bruno-cli/src/commands/run.js Resolved
Comment thread packages/bruno-cli/src/commands/run.js Resolved
@bijin-bruno
bijin-bruno merged commit 49088e9 into usebruno:main May 28, 2026
17 of 19 checks passed
abhishekp-bruno pushed a commit to abhishekp-bruno/bruno that referenced this pull request May 29, 2026
…o#8103)

* fix/902 --bail flag not stopping execution when a test fails in a CSV file

* addressed review comments

* addressed review comments

* updated the package-lock file

* addressed review comments

* addressed review comments

* fix: add stripExtension utility to suitename assignment in run command
@sharan-bruno sharan-bruno changed the title fix/902 --bail flag not stopping execution when a test fails fix/902 - enhancement in CLI: --bail flag not stopping execution when a test fails Jun 1, 2026
sharan-bruno added a commit to sharan-bruno/bruno that referenced this pull request Jun 4, 2026
…o#8103)

* fix/902 --bail flag not stopping execution when a test fails in a CSV file

* addressed review comments

* addressed review comments

* updated the package-lock file

* addressed review comments

* addressed review comments

* fix: add stripExtension utility to suitename assignment in run command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants