Skip to content
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

Revert "separate hydration tests for pages router" #70218

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions test/development/acceptance/hydration-error-react-19.test.ts

This file was deleted.

24 changes: 12 additions & 12 deletions test/development/acceptance/hydration-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ import { FileRef, nextTestSetup } from 'e2e-utils'
import { outdent } from 'outdent'
import path from 'path'

// TODO: Enable this test once react 18 is supported for pages router
describe.skip('Error overlay for hydration errors (React 18)', () => {
describe('Error overlay for hydration errors', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '18.3.1',
'react-dom': '18.3.1',
},
skipStart: true,
})

Expand All @@ -38,13 +33,18 @@ describe.skip('Error overlay for hydration errors (React 18)', () => {
await session.assertHasRedbox()

expect(await session.getRedboxDescription()).toMatchInlineSnapshot(`
"Error: Text content does not match server-rendered HTML.
See more info here: https://nextjs.org/docs/messages/react-hydration-error"
`)
"Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used
See more info here: https://nextjs.org/docs/messages/react-hydration-error"
`)
expect(await session.getRedboxDescriptionWarning()).toMatchInlineSnapshot(`
"- A server/client branch \`if (typeof window !== 'undefined')\`.
- Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
- Date formatting in a user's locale which doesn't match the server.
- External changing data without sending a snapshot of it along with the HTML.
- Invalid HTML tag nesting.

expect(await session.getRedboxDescriptionWarning()).toMatchInlineSnapshot(
`"Text content did not match. Server: "server" Client: "client""`
)
It can also happen if the client has a browser extension installed which messes with the HTML before React loaded."
`)

await session.patch(
'index.js',
Expand Down
Loading