Unverified Commit 1c005eb3 authored by Steven's avatar Steven Committed by GitHub

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
parent 660d531b
...@@ -3056,6 +3056,10 @@ export default async function build( ...@@ -3056,6 +3056,10 @@ export default async function build(
if (config.output === 'export') { if (config.output === 'export') {
const exportApp: typeof import('../export').default = const exportApp: typeof import('../export').default =
require('../export').default require('../export').default
const pagesWorker = createStaticWorker('pages')
const appWorker = createStaticWorker('app')
const options: ExportOptions = { const options: ExportOptions = {
isInvokedFromCli: false, isInvokedFromCli: false,
nextConfig: config, nextConfig: config,
...@@ -3063,8 +3067,25 @@ export default async function build( ...@@ -3063,8 +3067,25 @@ export default async function build(
silent: true, silent: true,
threads: config.experimental.cpus, threads: config.experimental.cpus,
outdir: path.join(dir, configOutDir), 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) await exportApp(dir, options, nextBuildSpan)
// ensure the worker is not left hanging
pagesWorker.close()
appWorker.close()
} }
await nextBuildSpan await nextBuildSpan
......
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
nextConfig, nextConfig,
} from './utils' } 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 () => { it('should throw when exportPathMap configured', async () => {
nextConfig.replace( nextConfig.replace(
'trailingSlash: true,', 'trailingSlash: true,',
......
import { runTests } from './utils' import { runTests } from './utils'
describe.skip('dynamic api route dev', () => { it.each([
it.each([
{ dynamicApiRoute: 'undefined' }, { dynamicApiRoute: 'undefined' },
{ dynamicApiRoute: "'error'" }, { dynamicApiRoute: "'error'" },
{ dynamicApiRoute: "'force-static'" }, { dynamicApiRoute: "'force-static'" },
...@@ -10,10 +9,9 @@ describe.skip('dynamic api route dev', () => { ...@@ -10,10 +9,9 @@ describe.skip('dynamic api route dev', () => {
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'
describe.skip('dynamic api route prod', () => { it.each([
it.each([
{ dynamicApiRoute: 'undefined' }, { dynamicApiRoute: 'undefined' },
{ dynamicApiRoute: "'error'" }, { dynamicApiRoute: "'error'" },
{ dynamicApiRoute: "'force-static'" }, { dynamicApiRoute: "'force-static'" },
...@@ -10,10 +9,9 @@ describe.skip('dynamic api route prod', () => { ...@@ -10,10 +9,9 @@ describe.skip('dynamic api route prod', () => {
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'
describe.skip('dynamic page dev', () => { it.each([
it.each([
{ dynamicPage: 'undefined' }, { dynamicPage: 'undefined' },
{ dynamicPage: "'error'" }, { dynamicPage: "'error'" },
{ dynamicPage: "'force-static'" }, { dynamicPage: "'force-static'" },
...@@ -10,10 +9,9 @@ describe.skip('dynamic page dev', () => { ...@@ -10,10 +9,9 @@ describe.skip('dynamic page dev', () => {
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'
describe.skip('dynamic page dev', () => { it.each([
it.each([
{ dynamicPage: 'undefined' }, { dynamicPage: 'undefined' },
{ dynadynamicPagemic: "'error'" }, { dynadynamicPagemic: "'error'" },
{ dynamicPage: "'force-static'" }, { dynamicPage: "'force-static'" },
...@@ -10,10 +9,9 @@ describe.skip('dynamic page dev', () => { ...@@ -10,10 +9,9 @@ describe.skip('dynamic page dev', () => {
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 })
} }
) )
})
...@@ -17,7 +17,7 @@ const exportDir = join(appDir, 'out') ...@@ -17,7 +17,7 @@ const exportDir = join(appDir, 'out')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
let app let app
describe.skip('app dir with output export (next start)', () => { describe('app dir with output export (next start)', () => {
afterEach(async () => { afterEach(async () => {
await killApp(app) await killApp(app)
nextConfig.restore() nextConfig.restore()
......
import { runTests } from './utils' import { runTests } from './utils'
describe.skip('trailing slash dev', () => { it.each([{ trailingSlash: false }, { trailingSlash: true }])(
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'
describe.skip('trailing slash dev', () => { it.each([{ trailingSlash: false }, { trailingSlash: true }])(
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