Revert "Temporarily disable app dir export integration test" (#49311)

- Reverts vercel/next.js#48291
- Fixes #49059 
- TODO: move these tests to `./tests/e2e/*` to avoid flakes (that will be a follow up PR)
fix NEXT-1092
This commit is contained in:
Steven 2023-05-08 13:38:33 -04:00 committed by GitHub
parent 660d531b6a
commit 1c005eb303
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 95 additions and 86 deletions

View file

@ -3056,6 +3056,10 @@ export default async function build(
if (config.output === 'export') {
const exportApp: typeof import('../export').default =
require('../export').default
const pagesWorker = createStaticWorker('pages')
const appWorker = createStaticWorker('app')
const options: ExportOptions = {
isInvokedFromCli: false,
nextConfig: config,
@ -3063,8 +3067,25 @@ export default async function build(
silent: true,
threads: config.experimental.cpus,
outdir: path.join(dir, configOutDir),
exportAppPageWorker: sharedPool
? appWorker.exportPage.bind(appWorker)
: undefined,
exportPageWorker: sharedPool
? pagesWorker.exportPage.bind(pagesWorker)
: undefined,
endWorker: sharedPool
? async () => {
await pagesWorker.end()
await appWorker.end()
}
: undefined,
}
await exportApp(dir, options, nextBuildSpan)
// ensure the worker is not left hanging
pagesWorker.close()
appWorker.close()
}
await nextBuildSpan

View file

@ -10,7 +10,7 @@ import {
nextConfig,
} from './utils'
describe.skip('app dir with output export (next dev / next build)', () => {
describe('app dir with output export (next dev / next build)', () => {
it('should throw when exportPathMap configured', async () => {
nextConfig.replace(
'trailingSlash: true,',

View file

@ -1,19 +1,17 @@
import { runTests } from './utils'
describe.skip('dynamic api route dev', () => {
it.each([
{ dynamicApiRoute: 'undefined' },
{ dynamicApiRoute: "'error'" },
{ dynamicApiRoute: "'force-static'" },
{
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 })
}
)
})
it.each([
{ dynamicApiRoute: 'undefined' },
{ dynamicApiRoute: "'error'" },
{ dynamicApiRoute: "'force-static'" },
{
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 })
}
)

View file

@ -1,19 +1,17 @@
import { runTests } from './utils'
describe.skip('dynamic api route prod', () => {
it.each([
{ dynamicApiRoute: 'undefined' },
{ dynamicApiRoute: "'error'" },
{ dynamicApiRoute: "'force-static'" },
{
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 })
}
)
})
it.each([
{ dynamicApiRoute: 'undefined' },
{ dynamicApiRoute: "'error'" },
{ dynamicApiRoute: "'force-static'" },
{
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 })
}
)

View file

@ -1,19 +1,17 @@
import { runTests } from './utils'
describe.skip('dynamic page dev', () => {
it.each([
{ dynamicPage: 'undefined' },
{ dynamicPage: "'error'" },
{ dynamicPage: "'force-static'" },
{
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 })
}
)
})
it.each([
{ dynamicPage: 'undefined' },
{ dynamicPage: "'error'" },
{ dynamicPage: "'force-static'" },
{
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 })
}
)

View file

@ -1,19 +1,17 @@
import { runTests } from './utils'
describe.skip('dynamic page dev', () => {
it.each([
{ dynamicPage: 'undefined' },
{ dynadynamicPagemic: "'error'" },
{ dynamicPage: "'force-static'" },
{
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 })
}
)
})
it.each([
{ dynamicPage: 'undefined' },
{ dynadynamicPagemic: "'error'" },
{ dynamicPage: "'force-static'" },
{
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 })
}
)

View file

@ -17,7 +17,7 @@ const exportDir = join(appDir, 'out')
const nextConfig = new File(join(appDir, 'next.config.js'))
let app
describe.skip('app dir with output export (next start)', () => {
describe('app dir with output export (next start)', () => {
afterEach(async () => {
await killApp(app)
nextConfig.restore()

View file

@ -1,10 +1,8 @@
import { runTests } from './utils'
describe.skip('trailing slash dev', () => {
it.each([{ trailingSlash: false }, { trailingSlash: true }])(
"should work in dev with trailingSlash '$trailingSlash'",
async ({ trailingSlash }) => {
await runTests({ isDev: true, trailingSlash })
}
)
})
it.each([{ trailingSlash: false }, { trailingSlash: true }])(
"should work in dev with trailingSlash '$trailingSlash'",
async ({ trailingSlash }) => {
await runTests({ isDev: true, trailingSlash })
}
)

View file

@ -1,10 +1,8 @@
import { runTests } from './utils'
describe.skip('trailing slash dev', () => {
it.each([{ trailingSlash: false }, { trailingSlash: true }])(
"should work in prod with trailingSlash '$trailingSlash'",
async ({ trailingSlash }) => {
await runTests({ isDev: false, trailingSlash })
}
)
})
it.each([{ trailingSlash: false }, { trailingSlash: true }])(
"should work in prod with trailingSlash '$trailingSlash'",
async ({ trailingSlash }) => {
await runTests({ isDev: false, trailingSlash })
}
)