-
-
Notifications
You must be signed in to change notification settings - Fork 580
Open
Labels
bugSomething isn't workingSomething isn't workingneeds:triageIssues that have not been investigated yet.Issues that have not been investigated yet.scope:browserRelated to MSW running in a browserRelated to MSW running in a browser
Description
Prerequisites
- I confirm my issue is not in the opened issues
- I confirm the Frequently Asked Questions didn't contain the answer to my issue
Environment check
- I'm using the latest
mswversion - I'm using Node.js version 20 or higher
Browsers
Chromium (Chrome, Brave, etc.)
Reproduction repository
https://github.com/diego-aquino/msw-worker-stop-bypass-issue
Reproduction steps
pnpm installpnpm test
Current behavior
Starting in msw@2.11.2, I found out that workers sometimes handle requests even after worker.stop() is called.
In the reproduction repository, this expect sometimes passes, sometimes fails.
worker.stop();
// This expect sometimes passes, sometimes fails.
await expect(async () => {
await fetch(`${baseURL}/users`);
}).rejects.toThrowError(TypeError);I've recorded a video demonstrating the flakiness, in case it's difficult to reproduce:
recording-2025-09-27_16.50.19.mp4
From my tests, I did not see this issue happening with server.close(), neither with worker.stop() and server.close() before 2.11.2 (I tested 2.11.1).
Expected behavior
I expected all requests made after worker.stop() was called to not be handled.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds:triageIssues that have not been investigated yet.Issues that have not been investigated yet.scope:browserRelated to MSW running in a browserRelated to MSW running in a browser