You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import'@testing-library/jest-dom'import{render,screen}from'@testing-library/react'importPagefrom'../app/page'describe('Page',()=>{it('renders a heading',()=>{render(<Page/>)
constheading=screen.getByRole('heading',{level: 1})expect(heading).toBeInTheDocument()})})
which is completely missing the src/_app.tsx. So what's the point? How to perform a regular render run with next/jest?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
I have a NextJS app with pages, not AppRouter.
Now I need to test one of the pages.
The official docs from here https://nextjs.org/docs/app/building-your-application/testing/jest suggest this code:
which is completely missing the
src/_app.tsx
. So what's the point? How to perform a regular render run withnext/jest
?Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions