with-jest-app example doesn't work
See original GitHub issueVerify canary release
- I verified that the issue exists in Next.js canary release
Provide environment information
➜ with-jest git:(canary) npx --no-install next info
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64
Binaries:
Node: 18.2.0
npm: 8.9.0
Yarn: 1.22.11
pnpm: N/A
Relevant packages:
next: 12.1.6
react: 18.1.0
react-dom: 18.1.0
warn - Latest canary version not detected, detected: "12.1.6", newest: "12.1.7-canary.9".
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
After setting up the with-jest example from the documentation, yarn test
consistently fails.
Expected Behavior
Whether using npx
or directly cloning the repo and running yarn test
, jest fails consistently. I’ve verified this on my work laptop as well.
The error is consistent: SyntaxError: Unexpected token '.'
To Reproduce
Clone the repo or use npx create-next-app@latest --example with-jest with-jest-app
following the documentation.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Testing Next.js apps with Jest
First, we will make a change in the actual calculator application so that it does not work as expected on purpose. To do...
Read more >Add the Jest Testing Framework to an Existing Next.js App
I have been using Next.js for a new project I am currently working on. Most of my Node.js experience working with web apps...
Read more >Testing
Learn how to set up Next.js with three commonly used testing tools — Cypress, Playwright, Jest, and React Testing Library.
Read more >Testing React Applications with Jest - Morioh
Learn how to test React applications with the Jest JavaScript testing framework. Jest is a JavaScript test runner maintained by Facebook.
Read more >Next.js Cheat Sheet: Ultimate Guide to Next.js 2023 - Blog
In this article, you got to know what is Next.js in brief, Next.js Cheat Sheet, and how it helps in making modern React-based...
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
Hi, this example is working correctly against the latest canary of Next.js please update and give it a try!
Note: May need to run with --clearCache at first
Test failes due to the fact that styles for index page located in
pages
folder. In order to pass the tests you should:src/styles
folder;index.tsx
on 4th line change imports to ->@/styles/index.module.css