NextJS 14 with **pages** routing and MSW 2.x #2007
FredLavoie
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to upgrade MSW to v2.1.2 in my NextJS project which only uses the pages routing (not app routing), and I have gotten the individual components to pass the test with API calls being mocked by MSW, but I can't get my pages which have 1-2 API calls each to run. I'm not making any API calls within
getServerSideProps
.I get the
ReferenceError: Response is not defined
. I understand that the migration guide proposes a solution for this, which includes settingtestEnvironmentOptions: { customExportConditions: [''] },
in thejest.config.ts
file. But now I'm getting this error:I can post some of my configs. But my question is, can MSW work with the pages components that make API calls?
Beta Was this translation helpful? Give feedback.
All reactions