[test] Use `@force-gate`

parent 55638d47
...@@ -53,58 +53,53 @@ const cases: ReadonlyArray<readonly [string, string]> = [ ...@@ -53,58 +53,53 @@ const cases: ReadonlyArray<readonly [string, string]> = [
// Variants are supported with Turbopack only, so a webpack build rejects the // Variants are supported with Turbopack only, so a webpack build rejects the
// config of this fixture before it reads any route. // config of this fixture before it reads any route.
;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)( // @force-gate turbopack
'static variant combinations that are rejected', describe('static variant combinations that are rejected', () => {
() => { const { next, skipped } = nextTestSetup({
const { next, skipped } = nextTestSetup({ files: __dirname + '/fixtures/invalid-combinations',
files: __dirname + '/fixtures/invalid-combinations', // Every route of this fixture declares combinations that are rejected, so
// Every route of this fixture declares combinations that are rejected, so // a build of all of them at once cannot succeed. Both modes below drive
// a build of all of them at once cannot succeed. Both modes below drive // Next.js by hand instead.
// Next.js by hand instead. skipStart: true,
skipStart: true, skipDeployment: true,
skipDeployment: true, })
})
if (skipped) { if (skipped) {
return return
} }
if (isNextDev) { if (isNextDev) {
beforeAll(async () => { beforeAll(async () => {
await next.start() await next.start()
}) })
it.each(cases)('should report %s', async (name, expected) => { it.each(cases)('should report %s', async (name, expected) => {
const response = await next.fetch(`/case/${name}/requested`) const response = await next.fetch(`/case/${name}/requested`)
expect(response.status).toBe(500) expect(response.status).toBe(500)
await retry(async () => { await retry(async () => {
expect(next.cliOutput).toContain(expected) expect(next.cliOutput).toContain(expected)
})
}) })
} else { })
it('should reject a combination on a route with no dynamic segments', async () => { } else {
// The dev server reads the static variant combinations of a route when it('should reject a combination on a route with no dynamic segments', async () => {
// it builds the static paths of that route, and it builds them for a // The dev server reads the static variant combinations of a route when
// dynamic route on request. This route has no dynamic segments, so it // it builds the static paths of that route, and it builds them for a
// builds no static paths at all, and only a build reads what it // dynamic route on request. This route has no dynamic segments, so it
// declared. // builds no static paths at all, and only a build reads what it
// // declared.
// `--debug-build-paths` restricts the build to this one route, so no //
// other route of the fixture can fail first. // `--debug-build-paths` restricts the build to this one route, so no
const { exitCode, cliOutput } = await next.build({ // other route of the fixture can fail first.
args: [ const { exitCode, cliOutput } = await next.build({
'--debug-build-paths', args: ['--debug-build-paths', 'app/case/no-dynamic-segments/page.tsx'],
'app/case/no-dynamic-segments/page.tsx',
],
})
expect(exitCode).toBe(1)
expect(cliOutput).toContain(
'`unstable_generateStaticVariants` for /case/no-dynamic-segments did not return an array.'
)
}) })
}
expect(exitCode).toBe(1)
expect(cliOutput).toContain(
'`unstable_generateStaticVariants` for /case/no-dynamic-segments did not return an array.'
)
})
} }
) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment