Skip to content

Commit

Permalink
Revert "Temporarily disable app dir export integration test" (#49311)
Browse files Browse the repository at this point in the history
- Reverts #48291
- Fixes #49059 
- TODO: move these tests to `./tests/e2e/*` to avoid flakes (that will be a follow up PR)
fix NEXT-1092
  • Loading branch information
styfle committed May 8, 2023
1 parent 660d531 commit 1c005eb
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 86 deletions.
21 changes: 21 additions & 0 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3056,15 +3056,36 @@ 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,
hasAppDir,
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
Expand Down
2 changes: 1 addition & 1 deletion test/integration/app-dir-export/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,',
Expand Down
32 changes: 15 additions & 17 deletions test/integration/app-dir-export/test/dynamicapiroute-dev.test.ts
Original file line number Diff line number Diff line change
@@ -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 })
}
)
32 changes: 15 additions & 17 deletions test/integration/app-dir-export/test/dynamicapiroute-prod.test.ts
Original file line number Diff line number Diff line change
@@ -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 })
}
)
32 changes: 15 additions & 17 deletions test/integration/app-dir-export/test/dynamicpage-dev.test.ts
Original file line number Diff line number Diff line change
@@ -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 })
}
)
32 changes: 15 additions & 17 deletions test/integration/app-dir-export/test/dynamicpage-prod.test.ts
Original file line number Diff line number Diff line change
@@ -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 })
}
)
2 changes: 1 addition & 1 deletion test/integration/app-dir-export/test/start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 6 additions & 8 deletions test/integration/app-dir-export/test/trailing-slash-dev.test.ts
Original file line number Diff line number Diff line change
@@ -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 })
}
)
Original file line number Diff line number Diff line change
@@ -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 })
}
)

0 comments on commit 1c005eb

Please sign in to comment.