Configuring Jest in new Next App is failing
Unanswered
Keyhole wasp posted this in #help-forum
Keyhole waspOP
While Setting up Jest with Next.js using the below command, getting this issue : unable to resolve dependency tree
npm install -D jest jest-environment-jsdom @testing-library/react @testing-library/dom @testing-library/jest-dom ts-node
Also whold like to know why this install rc version of react ?
I used : npx create-next-app@latest
"dependencies": {
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
"next": "15.0.3"
}
npm install -D jest jest-environment-jsdom @testing-library/react @testing-library/dom @testing-library/jest-dom ts-node
Also whold like to know why this install rc version of react ?
I used : npx create-next-app@latest
"dependencies": {
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
"next": "15.0.3"
}
4 Replies
Belgian Hare
Read the error try with
Alternatively use bun as your pacakge manager
--force flag which ignores peer depenednecy incompatbilities.Alternatively use bun as your pacakge manager
npm install -D --force jest jest-environment-jsdom @testing-library/react @testing-library/dom @testing-library/jest-dom ts-node
Hope that helps
Keyhole waspOP
Thank you for your response.
As per the thorough analysis, Found that Next JS15 is comes with the RC version of React and React DOM 19.0.0-rc....
So its good to wait till the React Testing Library compatible with the NextJS15 as well as the React 19 stable release.
So decided to go with the Next 14 for now, Until we get an update.
We are starting a new Project, So wanted to make sure we have good to go with the JEST and React Testing Library.
Another issue reported by using the --force
https://nextjs-forum.com/post/1305141672182808657#message-1305141672182808657
As per the thorough analysis, Found that Next JS15 is comes with the RC version of React and React DOM 19.0.0-rc....
So its good to wait till the React Testing Library compatible with the NextJS15 as well as the React 19 stable release.
So decided to go with the Next 14 for now, Until we get an update.
We are starting a new Project, So wanted to make sure we have good to go with the JEST and React Testing Library.
Another issue reported by using the --force
https://nextjs-forum.com/post/1305141672182808657#message-1305141672182808657