Request.json() TypeError: Body is unusable when using jest.useFakeTimers in a test #2408
Open
4 tasks done
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
v20.15.1
Reproduction repository
https://github.com/strapi/strapi/tree/chore/upgrade-msw-v2
Reproduction steps
yarn; yarn run setup
yarn run test:front packages/core/content-manager/admin/src/pages/EditView/components/FormInputs/tests/UID.test.tsx
Please use branch
chore/upgrade-msw-v2
Relevant code is:
Current behavior
I believe it is caused by the use of fake timers in https://github.com/strapi/strapi/blob/6d949f07f378849292a01ba9718634eecda65231/packages/core/content-manager/admin/src/pages/EditView/components/FormInputs/tests/UID.test.tsx#L143-L144
Expected behavior
We want to be able to extract the body of the request for the conditional logic here
https://github.com/strapi/strapi/blob/6d949f07f378849292a01ba9718634eecda65231/packages/core/content-manager/admin/tests/server.ts#L301-L313
I have tried using the jest fake timers with the
doNotFake
option as suggested here https://mswjs.io/docs/runbook/#:~:text=Requests%20are%20not%20resolving,%7DAs you can see by the PR here the overall goal is to upgrade Strapi to use msw v2
The text was updated successfully, but these errors were encountered: