mswjs / msw

Industry standard API mocking for JavaScript.
https://mswjs.io
MIT License
15.97k stars 519 forks source link

Callback not being executed in server.boundary with jest and react testing library #2366

Open kmmccafferty96 opened 1 day ago

kmmccafferty96 commented 1 day ago

Prerequisites

Environment check

Node.js version

v20.12.1

Reproduction repository

https://github.com/kmmccafferty96/msw-server-boundary-issue-reproduction

Reproduction steps

  1. Run npm install
  2. Run npm test

Note that both tests pass even though the second should not. Also to note, the first writes to the console but the second does not.

Current behavior

When using jest with react-testing-library, the callback supplied to server.boundary() is seemingly not executed and tests pass no matter what.

Expected behavior

The callback should be executed and tests should be ran properly.