msw: segfault in jest with msw@2.0.7
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 18 or higher
Node.js version
v18.16.1
Reproduction repository
https://github.com/mswjs/examples/tree/main/examples/with-jest
Reproduction steps
cd examples/with-jest
nvm use 18.16.1
npm i msw@2.0.7
npm run test
Current behavior
The tests crash with a segfault.
with-jest % npm run test
test jest
RUNS ./example.test.ts zsh: segmentation fault npm run test
Expected behavior
I expect the tests to pass without segfault.
nvm use 18.16.1
npm i msw@2.0.6
npm run test
- works fine, so it definitely has something to do with the last release of msw.
This testcase in test repo also somehow does get fixed by upping the version of node, but the one in my project (which is more complicated, so i don’t really want to try and recreate it exactly) does not.
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Reactions: 9
- Comments: 25 (12 by maintainers)
Commits related to this issue
- Låser msw til 2.0.6 https://github.com/mswjs/msw/issues/1868 — committed to navikt/sosialhjelp-innsyn by almyy 7 months ago
Confirming that the fix works for us - thank you!
Works, it’s magic ❤️
Node: 18.18.0
I can confirm that 2.0.9 works with the following environment.
React Native: 0.72.3 Msw: 2.0.9 Node.JS: 21.2.0
Both Jest and the development environment work perfectly. Once again thank you!
Released: v2.0.9 🎉
This has been released in v2.0.9!
Make sure to always update to the latest version (
npm i msw@latest) to get the newest features and bug fixes.Predictable release automation by @ossjs/release.
Once again, @mattcosta7 is a pure magician 🪄
Hope you’ll have the error with this minimal reproduction : https://github.com/bengeois/msw-segfault-issue
I’m trying to make a reproduction project but the error seems to not appear systematically
segfault-handler produces a log like this:
So it’s likely to do with an async import of node:events (https://github.com/mswjs/msw/pull/1858)