Skip to content

Commit

Permalink
add test for turbopack refresh error (vercel#55447)
Browse files Browse the repository at this point in the history
Closes WEB-1584
  • Loading branch information
ForsakenHarmony authored Sep 15, 2023
1 parent b3a916c commit e191ae3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/development/app-dir/basic/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Root({ children }) {
return (
<html>
<body>{children}</body>
</html>
)
}
3 changes: 3 additions & 0 deletions test/development/app-dir/basic/app/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Page() {
return <p>Page</p>
}
26 changes: 26 additions & 0 deletions test/development/app-dir/basic/basic.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { nextTestSetup } from 'e2e-utils'
import { describeVariants as describe, waitFor } from 'next-test-utils'
import { sandbox, waitForHydration } from 'development-sandbox'

describe.each(['default', 'turbo'])('basic app-dir tests', () => {
const { next } = nextTestSetup({
files: __dirname,
})

it('should reload app pages without error', async () => {
const { session, cleanup, browser } = await sandbox(next, undefined, '/')
expect(await session.hasRedbox(false)).toBe(false)

browser.refresh()

await waitFor(750)
await waitForHydration(browser)

for (let i = 0; i < 15; i++) {
expect(await session.hasRedbox(false)).toBe(false)
await waitFor(1000)
}

await cleanup()
})
})
1 change: 1 addition & 0 deletions test/turbopack-tests-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const enabledTests = [
'test/development/acceptance-app/server-components.test.ts',
'test/development/acceptance/hydration-error.test.ts',
'test/development/api-cors-with-rewrite/index.test.ts',
'test/development/app-dir/basic/basic.test.ts',
'test/development/app-dir/multiple-compiles-single-route/multiple-compiles-single-route.test.ts',
'test/development/app-dir/strict-mode-enabled-by-default/strict-mode-enabled-by-default.test.ts',
'test/development/basic/define-class-fields.test.ts',
Expand Down

0 comments on commit e191ae3

Please sign in to comment.