Repository navigation
Fix/runner results enhancement - #7040
Conversation
* Mark test script errors as failed in runner
and CLI
* Unify handling of post-response and pre-request script errors in both CLI and Electron
* feat: Enhance error handling in script execution by preserving partial results for pre-request and post-response scripts across CLI and Electron. This ensures that tests passing before an error are still reported.
* Preserving stopExecution in test script error handler
---------
Co-authored-by: Pragadesh-45 <[email protected]>
WalkthroughAdds try/catch around pre-request, post-response, and test script execution to preserve and propagate partial script results and control signals; introduces Changes
Sequence Diagram(s)sequenceDiagram
actor Runner
participant ScriptRuntime
participant Network as "Network / HTTP"
participant IPC as "IPC / Electron UI"
Runner->>ScriptRuntime: run pre-request script
alt pre-request throws OR returns skipRequest
ScriptRuntime-->>Runner: partialResults / skipRequest
Runner->>IPC: emit pre-request test results (include partialResults, isScriptError)
Runner-->>Runner: return skipped or error result (no HTTP sent)
else pre-request succeeds
ScriptRuntime-->>Runner: preRequestTestResults
Runner->>Network: perform HTTP request
Network-->>Runner: response
Runner->>ScriptRuntime: run post-response script
alt post-response throws
ScriptRuntime-->>Runner: partialResults
Runner->>IPC: emit post-response partial results (isScriptError)
Runner-->>Runner: return error result
else post-response succeeds
ScriptRuntime-->>Runner: postResponseTestResults
Runner->>ScriptRuntime: run test scripts
ScriptRuntime-->>Runner: testResults (may include partialResults/isScriptError)
Runner->>IPC: emit final results (tests, cookies, notifications)
Runner-->>Runner: return completed result
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@packages/bruno-common/src/runner/runner-summary.ts`:
- Around line 26-29: The pre-request aggregation is counting failures even for
entries with isScriptError, causing failedPreRequestTests to potentially exceed
totalPreRequestTests; update the pre-request aggregation logic that updates
failedPreRequestTests (and any failedPreRequestAssertions) to only increment
when the record has !isScriptError (use the same filter used for
totalPreRequestTests: preRequestTestResults?.filter(r => !r.isScriptError)), and
mirror that filter for preRequestAssertionResults when computing failed counts
so totals and failed counts remain consistent (refer to totalPreRequestTests,
failedPreRequestTests, preRequestTestResults, and preRequestAssertionResults).
In `@packages/bruno-electron/src/ipc/network/index.js`:
- Around line 446-476: The synthetic error result created in
appendScriptErrorResult should include isScriptError: true so aggregations that
filter by that flag can distinguish script errors from regular test failures;
update the object pushed into results in appendScriptErrorResult (the entry with
status: 'fail', description: descriptionMap[scriptType]..., error: ...) to also
set isScriptError: true, preserving all existing fields and behavior.
…ror flag in test results (usebruno#7029) * fix: Enhance error handling for script execution by introducing isScriptError flag in test results Enhance error reporting in script execution by adding isScriptError flag to error responses fix: Mark pre-request script errors as failures in runner summary
0459e4d to
798db04
Compare
* Mark test script errors as failed in runner (usebruno#6261) * Mark test script errors as failed in runner and CLI * Unify handling of post-response and pre-request script errors in both CLI and Electron * feat: Enhance error handling in script execution by preserving partial results for pre-request and post-response scripts across CLI and Electron. This ensures that tests passing before an error are still reported. * Preserving stopExecution in test script error handler --------- Co-authored-by: Pragadesh-45 <[email protected]> * Enhance error handling for script execution by introducing isScriptError flag in test results (usebruno#7029) * fix: Enhance error handling for script execution by introducing isScriptError flag in test results Enhance error reporting in script execution by adding isScriptError flag to error responses fix: Mark pre-request script errors as failures in runner summary --------- Co-authored-by: Karan Pradhan <[email protected]> Co-authored-by: Pragadesh-45 <[email protected]>
BRU-2249
This PR builds on and replaces #6261 ("Mark test script errors as failed in runner") with additional fixes and a clearer approach to script errors in the runner.
Fixes: #6258