server.listen() called after server.close() does not mock response #2370
Labels
bug
Something isn't working
needs:triage
Issues that have not been investigated yet.
scope:node
Related to MSW running in Node
Prerequisites
Environment check
msw
versionNode.js version
v2.6.6
Reproduction repository
vishakha94@b90344e
Reproduction steps
npm run test:node
Current behavior
We have a NextJS app that implements mocking using feature flag. When we switch the flag off for mocking, we call server.close() and if the feature flag is enabled again, serve.listen() is called.
I observed the following:
Our NextJS app setup is complicated, but I was able to reproduce the issue here: https://github.com/vishakha94/msw/tree/repro-server-close
I ran
npm run test:node
Expected behavior
Expect for MSW to resume mocking after server.listen() is called after sever.close().
The text was updated successfully, but these errors were encountered: