Skip to content

test: avoid global dispatcher state in mock client tests#5258

Open
trivikr wants to merge 1 commit intonodejs:mainfrom
trivikr:test-mock-client
Open

test: avoid global dispatcher state in mock client tests#5258
trivikr wants to merge 1 commit intonodejs:mainfrom
trivikr:test-mock-client

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 7, 2026

This relates to...

Fixes: #5202

Rationale

Some test/mock-client.js cases replaced the global dispatcher even though they only needed a mock dispatcher for a single request. This left process-wide state mutated across tests and could contribute to flaky file-level failures.

Changes

  • Use dispatcher: mockClient in mock client tests that do not explicitly test global dispatcher behavior.
  • Restore the original global dispatcher in the one test that verifies setGlobalDispatcher().

Features

N/A

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.28%. Comparing base (01122da) to head (7985a85).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5258   +/-   ##
=======================================
  Coverage   93.27%   93.28%           
=======================================
  Files         110      110           
  Lines       36366    36366           
=======================================
+ Hits        33922    33924    +2     
+ Misses       2444     2442    -2     

☔ View full report in Codecov by Sentry.
📢 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flaky] test\mock-client.js

2 participants