Unverified Commit a961ec0d authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Skip production tests for Turbopack (#56045)

As Turbopack is only focusing on dev currently. 

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
parent 379f2d82
......@@ -152,19 +152,19 @@ jobs:
secrets: inherit
# --type production also runs tests/e2e
test-turbopack-prod:
name: test turbopack prod
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5]
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 16
skipForDocsOnly: 'yes'
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-tests-manifest.json" TURBOPACK=1 NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --type production
secrets: inherit
# test-turbopack-prod:
# name: test turbopack prod
# needs: ['build-native', 'build-next']
# strategy:
# fail-fast: false
# matrix:
# group: [1, 2, 3, 4, 5]
# uses: ./.github/workflows/build_reusable.yml
# with:
# nodeVersion: 16
# skipForDocsOnly: 'yes'
# afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-tests-manifest.json" TURBOPACK=1 NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --type production
# secrets: inherit
test-next-swc-wasm:
name: test next-swc wasm
......
......@@ -21,7 +21,7 @@ let appPort
let app
describe('404 Page Support with _app', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
afterAll(() => killApp(app))
it('should build successfully', async () => {
......
......@@ -25,7 +25,7 @@ let app
const context = {}
describe('AMP Usage', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let output = ''
beforeAll(async () => {
......
......@@ -56,8 +56,7 @@ describe('AppTree', () => {
afterAll(() => killApp(app))
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -7,7 +7,7 @@ import { nextBuild } from 'next-test-utils'
const appDir = __dirname
describe('app type checking', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let stderr, errors
beforeAll(async () => {
stderr = (await nextBuild(appDir, [], { stderr: true })).stderr
......
......@@ -115,8 +115,7 @@ describe('Async modules', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -37,8 +37,7 @@ describe('dev mode', () => {
afterAll(() => killApp(app))
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
buildId = await fs.readFile(join(appDir, '.next/BUILD_ID'), 'utf8')
......
......@@ -35,8 +35,7 @@ describe('Client 404', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
context.appPort = await findPort()
......
......@@ -97,8 +97,7 @@ describe('Client Shallow Routing', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -93,8 +93,7 @@ describe('Basic CSS Modules Ordering', () => {
tests()
})
describe('Production Mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
......@@ -436,8 +435,7 @@ describe('CSS Modules Composes Ordering', () => {
tests(true)
})
describe('Production Mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
......
......@@ -168,21 +168,24 @@ describe('CSS Support', () => {
})
}
describe('Production Mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})
tests()
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})
tests()
}
)
})
describe('CSS Cleanup on Render Failure', () => {
......@@ -231,21 +234,24 @@ describe('CSS Support', () => {
})
}
describe('Production Mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})
tests()
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})
tests()
}
)
})
describe('Page reload on CSS missing', () => {
......@@ -280,31 +286,34 @@ describe('CSS Support', () => {
})
}
describe('Production Mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
// Remove other page CSS files:
const manifest = await readJSON(
join(appDir, '.next', 'build-manifest.json')
)
const files = manifest['pages']['/other'].filter((e) =>
e.endsWith('.css')
)
if (files.length < 1) throw new Error()
await Promise.all(files.map((f) => remove(join(appDir, '.next', f))))
})
afterAll(async () => {
await killApp(app)
})
tests()
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
// Remove other page CSS files:
const manifest = await readJSON(
join(appDir, '.next', 'build-manifest.json')
)
const files = manifest['pages']['/other'].filter((e) =>
e.endsWith('.css')
)
if (files.length < 1) throw new Error()
await Promise.all(files.map((f) => remove(join(appDir, '.next', f))))
})
afterAll(async () => {
await killApp(app)
})
tests()
}
)
})
describe('Page hydrates with CSS and not waiting on dependencies', () => {
......@@ -373,34 +382,37 @@ describe('CSS Support', () => {
})
}
describe('Production Mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
const buildId = (
await readFile(join(appDir, '.next', 'BUILD_ID'), 'utf8')
).trim()
const fileName = join(
appDir,
'.next/static/',
buildId,
'_buildManifest.js'
)
if (!(await pathExists(fileName))) {
throw new Error('Missing build manifest')
}
await remove(fileName)
})
afterAll(async () => {
await killApp(app)
})
tests()
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
const buildId = (
await readFile(join(appDir, '.next', 'BUILD_ID'), 'utf8')
).trim()
const fileName = join(
appDir,
'.next/static/',
buildId,
'_buildManifest.js'
)
if (!(await pathExists(fileName))) {
throw new Error('Missing build manifest')
}
await remove(fileName)
})
afterAll(async () => {
await killApp(app)
})
tests()
}
)
})
})
......@@ -79,8 +79,7 @@ describe('Custom _error', () => {
expect(html).toContain('An error 404 occurred on server')
})
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let buildOutput = ''
beforeAll(async () => {
......
......@@ -35,8 +35,7 @@ describe('Custom page extension', () => {
afterAll(() => killApp(app))
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -53,8 +53,7 @@ describe('Custom routes', () => {
afterAll(() => killApp(app))
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -69,8 +69,7 @@ describe('Custom routes i18n with index redirect', () => {
afterAll(() => killApp(app))
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -176,8 +176,7 @@ describe('Custom routes i18n', () => {
afterAll(() => killApp(app))
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -2970,9 +2970,11 @@ describe('Custom routes', () => {
describe('dev mode', () => {
runSoloTests(true)
})
describe('production mode', () => {
runSoloTests()
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
runSoloTests()
}
)
})
})
......@@ -18,7 +18,7 @@ let app
const context = {}
describe('disabled runtime JS', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
appPort = await findPort()
......
......@@ -10,7 +10,7 @@ let appPort
let app
describe('File Dependencies', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
appPort = await findPort()
await nextBuild(appDir)
......
......@@ -62,8 +62,7 @@ describe('Dynamic Optional Routing Root Fallback', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
......
......@@ -48,8 +48,7 @@ describe('Dynamic Optional Routing', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
const curConfig = await fs.readFile(nextConfig, 'utf8')
......
......@@ -255,8 +255,7 @@ describe('Dynamic Optional Routing', () => {
})
})
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
const curConfig = await fs.readFile(nextConfig, 'utf8')
......
......@@ -1569,8 +1569,7 @@ describe('Dynamic Routing', () => {
runTests({ dev: true })
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(nextConfig)
......
......@@ -158,23 +158,29 @@ describe.each([
expect(output).not.toContain('DynamicWasmCodeGenerationWarning')
})
})
describe('production mode', () => {
let buildResult
beforeAll(async () => {
buildResult = await nextBuild(context.appDir, undefined, {
stderr: true,
stdout: true,
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
let buildResult
beforeAll(async () => {
buildResult = await nextBuild(context.appDir, undefined, {
stderr: true,
stdout: true,
})
})
})
it('should have middleware warning during build', () => {
expect(buildResult.stderr).toContain(`Failed to compile`)
expect(buildResult.stderr).toContain(`Used by usingEval, usingEvalSync`)
expect(buildResult.stderr).toContain(`Used by usingWebAssemblyCompile`)
expect(buildResult.stderr).toContain(DYNAMIC_CODE_ERROR)
})
})
it('should have middleware warning during build', () => {
expect(buildResult.stderr).toContain(`Failed to compile`)
expect(buildResult.stderr).toContain(
`Used by usingEval, usingEvalSync`
)
expect(buildResult.stderr).toContain(
`Used by usingWebAssemblyCompile`
)
expect(buildResult.stderr).toContain(DYNAMIC_CODE_ERROR)
})
}
)
}
)
......@@ -65,8 +65,7 @@ describe('dev mode', () => {
it('logs the error correctly', test(context))
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
const context = createContext()
beforeAll(async () => {
......
......@@ -110,8 +110,7 @@ Learn more: https://nextjs.org/docs/api-reference/edge-runtime`)
expect(stripAnsi(output)).toInclude(errorHighlight)
})
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let buildResult
beforeAll(async () => {
......
......@@ -117,8 +117,7 @@ describe('fallback: false rewrite', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
await nextBuild(appDir, [])
......
......@@ -50,8 +50,7 @@ describe('Fallback Dynamic Route Params', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
await nextBuild(appDir, [])
......
......@@ -4482,8 +4482,7 @@ describe('File Serving', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
const { code } = await nextBuild(appDir)
......
......@@ -49,8 +49,7 @@ describe('getInitialProps', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -29,7 +29,7 @@ const runTests = () => {
}
describe('getServerSideProps', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(nextConfig)
await fs.remove(join(appDir, '.next'))
......
......@@ -90,8 +90,7 @@ describe('gip identifiers', () => {
describe('dev mode', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
runTests()
})
})
......@@ -40,8 +40,7 @@ describe('pageProps GSSP conflict', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
const { code } = await nextBuild(appDir)
if (code !== 0) throw new Error(`build failed with code ${code}`)
......
......@@ -489,8 +489,7 @@ describe('GS(S)P Redirect Support', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
await nextBuild(appDir)
......
......@@ -514,8 +514,7 @@ describe('GS(S)P Redirect Support', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let output = ''
beforeAll(async () => {
......
......@@ -46,8 +46,7 @@ describe('Hashbang', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(nextConfig)
await nextBuild(appDir)
......
......@@ -50,8 +50,7 @@ describe('Hydration', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(path.join(appDir, '.next'))
await nextBuild(appDir)
......
......@@ -59,8 +59,7 @@ describe('i18n Support basePath', () => {
runTests(curCtx)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
nextConfig.replace(/__EXTERNAL_PORT__/g, ctx.externalPort)
await fs.remove(join(appDir, '.next'))
......
......@@ -231,8 +231,7 @@ describe('i18n Support Root Catch-all', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
await nextBuild(appDir)
......
......@@ -116,8 +116,7 @@ describe('Custom routes i18n', () => {
afterAll(() => killApp(app))
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -98,8 +98,7 @@ describe('i18n Support', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
await nextBuild(appDir)
......
......@@ -98,8 +98,7 @@ describe('i18n Support', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
await nextBuild(appDir)
......
......@@ -84,8 +84,7 @@ describe('Custom routes i18n', () => {
afterAll(() => killApp(app))
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -79,8 +79,7 @@ describe('Hash changes i18n', () => {
afterAll(() => killApp(app))
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -58,8 +58,7 @@ describe('i18n Support', () => {
runTests(curCtx)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
nextConfig.replace(/__EXTERNAL_PORT__/g, ctx.externalPort)
......@@ -433,26 +432,28 @@ describe('i18n Support', () => {
runSlashTests(curCtx)
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
const curCtx = {
...ctx,
}
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
nextConfig.replace('// trailingSlash', 'trailingSlash')
describe('production mode', () => {
const curCtx = {
...ctx,
}
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
nextConfig.replace('// trailingSlash', 'trailingSlash')
await nextBuild(appDir)
curCtx.appPort = await findPort()
curCtx.app = await nextStart(appDir, curCtx.appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(curCtx.app)
})
await nextBuild(appDir)
curCtx.appPort = await findPort()
curCtx.app = await nextStart(appDir, curCtx.appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(curCtx.app)
})
runSlashTests(curCtx)
})
runSlashTests(curCtx)
}
)
})
describe('with trailingSlash: false', () => {
......@@ -498,24 +499,26 @@ describe('i18n Support', () => {
runSlashTests(curCtx)
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
const curCtx = { ...ctx }
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
nextConfig.replace('// trailingSlash: true', 'trailingSlash: false')
await nextBuild(appDir)
curCtx.appPort = await findPort()
curCtx.app = await nextStart(appDir, curCtx.appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(curCtx.app)
})
describe('production mode', () => {
const curCtx = { ...ctx }
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
nextConfig.replace('// trailingSlash: true', 'trailingSlash: false')
await nextBuild(appDir)
curCtx.appPort = await findPort()
curCtx.app = await nextStart(appDir, curCtx.appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(curCtx.app)
})
runSlashTests(curCtx)
})
runSlashTests(curCtx)
}
)
})
it('should show proper error for duplicate defaultLocales', async () => {
......
......@@ -191,8 +191,7 @@ describe('nested index.js', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
const curConfig = await fs.readFile(nextConfig, 'utf8')
......
......@@ -22,7 +22,7 @@ const runTest = () => {
}
describe('Initial Refs', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -598,8 +598,7 @@ describe('Errors on invalid custom routes', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(() => {
getStderr = async () => {
const { stderr } = await nextBuild(appDir, [], { stderr: true })
......
......@@ -84,7 +84,7 @@ const noError = async (pathname, click = false) => {
}
describe('Invalid hrefs', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -153,8 +153,7 @@ describe('Errors on invalid custom middleware matchers', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(() => {
getStderr = async () => {
const { stderr } = await nextBuild(appDir, [], { stderr: true })
......
......@@ -40,8 +40,7 @@ describe('Custom routes invalid multi-match', () => {
afterAll(() => killApp(app))
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -83,8 +83,7 @@ describe('Invalid hrefs', () => {
await noError('/child-ref-func')
})
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -36,8 +36,7 @@ describe('Link without a router', () => {
expect(container.textContent).toBe('Click me')
})
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it('should not throw when rendered', () => {
jest.useFakeTimers()
......
......@@ -99,8 +99,7 @@ describe.each([
runTest()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let exportOutput = ''
beforeAll(async () => {
......
......@@ -40,8 +40,7 @@ describe('next/dynamic', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -56,8 +56,7 @@ describe('next/dynamic', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await runNextCommand(['build', appDir])
......
......@@ -52,8 +52,7 @@ describe('next/dynamic', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await runNextCommand(['build', appDir])
......
......@@ -106,7 +106,7 @@ describe('Build Error Tests for basePath', () => {
})
})
describe('Static Image Component Tests for basePath', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -205,7 +205,7 @@ describe('Build Error Tests', () => {
})
})
describe('Static Image Component Tests', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -163,7 +163,7 @@ describe('Build Error Tests', () => {
})
})
describe('Static Image Component Tests for basePath', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -217,7 +217,7 @@ describe('Build Error Tests', () => {
})
})
describe('Static Image Component Tests', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -89,8 +89,7 @@ describe('Error no pageProps', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -194,7 +194,7 @@ const runTests = () => {
}
describe('SSG notFound revalidate', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
await nextBuild(appDir, undefined, {
......
......@@ -79,8 +79,7 @@ describe('Nullish configs in next.config.js', () => {
runTests('dev')
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(() => {
getStdout = async () => {
const { stdout } = await nextBuild(appDir, [], { stdout: true })
......
......@@ -336,8 +336,7 @@ describe('Fallback path encoding', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
appPort = await findPort()
......
......@@ -76,7 +76,7 @@ function runTests(route, routePath) {
}
describe('SSG Prerender No Revalidate', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
await nextBuild(appDir, [])
......
......@@ -66,7 +66,7 @@ function runTests(route, routePath) {
}
describe('SSG Prerender Revalidate', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await fs.remove(join(appDir, '.next'))
await nextBuild(appDir, [])
......
......@@ -60,8 +60,7 @@ describe('Relay Compiler Transform - Multi Project Config', () => {
runTests('Project B')
})
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
describe('project-a', () => {
beforeAll(async () => {
await nextBuild(projectAAppDir, [], { cwd: projectAAppDir })
......
......@@ -41,8 +41,7 @@ describe('Relay Compiler Transform - Single Project Config', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
runRelayCompiler()
await nextBuild(appDir, [], { cwd: appDir })
......
......@@ -48,8 +48,7 @@ describe('rewrites persist with browser history actions', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -70,8 +70,7 @@ describe('Client-side rewrites resolving', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
appPort = await findPort()
await nextBuild(appDir)
......
......@@ -32,8 +32,7 @@ describe('rewrites destination query', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -55,8 +55,7 @@ describe('rewrites has condition', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -169,8 +169,7 @@ describe('rewrites manual href/as', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -60,7 +60,7 @@ const runTests = () => {
}
describe('Root Optional Catch-all Revalidate', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -57,8 +57,7 @@ describe('Route index handling', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -122,8 +122,7 @@ describe('Route indexes handling', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -44,8 +44,7 @@ describe('next/dynamic', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await runNextCommand(['build', appDir])
......
......@@ -36,8 +36,7 @@ describe('router.isReady', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
......
......@@ -61,8 +61,7 @@ describe('router.isReady with appGip', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
......
......@@ -91,8 +91,7 @@ describe('router.isReady', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
......
......@@ -48,8 +48,7 @@ describe('Router prefetch', () => {
await didResolveAfterPrefetch()
})
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -42,8 +42,7 @@ describe('router rerender', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -35,8 +35,7 @@ describe('serverside asset modules', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
......
......@@ -36,8 +36,7 @@ describe('Dynamic Routing', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
......
......@@ -85,8 +85,7 @@ describe('Dynamic Routing', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -81,8 +81,7 @@ describe('SSG data 404', () => {
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
......
......@@ -39,8 +39,7 @@ describe('Static Page Name', () => {
afterAll(() => killApp(app))
runTests()
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
appPort = await findPort()
await nextBuild(appDir)
......
......@@ -21,7 +21,7 @@ function runTests() {
}
describe('styled-jsx using in node_modules', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
const output = await nextBuild(appDir, undefined, {
stdout: true,
......
......@@ -102,8 +102,7 @@ describe('href resolving trailing-slash', () => {
runTests(true)
})
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
......
......@@ -46,7 +46,7 @@ const runTests = () => {
}
describe('Trailing Slash Rewrite Proxying', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
proxyPort = await findPort()
proxyServer = await initNextServerScript(
......
......@@ -234,76 +234,81 @@ describe('Trailing slashes', () => {
testWithTrailingSlash()
})
describe('production mode, trailingSlash: false', () => {
beforeAll(async () => {
nextConfig.replace('// trailingSlash: boolean', 'trailingSlash: false')
await nextBuild(appDir)
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(app)
})
testWithoutTrailingSlash()
it('should have a redirect in the routesmanifest', async () => {
const manifest = await fs.readJSON(
join(appDir, '.next', 'routes-manifest.json')
)
expect(manifest).toEqual(
expect.objectContaining({
redirects: expect.arrayContaining([
expect.objectContaining({
source: '/:path+/',
destination: '/:path+',
statusCode: 308,
}),
]),
})
)
})
})
describe('production mode, trailingSlash: true', () => {
beforeAll(async () => {
nextConfig.replace('// trailingSlash: boolean', 'trailingSlash: true')
await nextBuild(appDir)
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(app)
})
testWithTrailingSlash()
it('should have a redirect in the routesmanifest', async () => {
const manifest = await fs.readJSON(
join(appDir, '.next', 'routes-manifest.json')
)
expect(manifest).toEqual(
expect.objectContaining({
redirects: expect.arrayContaining([
expect.objectContaining({
source:
'/:file((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/]+\\.\\w+)/',
destination: '/:file',
statusCode: 308,
}),
expect.objectContaining({
source: '/:notfile((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/\\.]+)',
destination: '/:notfile/',
statusCode: 308,
}),
]),
})
)
})
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode, trailingSlash: false',
() => {
beforeAll(async () => {
nextConfig.replace('// trailingSlash: boolean', 'trailingSlash: false')
await nextBuild(appDir)
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(app)
})
testWithoutTrailingSlash()
it('should have a redirect in the routesmanifest', async () => {
const manifest = await fs.readJSON(
join(appDir, '.next', 'routes-manifest.json')
)
expect(manifest).toEqual(
expect.objectContaining({
redirects: expect.arrayContaining([
expect.objectContaining({
source: '/:path+/',
destination: '/:path+',
statusCode: 308,
}),
]),
})
)
})
}
)
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode, trailingSlash: true',
() => {
beforeAll(async () => {
nextConfig.replace('// trailingSlash: boolean', 'trailingSlash: true')
await nextBuild(appDir)
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(app)
})
testWithTrailingSlash()
it('should have a redirect in the routesmanifest', async () => {
const manifest = await fs.readJSON(
join(appDir, '.next', 'routes-manifest.json')
)
expect(manifest).toEqual(
expect.objectContaining({
redirects: expect.arrayContaining([
expect.objectContaining({
source:
'/:file((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/]+\\.\\w+)/',
destination: '/:file',
statusCode: 308,
}),
expect.objectContaining({
source:
'/:notfile((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/\\.]+)',
destination: '/:notfile/',
statusCode: 308,
}),
]),
})
)
})
}
)
describe('dev mode, with basepath, trailingSlash: true', () => {
beforeAll(async () => {
......@@ -329,30 +334,32 @@ describe('Trailing slashes', () => {
['/docs/linker?href=/', '/docs/'],
])
})
describe('production mode, with basepath, trailingSlash: true', () => {
beforeAll(async () => {
nextConfig.replace('// trailingSlash: boolean', 'trailingSlash: true')
nextConfig.replace('// basePath:', 'basePath:')
await nextBuild(appDir)
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(app)
})
testShouldRedirect([
['/docs/about', '/docs/about/'],
['/docs', '/docs/'],
['/docs/catch-all/hello/world', '/docs/catch-all/hello/world/'],
['/docs/catch-all/hello.world/', '/docs/catch-all/hello.world'],
])
testLinkShouldRewriteTo([
['/docs/linker?href=/about', '/docs/about/'],
['/docs/linker?href=/', '/docs/'],
])
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode, with basepath, trailingSlash: true',
() => {
beforeAll(async () => {
nextConfig.replace('// trailingSlash: boolean', 'trailingSlash: true')
nextConfig.replace('// basePath:', 'basePath:')
await nextBuild(appDir)
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
nextConfig.restore()
await killApp(app)
})
testShouldRedirect([
['/docs/about', '/docs/about/'],
['/docs', '/docs/'],
['/docs/catch-all/hello/world', '/docs/catch-all/hello/world/'],
['/docs/catch-all/hello.world/', '/docs/catch-all/hello.world'],
])
testLinkShouldRewriteTo([
['/docs/linker?href=/about', '/docs/about/'],
['/docs/linker?href=/', '/docs/'],
])
}
)
})
......@@ -28,7 +28,7 @@ const runTests = () => {
}
describe('TypeScript onlyRemoveTypeImports', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
const { code } = await nextBuild(appDir)
if (code !== 0) throw new Error(`build failed with code ${code}`)
......
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