Unverified Commit 5f7faac1 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

More Turbopack test fixes (#56248)

Skips additional production tests.

Follow-up to #56089

<!-- 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 cb8b3a21
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
renderViaHTTP, renderViaHTTP,
waitFor, waitFor,
} from 'next-test-utils' } from 'next-test-utils'
import { createNext, FileRef } from 'e2e-utils' import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base' import { NextInstance } from 'test/lib/next-modes/base'
import { outdent } from 'outdent' import { outdent } from 'outdent'
...@@ -21,10 +21,7 @@ describe.each([[''], ['/docs']])( ...@@ -21,10 +21,7 @@ describe.each([[''], ['/docs']])(
beforeAll(async () => { beforeAll(async () => {
next = await createNext({ next = await createNext({
files: { files: join(__dirname, 'hmr'),
pages: new FileRef(join(__dirname, 'hmr/pages')),
components: new FileRef(join(__dirname, 'hmr/components')),
},
nextConfig: { nextConfig: {
basePath, basePath,
}, },
......
...@@ -79,6 +79,107 @@ describe('404 Page Support', () => { ...@@ -79,6 +79,107 @@ describe('404 Page Support', () => {
runTests('dev') runTests('dev')
}) })
describe('dev mode 2', () => {
it('falls back to _error correctly without pages/404', async () => {
await fs.move(pages404, `${pages404}.bak`)
appPort = await findPort()
app = await launchApp(appDir, appPort)
const res = await fetchViaHTTP(appPort, '/abc')
await fs.move(`${pages404}.bak`, pages404)
await killApp(app)
expect(res.status).toBe(404)
expect(await res.text()).toContain('This page could not be found')
})
it('shows error with getInitialProps in pages/404 dev', async () => {
await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile(
pages404,
`
const page = () => 'custom 404 page'
page.getInitialProps = () => ({ a: 'b' })
export default page
`
)
let stderr = ''
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStderr(msg) {
stderr += msg || ''
},
})
await renderViaHTTP(appPort, '/abc')
try {
await check(() => stderr, gip404Err)
} finally {
await killApp(app)
await fs.remove(pages404)
await fs.move(`${pages404}.bak`, pages404)
}
})
it('does not show error with getStaticProps in pages/404 dev', async () => {
await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile(
pages404,
`
const page = () => 'custom 404 page'
export const getStaticProps = () => ({ props: { a: 'b' } })
export default page
`
)
let stderr = ''
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStderr(msg) {
stderr += msg || ''
},
})
await renderViaHTTP(appPort, '/abc')
await waitFor(1000)
await killApp(app)
await fs.remove(pages404)
await fs.move(`${pages404}.bak`, pages404)
expect(stderr).not.toMatch(gip404Err)
})
it('shows error with getServerSideProps in pages/404 dev', async () => {
await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile(
pages404,
`
const page = () => 'custom 404 page'
export const getServerSideProps = () => ({ props: { a: 'b' } })
export default page
`
)
let stderr = ''
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStderr(msg) {
stderr += msg || ''
},
})
await renderViaHTTP(appPort, '/abc')
await waitFor(1000)
await killApp(app)
await fs.remove(pages404)
await fs.move(`${pages404}.bak`, pages404)
expect(stderr).toMatch(gip404Err)
})
})
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
...@@ -89,7 +190,7 @@ describe('404 Page Support', () => { ...@@ -89,7 +190,7 @@ describe('404 Page Support', () => {
runTests('server') runTests('server')
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it('should not cache for custom 404 page with gssp and revalidate disabled', async () => { it('should not cache for custom 404 page with gssp and revalidate disabled', async () => {
await fs.move(pages404, `${pages404}.bak`) await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile( await fs.writeFile(
...@@ -156,19 +257,6 @@ describe('404 Page Support', () => { ...@@ -156,19 +257,6 @@ describe('404 Page Support', () => {
expect(cacheNext).toBe('no-cache, no-store, max-age=0, must-revalidate') expect(cacheNext).toBe('no-cache, no-store, max-age=0, must-revalidate')
}) })
it('falls back to _error correctly without pages/404', async () => {
await fs.move(pages404, `${pages404}.bak`)
appPort = await findPort()
app = await launchApp(appDir, appPort)
const res = await fetchViaHTTP(appPort, '/abc')
await fs.move(`${pages404}.bak`, pages404)
await killApp(app)
expect(res.status).toBe(404)
expect(await res.text()).toContain('This page could not be found')
})
it('shows error with getInitialProps in pages/404 build', async () => { it('shows error with getInitialProps in pages/404 build', async () => {
await fs.move(pages404, `${pages404}.bak`) await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile( await fs.writeFile(
...@@ -187,35 +275,6 @@ describe('404 Page Support', () => { ...@@ -187,35 +275,6 @@ describe('404 Page Support', () => {
expect(code).toBe(1) expect(code).toBe(1)
}) })
it('shows error with getInitialProps in pages/404 dev', async () => {
await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile(
pages404,
`
const page = () => 'custom 404 page'
page.getInitialProps = () => ({ a: 'b' })
export default page
`
)
let stderr = ''
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStderr(msg) {
stderr += msg || ''
},
})
await renderViaHTTP(appPort, '/abc')
try {
await check(() => stderr, gip404Err)
} finally {
await killApp(app)
await fs.remove(pages404)
await fs.move(`${pages404}.bak`, pages404)
}
})
it('does not show error with getStaticProps in pages/404 build', async () => { it('does not show error with getStaticProps in pages/404 build', async () => {
await fs.move(pages404, `${pages404}.bak`) await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile( await fs.writeFile(
...@@ -234,35 +293,6 @@ describe('404 Page Support', () => { ...@@ -234,35 +293,6 @@ describe('404 Page Support', () => {
expect(code).toBe(0) expect(code).toBe(0)
}) })
it('does not show error with getStaticProps in pages/404 dev', async () => {
await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile(
pages404,
`
const page = () => 'custom 404 page'
export const getStaticProps = () => ({ props: { a: 'b' } })
export default page
`
)
let stderr = ''
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStderr(msg) {
stderr += msg || ''
},
})
await renderViaHTTP(appPort, '/abc')
await waitFor(1000)
await killApp(app)
await fs.remove(pages404)
await fs.move(`${pages404}.bak`, pages404)
expect(stderr).not.toMatch(gip404Err)
})
it('shows error with getServerSideProps in pages/404 build', async () => { it('shows error with getServerSideProps in pages/404 build', async () => {
await fs.move(pages404, `${pages404}.bak`) await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile( await fs.writeFile(
...@@ -280,33 +310,5 @@ describe('404 Page Support', () => { ...@@ -280,33 +310,5 @@ describe('404 Page Support', () => {
expect(stderr).toMatch(gip404Err) expect(stderr).toMatch(gip404Err)
expect(code).toBe(1) expect(code).toBe(1)
}) })
it('shows error with getServerSideProps in pages/404 dev', async () => {
await fs.move(pages404, `${pages404}.bak`)
await fs.writeFile(
pages404,
`
const page = () => 'custom 404 page'
export const getServerSideProps = () => ({ props: { a: 'b' } })
export default page
`
)
let stderr = ''
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStderr(msg) {
stderr += msg || ''
},
})
await renderViaHTTP(appPort, '/abc')
await waitFor(1000)
await killApp(app)
await fs.remove(pages404)
await fs.move(`${pages404}.bak`, pages404)
expect(stderr).toMatch(gip404Err)
}) })
}) })
...@@ -57,7 +57,7 @@ const runTests = () => { ...@@ -57,7 +57,7 @@ const runTests = () => {
} }
describe('Auto Export', () => { describe('Auto Export', () => {
describe('production', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
......
...@@ -150,7 +150,7 @@ function runTests(dev) { ...@@ -150,7 +150,7 @@ function runTests(dev) {
} }
describe('CSS Module client-side navigation', () => { describe('CSS Module client-side navigation', () => {
describe('production', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) await nextBuild(appDir)
......
...@@ -2817,6 +2817,9 @@ describe('Custom routes', () => { ...@@ -2817,6 +2817,9 @@ describe('Custom routes', () => {
}) })
describe('export', () => { describe('export', () => {
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
let exportStderr = '' let exportStderr = ''
let exportVercelStderr = '' let exportVercelStderr = ''
...@@ -2868,6 +2871,8 @@ describe('Custom routes', () => { ...@@ -2868,6 +2871,8 @@ describe('Custom routes', () => {
`rewrites, redirects, and headers are not applied when exporting your application, detected (rewrites, redirects, headers)` `rewrites, redirects, and headers are not applied when exporting your application, detected (rewrites, redirects, headers)`
) )
}) })
}
)
}) })
describe('should load custom routes when only one type is used', () => { describe('should load custom routes when only one type is used', () => {
......
...@@ -13,7 +13,7 @@ import { ...@@ -13,7 +13,7 @@ import {
const appDir = path.join(__dirname, '..') const appDir = path.join(__dirname, '..')
describe('Handles Duplicate Pages', () => { describe('Handles Duplicate Pages', () => {
describe('production', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it('Throws an error during build', async () => { it('Throws an error during build', async () => {
const { stderr } = await nextBuild(appDir, [], { stderr: true }) const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).toContain('Duplicate page detected') expect(stderr).toContain('Duplicate page detected')
......
...@@ -97,7 +97,9 @@ describe('Edge runtime configurable guards', () => { ...@@ -97,7 +97,9 @@ describe('Edge runtime configurable guards', () => {
`Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime` `Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime`
) )
}) })
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
it('fails to build because of unallowed code', async () => { it('fails to build because of unallowed code', async () => {
const output = await nextBuild(context.appDir, undefined, { const output = await nextBuild(context.appDir, undefined, {
stdout: true, stdout: true,
...@@ -112,6 +114,8 @@ describe('Edge runtime configurable guards', () => { ...@@ -112,6 +114,8 @@ describe('Edge runtime configurable guards', () => {
expect(output.stderr).toContain(`Used by default`) expect(output.stderr).toContain(`Used by default`)
expect(output.stderr).toContain(TELEMETRY_EVENT_NAME) expect(output.stderr).toContain(TELEMETRY_EVENT_NAME)
}) })
}
)
}) })
describe.each([ describe.each([
...@@ -297,7 +301,9 @@ describe('Edge runtime configurable guards', () => { ...@@ -297,7 +301,9 @@ describe('Edge runtime configurable guards', () => {
}, },
])('$title with allowed, unused dynamic code', ({ init, url }) => { ])('$title with allowed, unused dynamic code', ({ init, url }) => {
beforeEach(() => init()) beforeEach(() => init())
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
it('build and does not warn at runtime', async () => { it('build and does not warn at runtime', async () => {
const output = await nextBuild(context.appDir, undefined, { const output = await nextBuild(context.appDir, undefined, {
stdout: true, stdout: true,
...@@ -306,7 +312,11 @@ describe('Edge runtime configurable guards', () => { ...@@ -306,7 +312,11 @@ describe('Edge runtime configurable guards', () => {
}) })
expect(output.stderr).not.toContain(`Build failed`) expect(output.stderr).not.toContain(`Build failed`)
expect(output.stderr).toContain(TELEMETRY_EVENT_NAME) expect(output.stderr).toContain(TELEMETRY_EVENT_NAME)
context.app = await nextStart(context.appDir, context.appPort, appOption) context.app = await nextStart(
context.appDir,
context.appPort,
appOption
)
const res = await fetchViaHTTP(context.appPort, url) const res = await fetchViaHTTP(context.appPort, url)
expect(res.status).toBe(200) expect(res.status).toBe(200)
expect(context.logs.output).not.toContain(`warn`) expect(context.logs.output).not.toContain(`warn`)
...@@ -314,6 +324,8 @@ describe('Edge runtime configurable guards', () => { ...@@ -314,6 +324,8 @@ describe('Edge runtime configurable guards', () => {
`Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime` `Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime`
) )
}) })
}
)
}) })
describe.each([ describe.each([
...@@ -373,7 +385,9 @@ describe('Edge runtime configurable guards', () => { ...@@ -373,7 +385,9 @@ describe('Edge runtime configurable guards', () => {
`Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime` `Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime`
) )
}) })
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
it('fails to build because of dynamic code evaluation', async () => { it('fails to build because of dynamic code evaluation', async () => {
const output = await nextBuild(context.appDir, undefined, { const output = await nextBuild(context.appDir, undefined, {
stdout: true, stdout: true,
...@@ -386,6 +400,8 @@ describe('Edge runtime configurable guards', () => { ...@@ -386,6 +400,8 @@ describe('Edge runtime configurable guards', () => {
) )
expect(output.stderr).toContain(TELEMETRY_EVENT_NAME) expect(output.stderr).toContain(TELEMETRY_EVENT_NAME)
}) })
}
)
}) })
describe.each([ describe.each([
...@@ -427,7 +443,9 @@ describe('Edge runtime configurable guards', () => { ...@@ -427,7 +443,9 @@ describe('Edge runtime configurable guards', () => {
`Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime` `Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime`
) )
}) })
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
// eslint-disable-next-line jest/no-identical-title // eslint-disable-next-line jest/no-identical-title
it('build and does not warn at runtime', async () => { it('build and does not warn at runtime', async () => {
const output = await nextBuild(context.appDir, undefined, { const output = await nextBuild(context.appDir, undefined, {
...@@ -435,7 +453,11 @@ describe('Edge runtime configurable guards', () => { ...@@ -435,7 +453,11 @@ describe('Edge runtime configurable guards', () => {
stderr: true, stderr: true,
}) })
expect(output.stderr).not.toContain(`Build failed`) expect(output.stderr).not.toContain(`Build failed`)
context.app = await nextStart(context.appDir, context.appPort, appOption) context.app = await nextStart(
context.appDir,
context.appPort,
appOption
)
const res = await fetchViaHTTP(context.appPort, url) const res = await fetchViaHTTP(context.appPort, url)
expect(res.status).toBe(200) expect(res.status).toBe(200)
expect(context.logs.output).not.toContain(`warn`) expect(context.logs.output).not.toContain(`warn`)
...@@ -443,5 +465,7 @@ describe('Edge runtime configurable guards', () => { ...@@ -443,5 +465,7 @@ describe('Edge runtime configurable guards', () => {
`Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime` `Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime`
) )
}) })
}
)
}) })
}) })
...@@ -11,7 +11,7 @@ import { join } from 'path' ...@@ -11,7 +11,7 @@ import { join } from 'path'
const appDir = join(__dirname, '../app') const appDir = join(__dirname, '../app')
describe('Image Generation', () => { describe('Image Generation', () => {
describe('Prod', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let app let app
let appPort let appPort
......
...@@ -10,6 +10,7 @@ const indexPage = join(appDir, 'pages/index.js') ...@@ -10,6 +10,7 @@ const indexPage = join(appDir, 'pages/index.js')
const indexPageBak = `${indexPage}.bak` const indexPageBak = `${indexPage}.bak`
describe('Mixed getStaticProps and getServerSideProps error', () => { describe('Mixed getStaticProps and getServerSideProps error', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it('should error with getStaticProps but no default export', async () => { it('should error with getStaticProps but no default export', async () => {
// TODO: remove after investigating why dev swc build fails here // TODO: remove after investigating why dev swc build fails here
await fs.writeFile( await fs.writeFile(
...@@ -103,4 +104,5 @@ describe('Mixed getStaticProps and getServerSideProps error', () => { ...@@ -103,4 +104,5 @@ describe('Mixed getStaticProps and getServerSideProps error', () => {
"getStaticPaths is only allowed for dynamic SSG pages and was found on '/'." "getStaticPaths is only allowed for dynamic SSG pages and was found on '/'."
) )
}) })
})
}) })
...@@ -19,7 +19,7 @@ let app ...@@ -19,7 +19,7 @@ let app
let proxyServer: http.Server let proxyServer: http.Server
let cancelCount = 0 let cancelCount = 0
describe('react-virtualized wrapping next/legacy/image', () => { describe('react-virtualized wrapping next/legacy/image', () => {
describe('production', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) await nextBuild(appDir)
......
...@@ -19,7 +19,7 @@ let app ...@@ -19,7 +19,7 @@ let app
let proxyServer: http.Server let proxyServer: http.Server
let cancelCount = 0 let cancelCount = 0
describe('react-virtualized wrapping next/image', () => { describe('react-virtualized wrapping next/image', () => {
describe('production', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) await nextBuild(appDir)
......
...@@ -38,8 +38,7 @@ describe('node-fetch-keep-alive', () => { ...@@ -38,8 +38,7 @@ describe('node-fetch-keep-alive', () => {
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
describe('production', () => {
beforeAll(async () => { beforeAll(async () => {
mockServer = createServer((req, res) => { mockServer = createServer((req, res) => {
// we can test request headers by sending them // we can test request headers by sending them
......
...@@ -38,6 +38,7 @@ function runTests() { ...@@ -38,6 +38,7 @@ function runTests() {
} }
describe('Production browser sourcemaps', () => { describe('Production browser sourcemaps', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
describe('Server support', () => { describe('Server support', () => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir, [], {}) await nextBuild(appDir, [], {})
...@@ -45,4 +46,5 @@ describe('Production browser sourcemaps', () => { ...@@ -45,4 +46,5 @@ describe('Production browser sourcemaps', () => {
runTests() runTests()
}) })
})
}) })
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
} from 'next-test-utils' } from 'next-test-utils'
describe('Production Custom Build Directory', () => { describe('Production Custom Build Directory', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
describe('With basic usage', () => { describe('With basic usage', () => {
it('should render the page', async () => { it('should render the page', async () => {
const result = await runNextCommand(['build', 'build'], { const result = await runNextCommand(['build', 'build'], {
...@@ -28,4 +29,5 @@ describe('Production Custom Build Directory', () => { ...@@ -28,4 +29,5 @@ describe('Production Custom Build Directory', () => {
await killApp(app) await killApp(app)
}) })
}) })
})
}) })
...@@ -16,6 +16,7 @@ let app ...@@ -16,6 +16,7 @@ let app
let appPort let appPort
describe('Production Config Usage', () => { describe('Production Config Usage', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -76,4 +77,5 @@ describe('Production Config Usage', () => { ...@@ -76,4 +77,5 @@ describe('Production Config Usage', () => {
expect(result.stderr).not.toMatch(/The key "SOME__ENV__VAR" under/) expect(result.stderr).not.toMatch(/The key "SOME__ENV__VAR" under/)
}) })
}) })
})
}) })
...@@ -10,6 +10,7 @@ let appPort ...@@ -10,6 +10,7 @@ let appPort
let app let app
describe('Production Usage', () => { describe('Production Usage', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
// use compatible port: https://www.browserstack.com/question/664 // use compatible port: https://www.browserstack.com/question/664
...@@ -31,4 +32,5 @@ describe('Production Usage', () => { ...@@ -31,4 +32,5 @@ describe('Production Usage', () => {
await waitFor(2000) await waitFor(2000)
expect(await browser.eval('window.beforeNav')).toBe(true) expect(await browser.eval('window.beforeNav')).toBe(true)
}) })
})
}) })
...@@ -439,8 +439,9 @@ describe('404 handling', () => { ...@@ -439,8 +439,9 @@ describe('404 handling', () => {
isDev: true, isDev: true,
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)(
describe('production', () => { 'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir, [], nextOpts) await nextBuild(appDir, [], nextOpts)
}) })
...@@ -471,7 +472,8 @@ describe('404 handling', () => { ...@@ -471,7 +472,8 @@ describe('404 handling', () => {
isExport: true, isExport: true,
}) })
}) })
}) }
)
} }
describe('custom _error', () => { describe('custom _error', () => {
...@@ -479,6 +481,9 @@ describe('404 handling', () => { ...@@ -479,6 +481,9 @@ describe('404 handling', () => {
}) })
describe('pages/404', () => { describe('pages/404', () => {
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
const pagesErr = join(appDir, 'pages/_error.js') const pagesErr = join(appDir, 'pages/_error.js')
const pages404 = join(appDir, 'pages/404.js') const pages404 = join(appDir, 'pages/404.js')
...@@ -503,5 +508,7 @@ describe('404 handling', () => { ...@@ -503,5 +508,7 @@ describe('404 handling', () => {
}) })
devStartAndExport(true) devStartAndExport(true)
}
)
}) })
}) })
...@@ -13,6 +13,7 @@ import path from 'path' ...@@ -13,6 +13,7 @@ import path from 'path'
const appDir = path.join(__dirname, '..') const appDir = path.join(__dirname, '..')
describe('config telemetry', () => { describe('config telemetry', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it('detects rewrites, headers, and redirects for next build', async () => { it('detects rewrites, headers, and redirects for next build', async () => {
await fs.rename( await fs.rename(
path.join(appDir, 'next.config.custom-routes'), path.join(appDir, 'next.config.custom-routes'),
...@@ -560,4 +561,5 @@ describe('config telemetry', () => { ...@@ -560,4 +561,5 @@ describe('config telemetry', () => {
invocationCount: 1, invocationCount: 1,
}) })
}) })
})
}) })
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