Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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 })
}
)