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

Extract slow tests to avoid wasteful start/stop #65265

Merged
merged 1 commit into from
May 2, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -183,37 +183,6 @@ describe('parallel-routes-and-interception', () => {
expect(pageText).toContain('parallel/(new)/@baz/nested/page')
})

it('should gracefully handle when two page segments match the `children` parallel slot', async () => {
await next.stop()
await next.patchFile(
'app/parallel/nested-2/page.js',
outdent`
export default function Page() {
return 'hello world'
}
`
)

await next.start()

const html = await next.render('/parallel/nested-2')

// before adding this file, the page would have matched `/app/parallel/(new)/@baz/nested-2/page`
// but we've added a more specific page, so it should match that instead
if (process.env.TURBOPACK) {
// TODO: this matches differently in Turbopack because the Webpack loader does some sorting on the paths
// Investigate the discrepancy in a follow-up. For now, since no errors are being thrown (and since this test was previously ignored in Turbopack),
// we'll just verify that the page is rendered and some content was matched.
expect(html).toContain('parallel/(new)/@baz/nested/page')
} else {
expect(html).toContain('hello world')
}

await next.stop()
await next.deleteFile('app/parallel/nested-2/page.js')
await next.start()
})

it('should throw a 404 when no matching parallel route is found', async () => {
const browser = await next.browser('/parallel-tab-bar')
// we make sure the page is available through navigating
Expand Down Expand Up @@ -909,3 +878,44 @@ describe('parallel-routes-and-interception', () => {
}
})
})

describe('parallel-routes-and-interception with patching', () => {
const { next } = nextTestSetup({
files: __dirname,
skipStart: true,
})

afterEach(async () => {
try {
await next.stop()
} finally {
await next.deleteFile('app/parallel/nested-2/page.js')
}
})

it('should gracefully handle when two page segments match the `children` parallel slot', async () => {
await next.patchFile(
'app/parallel/nested-2/page.js',
outdent`
export default function Page() {
return 'hello world'
}
`
)

await next.start()

const html = await next.render('/parallel/nested-2')

// before adding this file, the page would have matched `/app/parallel/(new)/@baz/nested-2/page`
// but we've added a more specific page, so it should match that instead
if (process.env.TURBOPACK) {
// TODO: this matches differently in Turbopack because the Webpack loader does some sorting on the paths
// Investigate the discrepancy in a follow-up. For now, since no errors are being thrown (and since this test was previously ignored in Turbopack),
// we'll just verify that the page is rendered and some content was matched.
expect(html).toContain('parallel/(new)/@baz/nested/page')
} else {
expect(html).toContain('hello world')
}
})
})
Loading