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

Remove browser.refresh in app tests #44186

Merged
merged 2 commits into from Dec 20, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 5 additions & 14 deletions test/development/acceptance-app/ReactRefreshRegression.test.ts
Expand Up @@ -145,8 +145,7 @@ describe('ReactRefreshRegression app', () => {
})

// https://github.com/vercel/next.js/issues/13978
// TODO-APP: fix case where server component is moved to a client component
test.skip('can fast refresh a page with dynamic rendering', async () => {
test('can fast refresh a page with dynamic rendering', async () => {
const { session, cleanup } = await sandbox(next)

await session.patch(
Expand Down Expand Up @@ -216,8 +215,7 @@ describe('ReactRefreshRegression app', () => {
})

// https://github.com/vercel/next.js/issues/13978
// TODO-APP: fix case where server component is moved to a client component
test.skip('can fast refresh a page with config', async () => {
test('can fast refresh a page with config', async () => {
const { session, cleanup } = await sandbox(next)

await session.patch(
Expand Down Expand Up @@ -264,17 +262,14 @@ describe('ReactRefreshRegression app', () => {
})

// https://github.com/vercel/next.js/issues/11504
// TODO-APP: fix case where error is not resolved to source correctly.
test('shows an overlay for anonymous function server-side error', async () => {
const { session, browser, cleanup } = await sandbox(next)
const { session, cleanup } = await sandbox(next)

await session.patch(
'app/page.js',
`export default function () { throw new Error('boom'); }`
)

await browser.refresh()

expect(await session.hasRedbox(true)).toBe(true)

const source = await session.getRedboxSource()
Expand All @@ -287,15 +282,13 @@ describe('ReactRefreshRegression app', () => {
})

test('shows an overlay for server-side error in server component', async () => {
const { session, browser, cleanup } = await sandbox(next)
const { session, cleanup } = await sandbox(next)

await session.patch(
'app/page.js',
`export default function Page() { throw new Error('boom'); }`
)

await browser.refresh()

expect(await session.hasRedbox(true)).toBe(true)

const source = await session.getRedboxSource()
Expand All @@ -308,16 +301,14 @@ describe('ReactRefreshRegression app', () => {
})

test('shows an overlay for server-side error in client component', async () => {
const { session, browser, cleanup } = await sandbox(next)
const { session, cleanup } = await sandbox(next)

await session.patch(
'app/page.js',
`'use client'
export default function Page() { throw new Error('boom'); }`
)

await browser.refresh()

expect(await session.hasRedbox(true)).toBe(true)

const source = await session.getRedboxSource()
Expand Down
15 changes: 3 additions & 12 deletions test/development/acceptance-app/server-components.test.ts
Expand Up @@ -22,7 +22,7 @@ describe('Error Overlay for server components', () => {

describe('createContext called in Server Component', () => {
it('should show error when React.createContext is called', async () => {
const { session, browser, cleanup } = await sandbox(
const { session, cleanup } = await sandbox(
next,
new Map([
[
Expand All @@ -43,9 +43,6 @@ describe('Error Overlay for server components', () => {
])
)

// TODO-APP: currently requires a full reload because moving from a client component to a server component isn't causing a Fast Refresh yet.
await browser.refresh()

expect(await session.hasRedbox(true)).toBe(true)
await check(async () => {
expect(await session.getRedboxSource(true)).toContain(
Expand All @@ -61,7 +58,7 @@ describe('Error Overlay for server components', () => {
})

it('should show error when React.createContext is called in external package', async () => {
const { session, browser, cleanup } = await sandbox(
const { session, cleanup } = await sandbox(
next,
new Map([
[
Expand Down Expand Up @@ -97,9 +94,6 @@ describe('Error Overlay for server components', () => {
])
)

// TODO-APP: currently requires a full reload because moving from a client component to a server component isn't causing a Fast Refresh yet.
await browser.refresh()

expect(await session.hasRedbox(true)).toBe(true)

await check(async () => {
Expand All @@ -117,7 +111,7 @@ describe('Error Overlay for server components', () => {
})

it('should show error when createContext is called in external package', async () => {
const { session, browser, cleanup } = await sandbox(
const { session, cleanup } = await sandbox(
next,
new Map([
[
Expand Down Expand Up @@ -153,9 +147,6 @@ describe('Error Overlay for server components', () => {
])
)

// TODO-APP: currently requires a full reload because moving from a client component to a server component isn't causing a Fast Refresh yet.
await browser.refresh()

expect(await session.hasRedbox(true)).toBe(true)

await check(async () => {
Expand Down