Skip to content

fix(mock): expose aborted on the mock dispatch controller - #5964

Open
santiago-su wants to merge 1 commit into
nodejs:mainfrom
santiago-su:fix/mock-agent-redirect-aborted
Open

santiago-su wants to merge 1 commit into
nodejs:mainfrom
santiago-su:fix/mock-agent-redirect-aborted

Conversation

@santiago-su

Copy link
Copy Markdown

This relates to #5963

Rationale

Since #5850, onResponseError in lib/web/fetch/index.js checks controller.aborted before terminating the fetch. The controller built by dispatchMockReply had no aborted property, so redirects followed through MockAgent failed with Request was cancelled..

Changes

Bug Fixes

  • Add an aborted getter to the mock dispatch controller in lib/mock/mock-utils.js.
  • Add a regression test in test/mock-agent.js (MockAgent - fetch follows a redirect).

Features

N/A

Breaking Changes and Deprecations

N/A

Status

  • I have read and agreed to the Developer's Certificate of Origin
  • Tested
  • Benchmarked (optional)
  • Documented
  • Review ready

@santiago-su
santiago-su force-pushed the fix/mock-agent-redirect-aborted branch from 4c59904 to a54f1b2 Compare October 5, 2026 12:23
@santiago-su

Copy link
Copy Markdown
Author

force pushed because I didn't have my GPG keys setup in this machine 😀

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.13%. Comparing base (eedbe2d) to head (a54f1b2).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5964      +/-   ##
==========================================
+ Coverage   86.11%   86.13%   +0.01%     
==========================================
  Files         115      115              
  Lines       45723    45730       +7     
==========================================
+ Hits        39376    39389      +13     
+ Misses       6347     6341       -6     

☔ 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.

This branch has not been deployed

No deployments
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.

3 participants