[Next.js 9.0.2] Shallow rendering issue: App cannot be invoked without 'new'
See original GitHub issueBug report
Describe the bug
After updating our app from Next.js 7.0.2 to 9.0.2 enzyme’s shallow rendering (same issue with enzyme’s mount) for the custom <App>
(_app.is) not working anymore. The local development server is serving the app perfectly fine, though.
For experimental purposes we also tried running our tests with Next.js 8.1.0 and the rendering caused no problems.
To Reproduce
Clone the issue repository: https://github.com/rzschoch/next-9-issues/tree/shallow-issue
- Run
npm install
- Run
npm run test
- See error:
TypeError: Class constructor App cannot be invoked without 'new'
Expected behavior
The test in /src/pagesSpecs/_app.spec.js
should be rendered without issues and compared against the existing snapshot (from Next.js 7.0.2).
Screenshots
System information
- OS: MacOS 10.14.5 / Windows 10.0.17763 Build 17763
- Version of Next.js: 9.0.2
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (3 by maintainers)
Top Results From Across the Web
[Next.js 9.0.2] Shallow rendering issue: App cannot ... - GitHub
After updating our app from Next.js 7.0.2 to 9.0.2 enzyme's shallow rendering (same issue with enzyme's mount) for the custom <App> (_app.is) ...
Read more >TypeError: Class constructor Document cannot be invoked ...
I changed Next.js version to 9.2 and I am having this issue: TypeError: Class constructor App cannot be invoked without 'new' at new...
Read more >Upgrade Guide - Next.js
Upgrade Guide. Upgrading from 12 to 13. To update to Next.js version 13, run the following command using your preferred package manager: npm...
Read more >Advanced Features: Custom `App` - Next.js
This new directory has support for layouts, nested routes, and uses Server Components by default. Inside app/ , you can fetch data for...
Read more >Basic Features: Pages - Next.js
This new directory has support for layouts, nested routes, and uses Server ... Static Generation is not a good idea if you cannot...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
after i removed the preset-env in presets, all i had in .babelrc was
and it didn’t work
After that i changed to
and it works 👍
Never mind, removing
"@babel/preset-env"
from"presets"
solve this issue.