New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next v12 compatibility #294
Conversation
change to use import() instead of require here: https://github.com/next-page-tester/next-page-tester/blob/master/src/loadFile.ts#L18 Which means Line 151 in 4cea3f8
|
So instead we need to check if its a function. If it is it has a default export, if not its most likely empty or no default export has been set.
Help is needed to run these tests and try to fix the failing ones. I think using import can help prevent the require issues. If not we may have to just move to vitest completely. |
The remote branch was probably outdated, segfault errors seem to be gone 👍 and tests hang during execution. I noticed something which could be worth some consideration. I believe the async nature of the new import strategy could play not well with Jest's |
The hanging tests have (kinda) been fixed. The segfault happens on line 650 (the import branch) As a "quick fix" we could just do this and call it a day, but we would end up stuck with jest, plus Next.js may not support the
yes this has been a big problem. I've tried vitest but get some problems there also. I will give it another go now that we've removed babel. Maybe the isolatedModules plus require still being used was messing it up also |
Forcing |
Ehi @jasonwilliams, I'll answer here to the question you asked privately about using Jest's You can read more about it here. |
What kind of change does this PR introduce?
Compatibility with next v12
There were 2 type issues, one was this:
vercel/next.js#28646
Which needed defaultGetInitialProps to be added.
The other resolved itself by having useMaybeDeferContent removed.
How to test this PR:
npm i --save-dev next-page-tester/next-page-tester#pull/294/head
__NEXT_TEST_MODE=jest
env