Skip to content

Commit

Permalink
Revert "separate hydration tests for pages router" (#70218)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Sep 18, 2024
1 parent 2cca35e commit ac4a1c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 84 deletions.
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

0 comments on commit ac4a1c6

Please sign in to comment.