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', () => {
await runTests({ describe('development mode', () => {
isDev: true, it('should error when dynamic route is missing generateStaticParams', async () => {
dynamicPage: 'undefined', await runTests({
generateStaticParamsOpt: 'set noop', isDev: true,
expectedErrMsg: dynamicPage: 'undefined',
'Page "/another/[slug]/page" is missing exported function "generateStaticParams()", which is required with "output: export" config.', generateStaticParamsOpt: 'set noop',
}) expectedErrMsg:
}) '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',
generateStaticParamsOpt: 'set client', generateStaticParamsOpt: 'set client',
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', () => {
await runTests({ ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
isDev: false, it('should error when dynamic route is missing generateStaticParams', async () => {
dynamicPage: 'undefined', await runTests({
generateStaticParamsOpt: 'set noop', isDev: false,
expectedErrMsg: dynamicPage: 'undefined',
'Page "/another/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.', generateStaticParamsOpt: 'set noop',
}) expectedErrMsg:
}) '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',
generateStaticParamsOpt: 'set client', generateStaticParamsOpt: 'set client',
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', () => {
{ dynamicApiRoute: 'undefined' }, describe('development mode', () => {
{ dynamicApiRoute: "'error'" }, it.each([
{ dynamicApiRoute: "'force-static'" }, { dynamicApiRoute: 'undefined' },
{ { dynamicApiRoute: "'error'" },
dynamicApiRoute: "'force-dynamic'", { dynamicApiRoute: "'force-static'" },
expectedErrMsg: {
'export const dynamic = "force-dynamic" on page "/api/json" cannot be used with "output: export".', dynamicApiRoute: "'force-dynamic'",
}, expectedErrMsg:
])( 'export const dynamic = "force-dynamic" on page "/api/json" cannot be used with "output: export".',
'should work in dev with dynamicApiRoute $dynamicApiRoute', },
async ({ dynamicApiRoute, expectedErrMsg }) => { ])(
await runTests({ isDev: true, dynamicApiRoute, expectedErrMsg }) 'should work in dev with dynamicApiRoute $dynamicApiRoute',
} async ({ 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', () => {
{ dynamicApiRoute: 'undefined' }, ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
{ dynamicApiRoute: "'error'" }, it.each([
{ dynamicApiRoute: "'force-static'" }, { dynamicApiRoute: 'undefined' },
{ { dynamicApiRoute: "'error'" },
dynamicApiRoute: "'force-dynamic'", { dynamicApiRoute: "'force-static'" },
expectedErrMsg: {
'export const dynamic = "force-dynamic" on page "/api/json" cannot be used with "output: export".', dynamicApiRoute: "'force-dynamic'",
}, expectedErrMsg:
])( 'export const dynamic = "force-dynamic" on page "/api/json" cannot be used with "output: export".',
'should work in prod with dynamicApiRoute $dynamicApiRoute', },
async ({ dynamicApiRoute, expectedErrMsg }) => { ])(
await runTests({ isDev: false, dynamicApiRoute, expectedErrMsg }) 'should work in prod with dynamicApiRoute $dynamicApiRoute',
} async ({ 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', () => {
{ dynamicPage: 'undefined' }, describe('development mode', () => {
{ dynamicPage: "'error'" }, it.each([
{ dynamicPage: "'force-static'" }, { dynamicPage: 'undefined' },
{ { dynamicPage: "'error'" },
dynamicPage: "'force-dynamic'", { dynamicPage: "'force-static'" },
expectedErrMsg: {
'Page with `dynamic = "force-dynamic"` couldn\'t be rendered statically because it used `output: export`.', dynamicPage: "'force-dynamic'",
}, expectedErrMsg:
])( 'Page with `dynamic = "force-dynamic"` couldn\'t be rendered statically because it used `output: export`.',
'should work in dev with dynamicPage $dynamicPage', },
async ({ dynamicPage, expectedErrMsg }) => { ])(
await runTests({ isDev: true, dynamicPage, expectedErrMsg }) 'should work in dev with dynamicPage $dynamicPage',
} async ({ 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', () => {
{ dynamicPage: 'undefined' }, ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
{ dynadynamicPagemic: "'error'" }, it.each([
{ dynamicPage: "'force-static'" }, { dynamicPage: 'undefined' },
{ { dynadynamicPagemic: "'error'" },
dynamicPage: "'force-dynamic'", { dynamicPage: "'force-static'" },
expectedErrMsg: {
'Page with `dynamic = "force-dynamic"` couldn\'t be rendered statically because it used `output: export`.', dynamicPage: "'force-dynamic'",
}, expectedErrMsg:
])( 'Page with `dynamic = "force-dynamic"` couldn\'t be rendered statically because it used `output: export`.',
'should work in prod with dynamicPage $dynamicPage', },
async ({ dynamicPage, expectedErrMsg }) => { ])(
await runTests({ isDev: false, dynamicPage, expectedErrMsg }) 'should work in prod with dynamicPage $dynamicPage',
} async ({ 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', () => {
"should work in dev with trailingSlash '$trailingSlash'", describe('development mode', () => {
async ({ trailingSlash }) => { it.each([{ trailingSlash: false }, { trailingSlash: true }])(
await runTests({ isDev: true, trailingSlash }) "should work in dev with trailingSlash '$trailingSlash'",
} async ({ 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', () => {
"should work in prod with trailingSlash '$trailingSlash'", ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
async ({ trailingSlash }) => { it.each([{ trailingSlash: false }, { trailingSlash: true }])(
await runTests({ isDev: false, trailingSlash }) "should work in prod with trailingSlash '$trailingSlash'",
} async ({ 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