Unverified Commit 488a61fd authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Skip output export production tests for Turbopack (#57197)

- Skips production tests for Turbopack
- Ensures the `suite` is not `undefined` because there was no describe block.
parent 3c374463
import { runTests } from './utils' import { runTests } from './utils'
it('should error when dynamic route is missing generateStaticParams', async () => { describe('app dir - with output export - dynamic missing gsp dev', () => {
describe('development mode', () => {
it('should error when dynamic route is missing generateStaticParams', async () => {
await runTests({ await runTests({
isDev: true, isDev: true,
dynamicPage: 'undefined', dynamicPage: 'undefined',
...@@ -8,9 +10,9 @@ it('should error when dynamic route is missing generateStaticParams', async () = ...@@ -8,9 +10,9 @@ it('should error when dynamic route is missing generateStaticParams', async () =
expectedErrMsg: expectedErrMsg:
'Page "/another/[slug]/page" is missing exported function "generateStaticParams()", which is required with "output: export" config.', 'Page "/another/[slug]/page" is missing exported function "generateStaticParams()", which is required with "output: export" config.',
}) })
}) })
it('should error when client component has generateStaticParams', async () => { it('should error when client component has generateStaticParams', async () => {
await runTests({ await runTests({
isDev: true, isDev: true,
dynamicPage: 'undefined', dynamicPage: 'undefined',
...@@ -18,4 +20,6 @@ it('should error when client component has generateStaticParams', async () => { ...@@ -18,4 +20,6 @@ it('should error when client component has generateStaticParams', async () => {
expectedErrMsg: expectedErrMsg:
'Page "/another/[slug]/page" cannot use both "use client" and export function "generateStaticParams()".', 'Page "/another/[slug]/page" cannot use both "use client" and export function "generateStaticParams()".',
}) })
})
})
}) })
import { runTests } from './utils' import { runTests } from './utils'
it('should error when dynamic route is missing generateStaticParams', async () => { describe('app dir - with output export - dynamic missing gsp prod', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it('should error when dynamic route is missing generateStaticParams', async () => {
await runTests({ await runTests({
isDev: false, isDev: false,
dynamicPage: 'undefined', dynamicPage: 'undefined',
...@@ -8,9 +10,9 @@ it('should error when dynamic route is missing generateStaticParams', async () = ...@@ -8,9 +10,9 @@ it('should error when dynamic route is missing generateStaticParams', async () =
expectedErrMsg: expectedErrMsg:
'Page "/another/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.', 'Page "/another/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.',
}) })
}) })
it('should error when client component has generateStaticParams', async () => { it('should error when client component has generateStaticParams', async () => {
await runTests({ await runTests({
isDev: false, isDev: false,
dynamicPage: 'undefined', dynamicPage: 'undefined',
...@@ -18,4 +20,6 @@ it('should error when client component has generateStaticParams', async () => { ...@@ -18,4 +20,6 @@ it('should error when client component has generateStaticParams', async () => {
expectedErrMsg: expectedErrMsg:
'Page "/another/[slug]/page" cannot use both "use client" and export function "generateStaticParams()".', 'Page "/another/[slug]/page" cannot use both "use client" and export function "generateStaticParams()".',
}) })
})
})
}) })
import { runTests } from './utils' import { runTests } from './utils'
it.each([ describe('app dir - with output export - dynamic api route dev', () => {
describe('development mode', () => {
it.each([
{ dynamicApiRoute: 'undefined' }, { dynamicApiRoute: 'undefined' },
{ dynamicApiRoute: "'error'" }, { dynamicApiRoute: "'error'" },
{ dynamicApiRoute: "'force-static'" }, { dynamicApiRoute: "'force-static'" },
...@@ -9,9 +11,11 @@ it.each([ ...@@ -9,9 +11,11 @@ it.each([
expectedErrMsg: expectedErrMsg:
'export const dynamic = "force-dynamic" on page "/api/json" cannot be used with "output: export".', 'export const dynamic = "force-dynamic" on page "/api/json" cannot be used with "output: export".',
}, },
])( ])(
'should work in dev with dynamicApiRoute $dynamicApiRoute', 'should work in dev with dynamicApiRoute $dynamicApiRoute',
async ({ dynamicApiRoute, expectedErrMsg }) => { async ({ dynamicApiRoute, expectedErrMsg }) => {
await runTests({ isDev: true, dynamicApiRoute, expectedErrMsg }) await runTests({ isDev: true, dynamicApiRoute, expectedErrMsg })
} }
) )
})
})
import { runTests } from './utils' import { runTests } from './utils'
it.each([ describe('app dir - with output export - dynamic api route prod', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it.each([
{ dynamicApiRoute: 'undefined' }, { dynamicApiRoute: 'undefined' },
{ dynamicApiRoute: "'error'" }, { dynamicApiRoute: "'error'" },
{ dynamicApiRoute: "'force-static'" }, { dynamicApiRoute: "'force-static'" },
...@@ -9,9 +11,11 @@ it.each([ ...@@ -9,9 +11,11 @@ it.each([
expectedErrMsg: expectedErrMsg:
'export const dynamic = "force-dynamic" on page "/api/json" cannot be used with "output: export".', 'export const dynamic = "force-dynamic" on page "/api/json" cannot be used with "output: export".',
}, },
])( ])(
'should work in prod with dynamicApiRoute $dynamicApiRoute', 'should work in prod with dynamicApiRoute $dynamicApiRoute',
async ({ dynamicApiRoute, expectedErrMsg }) => { async ({ dynamicApiRoute, expectedErrMsg }) => {
await runTests({ isDev: false, dynamicApiRoute, expectedErrMsg }) await runTests({ isDev: false, dynamicApiRoute, expectedErrMsg })
} }
) )
})
})
import { runTests } from './utils' import { runTests } from './utils'
it.each([ describe('app dir - with output export - dynamic page dev', () => {
describe('development mode', () => {
it.each([
{ dynamicPage: 'undefined' }, { dynamicPage: 'undefined' },
{ dynamicPage: "'error'" }, { dynamicPage: "'error'" },
{ dynamicPage: "'force-static'" }, { dynamicPage: "'force-static'" },
...@@ -9,9 +11,11 @@ it.each([ ...@@ -9,9 +11,11 @@ it.each([
expectedErrMsg: expectedErrMsg:
'Page with `dynamic = "force-dynamic"` couldn\'t be rendered statically because it used `output: export`.', 'Page with `dynamic = "force-dynamic"` couldn\'t be rendered statically because it used `output: export`.',
}, },
])( ])(
'should work in dev with dynamicPage $dynamicPage', 'should work in dev with dynamicPage $dynamicPage',
async ({ dynamicPage, expectedErrMsg }) => { async ({ dynamicPage, expectedErrMsg }) => {
await runTests({ isDev: true, dynamicPage, expectedErrMsg }) await runTests({ isDev: true, dynamicPage, expectedErrMsg })
} }
) )
})
})
import { runTests } from './utils' import { runTests } from './utils'
it.each([ describe('app dir - with output export - dynamic api route prod', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it.each([
{ dynamicPage: 'undefined' }, { dynamicPage: 'undefined' },
{ dynadynamicPagemic: "'error'" }, { dynadynamicPagemic: "'error'" },
{ dynamicPage: "'force-static'" }, { dynamicPage: "'force-static'" },
...@@ -9,9 +11,11 @@ it.each([ ...@@ -9,9 +11,11 @@ it.each([
expectedErrMsg: expectedErrMsg:
'Page with `dynamic = "force-dynamic"` couldn\'t be rendered statically because it used `output: export`.', 'Page with `dynamic = "force-dynamic"` couldn\'t be rendered statically because it used `output: export`.',
}, },
])( ])(
'should work in prod with dynamicPage $dynamicPage', 'should work in prod with dynamicPage $dynamicPage',
async ({ dynamicPage, expectedErrMsg }) => { async ({ dynamicPage, expectedErrMsg }) => {
await runTests({ isDev: false, dynamicPage, expectedErrMsg }) await runTests({ isDev: false, dynamicPage, expectedErrMsg })
} }
) )
})
})
import { runTests } from './utils' import { runTests } from './utils'
it.each([{ trailingSlash: false }, { trailingSlash: true }])( describe('app dir - with output export - trailing slash dev', () => {
describe('development mode', () => {
it.each([{ trailingSlash: false }, { trailingSlash: true }])(
"should work in dev with trailingSlash '$trailingSlash'", "should work in dev with trailingSlash '$trailingSlash'",
async ({ trailingSlash }) => { async ({ trailingSlash }) => {
await runTests({ isDev: true, trailingSlash }) await runTests({ isDev: true, trailingSlash })
} }
) )
})
})
import { runTests } from './utils' import { runTests } from './utils'
it.each([{ trailingSlash: false }, { trailingSlash: true }])( describe('app dir - with output export - trailing slash prod', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it.each([{ trailingSlash: false }, { trailingSlash: true }])(
"should work in prod with trailingSlash '$trailingSlash'", "should work in prod with trailingSlash '$trailingSlash'",
async ({ trailingSlash }) => { async ({ trailingSlash }) => {
await runTests({ isDev: false, trailingSlash }) await runTests({ isDev: false, trailingSlash })
} }
) )
})
})
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