Open cossack910 opened 1 year ago
docker exec -it reactjest npm i -D msw
古いバージョンで出たエラー
FAIL src/MockServer.test.tsx
● Test suite failed to run
Cannot find module 'headers-polyfill/lib' from 'node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/NodeClientRequest.js'
Require stack:
node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/NodeClientRequest.js
node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/http.get.js
node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/index.js
node_modules/msw/node/lib/index.js
src/MockServer.test.tsx
3 |
4 | import { rest } from "msw";
> 5 | import { setupServer } from "msw/node";
| ^
6 | import MockServer from "./MockServer";
7 |
8 | const server = setupServer(
at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
at Object.<anonymous> (node_modules/@mswjs/interceptors/src/interceptors/ClientRequest/NodeClientRequest.ts:5:1)
at Object.<anonymous> (node_modules/@mswjs/interceptors/src/interceptors/ClientRequest/http.get.ts:3:1)
at Object.<anonymous> (node_modules/@mswjs/interceptors/src/interceptors/ClientRequest/index.ts:5:1)
at Object.<anonymous> (node_modules/msw/node/lib/index.js:5:21)
at Object.<anonymous> (src/MockServer.test.tsx:5:1)
公式
https://mswjs.io/
install
※若干バージョン古い