Unverified Commit 1e710ab7 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Rename process.env.TURBOPACK -> process.env.TURBOPACK_DEV in test skips (#63665)

## What?

Follow-up to #63653.

<!-- 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 #

-->


Closes NEXT-2911
parent f9d73cc2
...@@ -14,7 +14,7 @@ createNextDescribe( ...@@ -14,7 +14,7 @@ createNextDescribe(
}, },
({ next, isNextStart }) => { ({ next, isNextStart }) => {
if (!isNextStart) { if (!isNextStart) {
it('skip test for dev mode', () => {}) it('skip test for development mode', () => {})
return return
} }
......
...@@ -17,7 +17,7 @@ createNextDescribe( ...@@ -17,7 +17,7 @@ createNextDescribe(
}, },
({ next, isNextStart, isNextDeploy }) => { ({ next, isNextStart, isNextDeploy }) => {
if (!isNextStart) { if (!isNextStart) {
it('skip test for dev mode', () => {}) it('skip test for development mode', () => {})
return return
} }
......
...@@ -80,7 +80,7 @@ createNextDescribe( ...@@ -80,7 +80,7 @@ createNextDescribe(
}, },
({ next, isNextDev }) => { ({ next, isNextDev }) => {
if (isNextDev) { if (isNextDev) {
// since the router behavior is different in dev mode (no viewport prefetching + liberal revalidation) // since the router behavior is different in development mode (no viewport prefetching + liberal revalidation)
// we only check the production behavior // we only check the production behavior
it('should skip dev', () => {}) it('should skip dev', () => {})
} else { } else {
......
...@@ -35,7 +35,7 @@ createNextDescribe( ...@@ -35,7 +35,7 @@ createNextDescribe(
}, },
({ next, isNextDev }) => { ({ next, isNextDev }) => {
if (isNextDev) { if (isNextDev) {
it.skip('should skip test in dev mode', () => {}) it.skip('should skip test in development mode', () => {})
} else { } else {
it('should avoid double-fetching when optimistic navigation fails', async () => { it('should avoid double-fetching when optimistic navigation fails', async () => {
const browser = await next.browser('/foo') const browser = await next.browser('/foo')
......
...@@ -3056,7 +3056,7 @@ createNextDescribe( ...@@ -3056,7 +3056,7 @@ createNextDescribe(
}) })
} }
}) })
// Don't run these tests in dev mode since they won't be statically generated // Don't run these tests in development mode since they won't be statically generated
if (!isDev) { if (!isDev) {
describe('server response', () => { describe('server response', () => {
it('should bailout to client rendering - with suspense boundary', async () => { it('should bailout to client rendering - with suspense boundary', async () => {
...@@ -3215,7 +3215,7 @@ createNextDescribe( ...@@ -3215,7 +3215,7 @@ createNextDescribe(
}) })
} }
if (!process.env.CUSTOM_CACHE_HANDLER && isDev) { if (!process.env.CUSTOM_CACHE_HANDLER && isDev) {
it('should not cache request if response data size is greater than 2MB and FetchCache is possible in Dev mode', async () => { it('should not cache request if response data size is greater than 2MB and FetchCache is possible in development mode', async () => {
const cliOutputStart = next.cliOutput.length const cliOutputStart = next.cliOutput.length
const resp1 = await next.fetch('/force-cache/large-data') const resp1 = await next.fetch('/force-cache/large-data')
const resp1Text = await resp1.text() const resp1Text = await resp1.text()
...@@ -3243,7 +3243,7 @@ createNextDescribe( ...@@ -3243,7 +3243,7 @@ createNextDescribe(
}) })
} }
if (process.env.CUSTOM_CACHE_HANDLER && isDev) { if (process.env.CUSTOM_CACHE_HANDLER && isDev) {
it('should cache request if response data size is greater than 2MB in Dev mode', async () => { it('should cache request if response data size is greater than 2MB in development mode', async () => {
const cliOutputStart = next.cliOutput.length const cliOutputStart = next.cliOutput.length
const resp1 = await next.fetch('/force-cache/large-data') const resp1 = await next.fetch('/force-cache/large-data')
const resp1Text = await resp1.text() const resp1Text = await resp1.text()
......
...@@ -52,7 +52,7 @@ createNextDescribe( ...@@ -52,7 +52,7 @@ createNextDescribe(
withFullUrlFetches?: boolean withFullUrlFetches?: boolean
}) { }) {
if (withFetchesLogging) { if (withFetchesLogging) {
it('should only log requests in dev mode', async () => { it('should only log requests in development mode', async () => {
const outputIndex = next.cliOutput.length const outputIndex = next.cliOutput.length
await next.fetch('/default-cache') await next.fetch('/default-cache')
......
...@@ -12,7 +12,7 @@ createNextDescribe( ...@@ -12,7 +12,7 @@ createNextDescribe(
}, },
({ next, isNextDev }) => { ({ next, isNextDev }) => {
// If it's start mode, we get the whole logs since they're from build process. // If it's start mode, we get the whole logs since they're from build process.
// If it's dev mode, we get the logs after request // If it's development mode, we get the logs after request
function getCliOutput(logStartPosition: number) { function getCliOutput(logStartPosition: number) {
return isNextDev ? next.cliOutput.slice(logStartPosition) : next.cliOutput return isNextDev ? next.cliOutput.slice(logStartPosition) : next.cliOutput
} }
......
...@@ -8,7 +8,7 @@ createNextDescribe( ...@@ -8,7 +8,7 @@ createNextDescribe(
}, },
({ next, isNextDev }) => { ({ next, isNextDev }) => {
if (isNextDev) { if (isNextDev) {
it.skip('skip test for dev mode', () => {}) it.skip('skip test for development mode', () => {})
return return
} }
......
import { nextBuild } from 'next-test-utils' import { nextBuild } from 'next-test-utils'
describe('ppr build errors', () => { describe('ppr build errors', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
let stderr: string let stderr: string
let stdout: string let stdout: string
...@@ -43,5 +45,6 @@ describe('ppr build errors', () => { ...@@ -43,5 +45,6 @@ describe('ppr build errors', () => {
) )
}) })
}) })
}) }
)
}) })
...@@ -16,7 +16,7 @@ const apiPath = 'pages/api/edge.js' ...@@ -16,7 +16,7 @@ const apiPath = 'pages/api/edge.js'
const api = new File(join(appDir, apiPath)) const api = new File(join(appDir, apiPath))
if ((global as any).isNextDev) { if ((global as any).isNextDev) {
describe('In dev mode', () => { describe('In development mode', () => {
beforeAll(async () => { beforeAll(async () => {
next = await createNext({ next = await createNext({
files: new FileRef(appDir), files: new FileRef(appDir),
......
...@@ -1076,7 +1076,7 @@ describe('Prerender', () => { ...@@ -1076,7 +1076,7 @@ describe('Prerender', () => {
expect(JSON.parse($2('#__NEXT_DATA__').text()).isFallback).toBe(false) expect(JSON.parse($2('#__NEXT_DATA__').text()).isFallback).toBe(false)
}) })
it('should log error in console and browser in dev mode', async () => { it('should log error in console and browser in development mode', async () => {
const indexPage = 'pages/index.js' const indexPage = 'pages/index.js'
const origContent = await next.readFile(indexPage) const origContent = await next.readFile(indexPage)
......
...@@ -21,7 +21,9 @@ let appPort ...@@ -21,7 +21,9 @@ let appPort
let app let app
describe('404 Page Support with _app', () => { describe('404 Page Support with _app', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
it('should build successfully', async () => { it('should build successfully', async () => {
...@@ -57,9 +59,10 @@ describe('404 Page Support with _app', () => { ...@@ -57,9 +59,10 @@ describe('404 Page Support with _app', () => {
const $ = cheerio.load(await res.text()) const $ = cheerio.load(await res.text())
expect($('#404-title').text()).toBe('Hi There') expect($('#404-title').text()).toBe('Hi There')
}) })
}) }
)
describe('dev mode', () => { describe('development mode', () => {
let stderr = '' let stderr = ''
let stdout = '' let stdout = ''
......
...@@ -51,7 +51,9 @@ const runTests = (mode) => { ...@@ -51,7 +51,9 @@ const runTests = (mode) => {
} }
describe('Default 404 Page with custom _error', () => { describe('Default 404 Page with custom _error', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
it('should build successfully', async () => { it('should build successfully', async () => {
...@@ -68,9 +70,10 @@ describe('Default 404 Page with custom _error', () => { ...@@ -68,9 +70,10 @@ describe('Default 404 Page with custom _error', () => {
}) })
runTests('server') runTests('server')
}) }
)
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
......
...@@ -76,7 +76,9 @@ const runTests = (isDev) => { ...@@ -76,7 +76,9 @@ const runTests = (isDev) => {
} }
describe('404 Page Support SSG', () => { describe('404 Page Support SSG', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
it('should build successfully', async () => { it('should build successfully', async () => {
...@@ -109,9 +111,10 @@ describe('404 Page Support SSG', () => { ...@@ -109,9 +111,10 @@ describe('404 Page Support SSG', () => {
}) })
runTests() runTests()
}) }
)
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
stderr = '' stderr = ''
......
...@@ -70,7 +70,7 @@ const runTests = (mode = 'server') => { ...@@ -70,7 +70,7 @@ const runTests = (mode = 'server') => {
} }
describe('404 Page Support', () => { describe('404 Page Support', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -79,7 +79,7 @@ describe('404 Page Support', () => { ...@@ -79,7 +79,7 @@ describe('404 Page Support', () => {
runTests('dev') runTests('dev')
}) })
describe('dev mode 2', () => { describe('development mode 2', () => {
it('falls back to _error correctly without pages/404', async () => { it('falls back to _error correctly without pages/404', async () => {
await fs.move(pages404, `${pages404}.bak`) await fs.move(pages404, `${pages404}.bak`)
appPort = await findPort() appPort = await findPort()
...@@ -180,7 +180,9 @@ describe('404 Page Support', () => { ...@@ -180,7 +180,9 @@ describe('404 Page Support', () => {
expect(stderr).toMatch(gip404Err) expect(stderr).toMatch(gip404Err)
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -189,8 +191,11 @@ describe('404 Page Support', () => { ...@@ -189,8 +191,11 @@ describe('404 Page Support', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests('server') runTests('server')
}) }
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { )
;(process.env.TURBOPACK_DEV ? 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(
...@@ -310,5 +315,6 @@ describe('404 Page Support', () => { ...@@ -310,5 +315,6 @@ describe('404 Page Support', () => {
expect(stderr).toMatch(gip404Err) expect(stderr).toMatch(gip404Err)
expect(code).toBe(1) expect(code).toBe(1)
}) })
}) }
)
}) })
...@@ -23,7 +23,9 @@ let appPort ...@@ -23,7 +23,9 @@ let appPort
let app let app
describe('gsp-gssp', () => { describe('gsp-gssp', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('does not show error with getStaticProps in pages/500 build', async () => { it('does not show error with getStaticProps in pages/500 build', async () => {
await fs.move(pages500, `${pages500}.bak`) await fs.move(pages500, `${pages500}.bak`)
await fs.writeFile( await fs.writeFile(
...@@ -179,7 +181,8 @@ describe('gsp-gssp', () => { ...@@ -179,7 +181,8 @@ describe('gsp-gssp', () => {
expect(appStderr).toContain('called _error getServerSideProps') expect(appStderr).toContain('called _error getServerSideProps')
}) })
}) }
)
describe('development mode', () => { describe('development mode', () => {
it('does not show error with getStaticProps in pages/500 dev', async () => { it('does not show error with getStaticProps in pages/500 dev', async () => {
......
...@@ -60,7 +60,7 @@ const runTests = (mode = 'server') => { ...@@ -60,7 +60,7 @@ const runTests = (mode = 'server') => {
} }
describe('500 Page Support', () => { describe('500 Page Support', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
await fs.remove(join(appDir, '.next')) await fs.remove(join(appDir, '.next'))
appPort = await findPort() appPort = await findPort()
...@@ -100,7 +100,9 @@ describe('500 Page Support', () => { ...@@ -100,7 +100,9 @@ describe('500 Page Support', () => {
expect(stderr).toMatch(gip500Err) expect(stderr).toMatch(gip500Err)
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await fs.remove(join(appDir, '.next')) await fs.remove(join(appDir, '.next'))
await nextBuild(appDir) await nextBuild(appDir)
...@@ -110,8 +112,9 @@ describe('500 Page Support', () => { ...@@ -110,8 +112,9 @@ describe('500 Page Support', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests('server') runTests('server')
}) }
;(process.env.TURBOPACK ? describe.skip : describe)( )
;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode 2', 'production mode 2',
() => { () => {
it('does not build 500 statically with getInitialProps in _app', async () => { it('does not build 500 statically with getInitialProps in _app', async () => {
......
...@@ -19,7 +19,9 @@ let cdnAccessLog = [] ...@@ -19,7 +19,9 @@ let cdnAccessLog = []
const nextConfig = new File(path.resolve(__dirname, '../next.config.js')) const nextConfig = new File(path.resolve(__dirname, '../next.config.js'))
describe('absolute assetPrefix with path prefix', () => { describe('absolute assetPrefix with path prefix', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
cdnPort = await findPort() cdnPort = await findPort()
// lightweight http proxy // lightweight http proxy
...@@ -119,5 +121,6 @@ describe('absolute assetPrefix with path prefix', () => { ...@@ -119,5 +121,6 @@ describe('absolute assetPrefix with path prefix', () => {
`/_next/data/${buildId}/gssp.json?prop=foo` `/_next/data/${buildId}/gssp.json?prop=foo`
) )
}) })
}) }
)
}) })
...@@ -13,7 +13,9 @@ const nextConfig = new File(join(appDir, 'next.config.js')) ...@@ -13,7 +13,9 @@ const nextConfig = new File(join(appDir, 'next.config.js'))
let buildOutput let buildOutput
describe('AMP Validation on Export', () => { describe('AMP Validation on Export', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
const { stdout = '', stderr = '' } = await nextBuild(appDir, [], { const { stdout = '', stderr = '' } = await nextBuild(appDir, [], {
stdout: true, stdout: true,
...@@ -48,7 +50,9 @@ describe('AMP Validation on Export', () => { ...@@ -48,7 +50,9 @@ describe('AMP Validation on Export', () => {
expect(stdout).toMatch( expect(stdout).toMatch(
/error.*The mandatory attribute 'height' is missing in tag 'amp-video'\./ /error.*The mandatory attribute 'height' is missing in tag 'amp-video'\./
) )
await expect(access(join(outDir, 'cat.html'))).resolves.toBe(undefined) await expect(access(join(outDir, 'cat.html'))).resolves.toBe(
undefined
)
await expect(stderr).not.toMatch( await expect(stderr).not.toMatch(
/Found conflicting amp tag "meta" with conflicting prop name="viewport"/ /Found conflicting amp tag "meta" with conflicting prop name="viewport"/
) )
...@@ -76,7 +80,9 @@ describe('AMP Validation on Export', () => { ...@@ -76,7 +80,9 @@ describe('AMP Validation on Export', () => {
expect(stdout).toMatch( expect(stdout).toMatch(
/error.*The parent tag of tag 'img' is 'div', but it can only be 'i-amphtml-sizer-intrinsic'\./ /error.*The parent tag of tag 'img' is 'div', but it can only be 'i-amphtml-sizer-intrinsic'\./
) )
await expect(access(join(outDir, 'dog.html'))).resolves.toBe(undefined) await expect(access(join(outDir, 'dog.html'))).resolves.toBe(
undefined
)
await expect(stderr).not.toMatch( await expect(stderr).not.toMatch(
/Found conflicting amp tag "meta" with conflicting prop name="viewport"/ /Found conflicting amp tag "meta" with conflicting prop name="viewport"/
) )
...@@ -114,5 +120,6 @@ describe('AMP Validation on Export', () => { ...@@ -114,5 +120,6 @@ describe('AMP Validation on Export', () => {
nextConfig.restore() nextConfig.restore()
} }
}) })
}) }
)
}) })
...@@ -14,7 +14,9 @@ let appPort ...@@ -14,7 +14,9 @@ let appPort
const appDir = join(__dirname, '../') const appDir = join(__dirname, '../')
describe('AMP Custom Optimizer', () => { describe('AMP Custom Optimizer', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should build and start for static page', async () => { it('should build and start for static page', async () => {
const { code } = await nextBuild(appDir) const { code } = await nextBuild(appDir)
expect(code).toBe(0) expect(code).toBe(0)
...@@ -52,5 +54,6 @@ describe('AMP Custom Optimizer', () => { ...@@ -52,5 +54,6 @@ describe('AMP Custom Optimizer', () => {
'script async src="https://cdn.ampproject.org/rtv/001515617716922/v0.mjs"' 'script async src="https://cdn.ampproject.org/rtv/001515617716922/v0.mjs"'
) )
}) })
}) }
)
}) })
...@@ -18,7 +18,7 @@ const appDir = join(__dirname, '../') ...@@ -18,7 +18,7 @@ const appDir = join(__dirname, '../')
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK ? describe.skip : describe)(
'AMP Custom Validator', 'AMP Custom Validator',
() => { () => {
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('should build and start successfully', async () => { it('should build and start successfully', async () => {
...@@ -37,7 +37,7 @@ const appDir = join(__dirname, '../') ...@@ -37,7 +37,7 @@ const appDir = join(__dirname, '../')
) )
describe('development mode', () => { describe('development mode', () => {
it('should run in dev mode successfully', async () => { it('should run in development mode successfully', async () => {
let stderr = '' let stderr = ''
appPort = await findPort() appPort = await findPort()
......
...@@ -16,7 +16,9 @@ let appPort ...@@ -16,7 +16,9 @@ let appPort
let app let app
describe('AMP Fragment Styles', () => { describe('AMP Fragment Styles', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir, []) await nextBuild(appDir, [])
appPort = await findPort() appPort = await findPort()
...@@ -32,5 +34,6 @@ describe('AMP Fragment Styles', () => { ...@@ -32,5 +34,6 @@ describe('AMP Fragment Styles', () => {
expect(styles).toMatch(/background:(.*|)hotpink/) expect(styles).toMatch(/background:(.*|)hotpink/)
expect(styles).toMatch(/font-size:(.*|)16\.4px/) expect(styles).toMatch(/font-size:(.*|)16\.4px/)
}) })
}) }
)
}) })
...@@ -99,7 +99,9 @@ const runTests = (isDev = false) => { ...@@ -99,7 +99,9 @@ const runTests = (isDev = false) => {
} }
describe('AMP SSG Support', () => { describe('AMP SSG Support', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -109,8 +111,9 @@ describe('AMP SSG Support', () => { ...@@ -109,8 +111,9 @@ describe('AMP SSG Support', () => {
}) })
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
describe('dev mode', () => { )
describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -119,7 +122,7 @@ describe('AMP SSG Support', () => { ...@@ -119,7 +122,7 @@ describe('AMP SSG Support', () => {
runTests(true) runTests(true)
}) })
describe('export mode', () => { describe('export mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
let buildId let buildId
......
...@@ -25,7 +25,9 @@ let app ...@@ -25,7 +25,9 @@ let app
const context = {} const context = {}
describe('AMP Usage', () => { describe('AMP Usage', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
let output = '' let output = ''
beforeAll(async () => { beforeAll(async () => {
...@@ -243,7 +245,8 @@ describe('AMP Usage', () => { ...@@ -243,7 +245,8 @@ describe('AMP Usage', () => {
expect(styles).not.toMatch(/\/\*# sourceMappingURL=.*\*\//) expect(styles).not.toMatch(/\/\*# sourceMappingURL=.*\*\//)
}) })
}) })
}) }
)
describe('AMP dev no-warn', () => { describe('AMP dev no-warn', () => {
let dynamicAppPort let dynamicAppPort
...@@ -269,7 +272,7 @@ describe('AMP Usage', () => { ...@@ -269,7 +272,7 @@ describe('AMP Usage', () => {
}) })
}) })
describe('AMP dev mode', () => { describe('AMP development mode', () => {
let dynamicAppPort let dynamicAppPort
let ampDynamic let ampDynamic
let output = '' let output = ''
......
...@@ -59,7 +59,9 @@ describe('API routes', () => { ...@@ -59,7 +59,9 @@ describe('API routes', () => {
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -68,5 +70,6 @@ describe('API routes', () => { ...@@ -68,5 +70,6 @@ describe('API routes', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -547,7 +547,7 @@ function runTests(dev = false) { ...@@ -547,7 +547,7 @@ function runTests(dev = false) {
expect(getPageFileFromPagesManifest(appDir, '/api/users')).toBeTruthy() expect(getPageFileFromPagesManifest(appDir, '/api/users')).toBeTruthy()
}) })
it('should show warning when the API resolves without ending the request in dev mode', async () => { it('should show warning when the API resolves without ending the request in development mode', async () => {
const controller = new AbortController() const controller = new AbortController()
setTimeout(() => { setTimeout(() => {
controller.abort() controller.abort()
...@@ -644,7 +644,9 @@ describe('API routes', () => { ...@@ -644,7 +644,9 @@ describe('API routes', () => {
runTests(true) runTests(true)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
mode = 'server' mode = 'server'
...@@ -654,5 +656,6 @@ describe('API routes', () => { ...@@ -654,5 +656,6 @@ describe('API routes', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -11,7 +11,9 @@ import { ...@@ -11,7 +11,9 @@ import {
} from './utils' } from './utils'
describe('app dir - with output export (next dev / next build)', () => { describe('app dir - with output export (next dev / next build)', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should throw when exportPathMap configured', async () => { it('should throw when exportPathMap configured', async () => {
nextConfig.replace( nextConfig.replace(
'trailingSlash: true,', 'trailingSlash: true,',
...@@ -78,12 +80,15 @@ describe('app dir - with output export (next dev / next build)', () => { ...@@ -78,12 +80,15 @@ describe('app dir - with output export (next dev / next build)', () => {
) )
try { try {
await nextBuild(appDir) await nextBuild(appDir)
expect(await getFiles(outputDir)).toEqual(expectedWhenTrailingSlashTrue) expect(await getFiles(outputDir)).toEqual(
expectedWhenTrailingSlashTrue
)
} finally { } finally {
nextConfig.restore() nextConfig.restore()
await fs.remove(distDir) await fs.remove(distDir)
await fs.remove(outputDir) await fs.remove(outputDir)
} }
}) })
}) }
)
}) })
import { runTests } from './utils' import { runTests } from './utils'
describe('app dir - with output export - dynamic missing gsp prod', () => { describe('app dir - with output export - dynamic missing gsp prod', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should error when dynamic route is missing generateStaticParams', async () => { it('should error when dynamic route is missing generateStaticParams', async () => {
await runTests({ await runTests({
isDev: false, isDev: false,
...@@ -21,5 +23,6 @@ describe('app dir - with output export - dynamic missing gsp prod', () => { ...@@ -21,5 +23,6 @@ describe('app dir - with output export - dynamic missing gsp prod', () => {
'Page "/another/[slug]/page" cannot use both "use client" and export function "generateStaticParams()".', 'Page "/another/[slug]/page" cannot use both "use client" and export function "generateStaticParams()".',
}) })
}) })
}) }
)
}) })
import { runTests } from './utils' import { runTests } from './utils'
describe('app dir - with output export - dynamic api route prod', () => { describe('app dir - with output export - dynamic api route prod', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it.each([ it.each([
{ dynamicApiRoute: 'undefined' }, { dynamicApiRoute: 'undefined' },
{ dynamicApiRoute: "'error'" }, { dynamicApiRoute: "'error'" },
...@@ -17,5 +19,6 @@ describe('app dir - with output export - dynamic api route prod', () => { ...@@ -17,5 +19,6 @@ describe('app dir - with output export - dynamic api route prod', () => {
await runTests({ isDev: false, dynamicApiRoute, expectedErrMsg }) await runTests({ isDev: false, dynamicApiRoute, expectedErrMsg })
} }
) )
}) }
)
}) })
import { runTests } from './utils' import { runTests } from './utils'
describe('app dir - with output export - dynamic api route prod', () => { describe('app dir - with output export - dynamic api route prod', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it.each([ it.each([
{ dynamicPage: 'undefined' }, { dynamicPage: 'undefined' },
{ dynamicPage: "'error'" }, { dynamicPage: "'error'" },
...@@ -17,5 +19,6 @@ describe('app dir - with output export - dynamic api route prod', () => { ...@@ -17,5 +19,6 @@ describe('app dir - with output export - dynamic api route prod', () => {
await runTests({ isDev: false, dynamicPage, expectedErrMsg }) await runTests({ isDev: false, dynamicPage, expectedErrMsg })
} }
) )
}) }
)
}) })
...@@ -18,7 +18,9 @@ const nextConfig = new File(join(appDir, 'next.config.js')) ...@@ -18,7 +18,9 @@ const nextConfig = new File(join(appDir, 'next.config.js'))
let app let app
describe('app dir - with output export (next start)', () => { describe('app dir - with output export (next start)', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
afterEach(async () => { afterEach(async () => {
await killApp(app) await killApp(app)
nextConfig.restore() nextConfig.restore()
...@@ -58,5 +60,6 @@ describe('app dir - with output export (next start)', () => { ...@@ -58,5 +60,6 @@ describe('app dir - with output export (next start)', () => {
`"next start" does not work with "output: standalone" configuration. Use "node .next/standalone/server.js" instead.` `"next start" does not work with "output: standalone" configuration. Use "node .next/standalone/server.js" instead.`
) )
}) })
}) }
)
}) })
import { runTests } from './utils' import { runTests } from './utils'
describe('app dir - with output export - trailing slash prod', () => { describe('app dir - with output export - trailing slash prod', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
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 })
} }
) )
}) }
)
}) })
...@@ -51,7 +51,9 @@ const respectsChunkAttachmentOrder = async () => { ...@@ -51,7 +51,9 @@ const respectsChunkAttachmentOrder = async () => {
} }
describe('Root components import order', () => { describe('Root components import order', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -67,7 +69,8 @@ describe('Root components import order', () => { ...@@ -67,7 +69,8 @@ describe('Root components import order', () => {
'root components should be imported in this order _document > _app > page in order to respect side effects', 'root components should be imported in this order _document > _app > page in order to respect side effects',
respectsSideEffects respectsSideEffects
) )
}) }
)
}) })
describe('development mode', () => { describe('development mode', () => {
......
...@@ -16,7 +16,9 @@ let server ...@@ -16,7 +16,9 @@ let server
let app let app
describe('Custom Document Fragment Styles', () => { describe('Custom Document Fragment Styles', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
app = nextServer({ app = nextServer({
...@@ -38,5 +40,6 @@ describe('Custom Document Fragment Styles', () => { ...@@ -38,5 +40,6 @@ describe('Custom Document Fragment Styles', () => {
expect(styles).toMatch(/background:(.*|)hotpink/) expect(styles).toMatch(/background:(.*|)hotpink/)
expect(styles).toMatch(/font-size:(.*|)16\.4px/) expect(styles).toMatch(/font-size:(.*|)16\.4px/)
}) })
}) }
)
}) })
import { nextBuild } from 'next-test-utils' import { nextBuild } from 'next-test-utils'
import { join } from 'path' import { join } from 'path'
describe('app-dynamic-error', () => { describe('app-dynamic-error', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('throws an error when prerendering a page with config dynamic error', async () => { it('throws an error when prerendering a page with config dynamic error', async () => {
const appDir = join(__dirname, '../../app-dynamic-error') const appDir = join(__dirname, '../../app-dynamic-error')
const { stderr, code } = await nextBuild(appDir, [], { const { stderr, code } = await nextBuild(appDir, [], {
...@@ -13,5 +15,6 @@ describe('app-dynamic-error', () => { ...@@ -13,5 +15,6 @@ describe('app-dynamic-error', () => {
) )
expect(code).toBe(1) expect(code).toBe(1)
}) })
}) }
)
}) })
...@@ -48,7 +48,7 @@ const runTests = () => { ...@@ -48,7 +48,7 @@ const runTests = () => {
} }
describe('AppTree', () => { describe('AppTree', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -56,7 +56,9 @@ describe('AppTree', () => { ...@@ -56,7 +56,9 @@ describe('AppTree', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -64,5 +66,6 @@ describe('AppTree', () => { ...@@ -64,5 +66,6 @@ describe('AppTree', () => {
}) })
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -7,7 +7,9 @@ import { nextBuild } from 'next-test-utils' ...@@ -7,7 +7,9 @@ import { nextBuild } from 'next-test-utils'
const appDir = __dirname const appDir = __dirname
describe('app type checking', () => { describe('app type checking', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
let stderr, errors let stderr, errors
beforeAll(async () => { beforeAll(async () => {
stderr = (await nextBuild(appDir, [], { stderr: true })).stderr stderr = (await nextBuild(appDir, [], { stderr: true })).stderr
...@@ -105,5 +107,6 @@ describe('app type checking', () => { ...@@ -105,5 +107,6 @@ describe('app type checking', () => {
`"Promise<boolean>" is not a valid generateStaticParams return type` `"Promise<boolean>" is not a valid generateStaticParams return type`
) )
}) })
}) }
)
}) })
...@@ -104,7 +104,7 @@ function runTests(dev = false) { ...@@ -104,7 +104,7 @@ function runTests(dev = false) {
} }
describe('Async modules', () => { describe('Async modules', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -115,7 +115,9 @@ describe('Async modules', () => { ...@@ -115,7 +115,9 @@ describe('Async modules', () => {
runTests(true) runTests(true)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -126,5 +128,6 @@ describe('Async modules', () => { ...@@ -126,5 +128,6 @@ describe('Async modules', () => {
}) })
runTests() runTests()
}) }
)
}) })
...@@ -30,7 +30,10 @@ const runTests = () => { ...@@ -30,7 +30,10 @@ const runTests = () => {
} }
describe('Auto Export _error bail', () => { describe('Auto Export _error bail', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
runTests() runTests()
}) }
)
}) })
...@@ -21,15 +21,22 @@ const runTests = () => { ...@@ -21,15 +21,22 @@ const runTests = () => {
} }
describe('Auto Export', () => { describe('Auto Export', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
const { stderr: curStderr, code: curCode } = await nextBuild(appDir, [], { const { stderr: curStderr, code: curCode } = await nextBuild(
appDir,
[],
{
stderr: true, stderr: true,
}) }
)
stderr = curStderr stderr = curStderr
exitCode = curCode exitCode = curCode
}) })
runTests() runTests()
}) }
)
}) })
...@@ -57,7 +57,9 @@ const runTests = () => { ...@@ -57,7 +57,9 @@ const runTests = () => {
} }
describe('Auto Export', () => { describe('Auto Export', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -69,7 +71,8 @@ describe('Auto Export', () => { ...@@ -69,7 +71,8 @@ describe('Auto Export', () => {
}) })
runTests() runTests()
}) }
)
describe('dev', () => { describe('dev', () => {
beforeAll(async () => { beforeAll(async () => {
......
...@@ -28,7 +28,7 @@ const runTests = () => { ...@@ -28,7 +28,7 @@ const runTests = () => {
} }
// Skip as it runs `next build`, seems that is a bug. // Skip as it runs `next build`, seems that is a bug.
;(process.env.TURBOPACK ? describe.skip : describe)('dev mode', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
// TODO: This look like a bug, `nextBuild` shouldn't be required here. // TODO: This look like a bug, `nextBuild` shouldn't be required here.
await nextBuild(appDir) await nextBuild(appDir)
...@@ -39,7 +39,9 @@ const runTests = () => { ...@@ -39,7 +39,9 @@ const runTests = () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
buildId = await fs.readFile(join(appDir, '.next/BUILD_ID'), 'utf8') buildId = await fs.readFile(join(appDir, '.next/BUILD_ID'), 'utf8')
...@@ -48,4 +50,5 @@ const runTests = () => { ...@@ -48,4 +50,5 @@ const runTests = () => {
}) })
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
...@@ -33,7 +33,7 @@ const runTests = () => { ...@@ -33,7 +33,7 @@ const runTests = () => {
} }
describe('bigint API route support', () => { describe('bigint API route support', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -42,7 +42,9 @@ describe('bigint API route support', () => { ...@@ -42,7 +42,9 @@ describe('bigint API route support', () => {
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await fs.remove(nextConfig) await fs.remove(nextConfig)
await nextBuild(appDir) await nextBuild(appDir)
...@@ -52,5 +54,6 @@ describe('bigint API route support', () => { ...@@ -52,5 +54,6 @@ describe('bigint API route support', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -10,7 +10,9 @@ const fixturesDir = join(__dirname, '..', 'fixtures') ...@@ -10,7 +10,9 @@ const fixturesDir = join(__dirname, '..', 'fixtures')
const nextConfig = new File(join(fixturesDir, 'basic-app/next.config.js')) const nextConfig = new File(join(fixturesDir, 'basic-app/next.config.js'))
describe('Build Output', () => { describe('Build Output', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const configs = [{}, { gzipSize: false }] const configs = [{}, { gzipSize: false }]
for (const experimental of configs) { for (const experimental of configs) {
...@@ -80,7 +82,9 @@ describe('Build Output', () => { ...@@ -80,7 +82,9 @@ describe('Build Output', () => {
const parseSharedSize = (sharedPartName) => { const parseSharedSize = (sharedPartName) => {
const matches = stdout.match( const matches = stdout.match(
new RegExp(`${sharedPartName} .*? ((?:\\d|\\.){1,} (?:\\w{1,}))`) new RegExp(
`${sharedPartName} .*? ((?:\\d|\\.){1,} (?:\\w{1,}))`
)
) )
if (!matches) { if (!matches) {
...@@ -140,15 +144,17 @@ describe('Build Output', () => { ...@@ -140,15 +144,17 @@ describe('Build Output', () => {
// ? parseFloat(_appSize) // ? parseFloat(_appSize)
// : parseFloat(_appSize) / 1000 // : parseFloat(_appSize) / 1000
// expect(appSizeValue).toBeCloseTo(gz ? 0.799 : 1.63, 1) // expect(appSizeValue).toBeCloseTo(gz ? 0.799 : 1.63, 1)
expect(_appSize.endsWith('kB') || _appSize.endsWith(' B')).toBe(true) expect(_appSize.endsWith('kB') || _appSize.endsWith(' B')).toBe(
true
)
// const webpackSizeValue = webpackSize.endsWith('kB') // const webpackSizeValue = webpackSize.endsWith('kB')
// ? parseFloat(webpackSize) // ? parseFloat(webpackSize)
// : parseFloat(webpackSize) / 1000 // : parseFloat(webpackSize) / 1000
// expect(webpackSizeValue).toBeCloseTo(gz ? 0.766 : 1.46, 2) // expect(webpackSizeValue).toBeCloseTo(gz ? 0.766 : 1.46, 2)
expect(webpackSize.endsWith('kB') || webpackSize.endsWith(' B')).toBe( expect(
true webpackSize.endsWith('kB') || webpackSize.endsWith(' B')
) ).toBe(true)
// expect(parseFloat(mainSize)).toBeCloseTo(gz ? 20.1 : 62.7, 1) // expect(parseFloat(mainSize)).toBeCloseTo(gz ? 20.1 : 62.7, 1)
expect(mainSize.endsWith('kB')).toBe(true) expect(mainSize.endsWith('kB')).toBe(true)
...@@ -305,5 +311,6 @@ describe('Build Output', () => { ...@@ -305,5 +311,6 @@ describe('Build Output', () => {
expect(stdout.match(/○ \/root-page /g).length).toBe(1) expect(stdout.match(/○ \/root-page /g).length).toBe(1)
}) })
}) })
}) }
)
}) })
...@@ -7,7 +7,9 @@ import { nextBuild } from 'next-test-utils' ...@@ -7,7 +7,9 @@ import { nextBuild } from 'next-test-utils'
const appDir = join(__dirname, '../app') const appDir = join(__dirname, '../app')
describe('build trace with extra entries', () => { describe('build trace with extra entries', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should build and trace correctly', async () => { it('should build and trace correctly', async () => {
const result = await nextBuild(appDir, undefined, { const result = await nextBuild(appDir, undefined, {
cwd: appDir, cwd: appDir,
...@@ -54,7 +56,9 @@ describe('build trace with extra entries', () => { ...@@ -54,7 +56,9 @@ describe('build trace with extra entries', () => {
...imageTrace.files, ...imageTrace.files,
] ]
expect(tracedFiles.some((file) => file.endsWith('hello.json'))).toBe(true) expect(tracedFiles.some((file) => file.endsWith('hello.json'))).toBe(
true
)
expect( expect(
tracedFiles.some((file) => file.includes('some-cms/index.js')) tracedFiles.some((file) => file.includes('some-cms/index.js'))
).toBe(true) ).toBe(true)
...@@ -64,9 +68,9 @@ describe('build trace with extra entries', () => { ...@@ -64,9 +68,9 @@ describe('build trace with extra entries', () => {
expect( expect(
tracedFiles.some((file) => file === '../../../include-me/second.txt') tracedFiles.some((file) => file === '../../../include-me/second.txt')
).toBe(true) ).toBe(true)
expect(indexTrace.files.some((file) => file.includes('exclude-me'))).toBe( expect(
false indexTrace.files.some((file) => file.includes('exclude-me'))
) ).toBe(false)
expect( expect(
tracedFiles.some((file) => tracedFiles.some((file) =>
...@@ -86,9 +90,10 @@ describe('build trace with extra entries', () => { ...@@ -86,9 +90,10 @@ describe('build trace with extra entries', () => {
expect( expect(
tracedFiles.some((file) => file.includes('public/another.jpg')) tracedFiles.some((file) => file.includes('public/another.jpg'))
).toBe(true) ).toBe(true)
expect(tracedFiles.some((file) => file.includes('public/test.jpg'))).toBe( expect(
false tracedFiles.some((file) => file.includes('public/test.jpg'))
) ).toBe(false)
})
}) })
}
)
}) })
...@@ -7,7 +7,9 @@ import { nextBuild } from 'next-test-utils' ...@@ -7,7 +7,9 @@ import { nextBuild } from 'next-test-utils'
const appDir = join(__dirname, '../app') const appDir = join(__dirname, '../app')
describe('build trace with extra entries', () => { describe('build trace with extra entries', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should build and trace correctly', async () => { it('should build and trace correctly', async () => {
const result = await nextBuild(appDir, undefined, { const result = await nextBuild(appDir, undefined, {
cwd: appDir, cwd: appDir,
...@@ -91,9 +93,9 @@ describe('build trace with extra entries', () => { ...@@ -91,9 +93,9 @@ describe('build trace with extra entries', () => {
(file) => file === '../../../include-me/second.txt' (file) => file === '../../../include-me/second.txt'
) )
).toBe(true) ).toBe(true)
expect(indexTrace.files.some((file) => file.includes('exclude-me'))).toBe( expect(
false indexTrace.files.some((file) => file.includes('exclude-me'))
) ).toBe(false)
expect( expect(
anotherTrace.files.some((file) => anotherTrace.files.some((file) =>
...@@ -117,5 +119,6 @@ describe('build trace with extra entries', () => { ...@@ -117,5 +119,6 @@ describe('build trace with extra entries', () => {
imageTrace.files.some((file) => file.includes('public/test.jpg')) imageTrace.files.some((file) => file.includes('public/test.jpg'))
).toBe(false) ).toBe(false)
}) })
}) }
)
}) })
...@@ -7,7 +7,9 @@ import { join } from 'path' ...@@ -7,7 +7,9 @@ import { join } from 'path'
const appDir = join(__dirname, '../') const appDir = join(__dirname, '../')
describe('Build warnings', () => { describe('Build warnings', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should not shown warning about minification without any modification', async () => { it('should not shown warning about minification without any modification', async () => {
const { stderr } = await nextBuild(appDir, undefined, { stderr: true }) const { stderr } = await nextBuild(appDir, undefined, { stderr: true })
expect(stderr).not.toContain('optimization has been disabled') expect(stderr).not.toContain('optimization has been disabled')
...@@ -87,5 +89,6 @@ describe('Build warnings', () => { ...@@ -87,5 +89,6 @@ describe('Build warnings', () => {
})) }))
expect(stdout).not.toContain('no-cache') expect(stdout).not.toContain('no-cache')
}) })
}) }
)
}) })
...@@ -14,7 +14,7 @@ const errorRegex = /getStaticPaths was added without a getStaticProps in/ ...@@ -14,7 +14,7 @@ const errorRegex = /getStaticPaths was added without a getStaticProps in/
describe('Catches Missing getStaticProps', () => { describe('Catches Missing getStaticProps', () => {
describe('development mode', () => { describe('development mode', () => {
it('should catch it in dev mode', async () => { it('should catch it in development mode', async () => {
const appPort = await findPort() const appPort = await findPort()
const app = await launchApp(appDir, appPort) const app = await launchApp(appDir, appPort)
const html = await renderViaHTTP(appPort, '/hello') const html = await renderViaHTTP(appPort, '/hello')
...@@ -23,12 +23,15 @@ describe('Catches Missing getStaticProps', () => { ...@@ -23,12 +23,15 @@ describe('Catches Missing getStaticProps', () => {
expect(html).toMatch(errorRegex) expect(html).toMatch(errorRegex)
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should catch it in server build mode', async () => { it('should catch it in server build mode', async () => {
const { stderr } = await nextBuild(appDir, [], { const { stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(stderr).toMatch(errorRegex) expect(stderr).toMatch(errorRegex)
}) })
}) }
)
}) })
...@@ -24,7 +24,9 @@ const existsChunkNamed = (name) => { ...@@ -24,7 +24,9 @@ const existsChunkNamed = (name) => {
// Skipped as it uses webpack internals / stats.json. // Skipped as it uses webpack internals / stats.json.
;(process.env.TURBOPACK ? describe.skip : describe)('Chunking', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('Chunking', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
try { try {
// If a previous build has left chunks behind, delete them // If a previous build has left chunks behind, delete them
...@@ -43,7 +45,9 @@ const existsChunkNamed = (name) => { ...@@ -43,7 +45,9 @@ const existsChunkNamed = (name) => {
stats = (await readFile(join(appDir, '.next', 'stats.json'), 'utf8')) stats = (await readFile(join(appDir, '.next', 'stats.json'), 'utf8'))
// fixes backslashes in keyNames not being escaped on windows // fixes backslashes in keyNames not being escaped on windows
.replace(/"static\\(.*?":?)/g, (match) => match.replace(/\\/g, '\\\\')) .replace(/"static\\(.*?":?)/g, (match) =>
match.replace(/\\/g, '\\\\')
)
stats = JSON.parse(stats) stats = JSON.parse(stats)
appPort = await findPort() appPort = await findPort()
...@@ -131,5 +135,6 @@ const existsChunkNamed = (name) => { ...@@ -131,5 +135,6 @@ const existsChunkNamed = (name) => {
await browser.close() await browser.close()
}) })
}) })
}) }
)
}) })
...@@ -29,7 +29,9 @@ const runTests = () => { ...@@ -29,7 +29,9 @@ const runTests = () => {
} }
describe('Cleaning distDir', () => { describe('Cleaning distDir', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
runTests() runTests()
describe('disabled write', () => { describe('disabled write', () => {
...@@ -52,5 +54,6 @@ describe('Cleaning distDir', () => { ...@@ -52,5 +54,6 @@ describe('Cleaning distDir', () => {
await checkFileWrite(true) await checkFileWrite(true)
}) })
}) })
}) }
)
}) })
...@@ -80,7 +80,9 @@ const testExitSignal = async ( ...@@ -80,7 +80,9 @@ const testExitSignal = async (
} }
describe('CLI Usage', () => { describe('CLI Usage', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
describe('start', () => { describe('start', () => {
test('should exit when SIGINT is signalled', async () => { test('should exit when SIGINT is signalled', async () => {
require('console').log('before build') require('console').log('before build')
...@@ -283,14 +285,18 @@ describe('CLI Usage', () => { ...@@ -283,14 +285,18 @@ describe('CLI Usage', () => {
const help = await runNextCommand(['telemetry', '--help'], { const help = await runNextCommand(['telemetry', '--help'], {
stdout: true, stdout: true,
}) })
expect(help.stdout).toMatch(/Allows you to enable or disable Next\.js'/) expect(help.stdout).toMatch(
/Allows you to enable or disable Next\.js'/
)
}) })
test('-h', async () => { test('-h', async () => {
const help = await runNextCommand(['telemetry', '-h'], { const help = await runNextCommand(['telemetry', '-h'], {
stdout: true, stdout: true,
}) })
expect(help.stdout).toMatch(/Allows you to enable or disable Next\.js'/) expect(help.stdout).toMatch(
/Allows you to enable or disable Next\.js'/
)
}) })
test('should warn when unknown argument provided', async () => { test('should warn when unknown argument provided', async () => {
...@@ -352,7 +358,8 @@ describe('CLI Usage', () => { ...@@ -352,7 +358,8 @@ describe('CLI Usage', () => {
) )
}) })
}) })
}) }
)
describe('no command', () => { describe('no command', () => {
test('--help', async () => { test('--help', async () => {
......
...@@ -23,7 +23,7 @@ const runTests = (isProd = false) => { ...@@ -23,7 +23,7 @@ const runTests = (isProd = false) => {
} }
describe('Client 404', () => { describe('Client 404', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
context.appPort = await findPort() context.appPort = await findPort()
context.server = await launchApp(appDir, context.appPort) context.server = await launchApp(appDir, context.appPort)
...@@ -35,7 +35,9 @@ describe('Client 404', () => { ...@@ -35,7 +35,9 @@ describe('Client 404', () => {
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
context.appPort = await findPort() context.appPort = await findPort()
...@@ -53,5 +55,6 @@ describe('Client 404', () => { ...@@ -53,5 +55,6 @@ describe('Client 404', () => {
afterAll(() => killApp(context.server)) afterAll(() => killApp(context.server))
runTests(true) runTests(true)
}) }
)
}) })
...@@ -88,7 +88,7 @@ const runTests = () => { ...@@ -88,7 +88,7 @@ const runTests = () => {
} }
describe('Client Shallow Routing', () => { describe('Client Shallow Routing', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -97,7 +97,9 @@ describe('Client Shallow Routing', () => { ...@@ -97,7 +97,9 @@ describe('Client Shallow Routing', () => {
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -106,5 +108,6 @@ describe('Client Shallow Routing', () => { ...@@ -106,5 +108,6 @@ describe('Client Shallow Routing', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -130,7 +130,9 @@ describe('Config Experimental Warning', () => { ...@@ -130,7 +130,9 @@ describe('Config Experimental Warning', () => {
expect(stdout).toContain(' · workerThreads') expect(stdout).toContain(' · workerThreads')
expect(stdout).toContain(' · scrollRestoration') expect(stdout).toContain(' · scrollRestoration')
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should not show next app info in next start', async () => { it('should not show next app info in next start', async () => {
configFile.write(` configFile.write(`
module.exports = { module.exports = {
...@@ -204,5 +206,6 @@ describe('Config Experimental Warning', () => { ...@@ -204,5 +206,6 @@ describe('Config Experimental Warning', () => {
) )
}) })
}) })
}) }
)
}) })
...@@ -7,7 +7,9 @@ import { nextBuild } from 'next-test-utils' ...@@ -7,7 +7,9 @@ import { nextBuild } from 'next-test-utils'
const appDir = join(__dirname, '..') const appDir = join(__dirname, '..')
describe('Promise in next config', () => { describe('Promise in next config', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
afterEach(() => fs.remove(join(appDir, 'next.config.js'))) afterEach(() => fs.remove(join(appDir, 'next.config.js')))
it('should warn when a promise is returned on webpack', async () => { it('should warn when a promise is returned on webpack', async () => {
...@@ -32,5 +34,6 @@ describe('Promise in next config', () => { ...@@ -32,5 +34,6 @@ describe('Promise in next config', () => {
/> Promise returned in next config\. https:\/\// /> Promise returned in next config\. https:\/\//
) )
}) })
}) }
)
}) })
...@@ -8,7 +8,9 @@ const nextConfigJS = join(appDir, 'next.config.js') ...@@ -8,7 +8,9 @@ const nextConfigJS = join(appDir, 'next.config.js')
const nextConfigMJS = join(appDir, 'next.config.mjs') const nextConfigMJS = join(appDir, 'next.config.mjs')
describe('Invalid config syntax', () => { describe('Invalid config syntax', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should error when next.config.js contains syntax error', async () => { it('should error when next.config.js contains syntax error', async () => {
await fs.writeFile( await fs.writeFile(
nextConfigJS, nextConfigJS,
...@@ -49,5 +51,6 @@ describe('Invalid config syntax', () => { ...@@ -49,5 +51,6 @@ describe('Invalid config syntax', () => {
) )
expect(stderr).toContain('SyntaxError') expect(stderr).toContain('SyntaxError')
}) })
}) }
)
}) })
...@@ -5,7 +5,9 @@ import fs from 'fs-extra' ...@@ -5,7 +5,9 @@ import fs from 'fs-extra'
const nextConfigPath = path.join(__dirname, '../next.config.js') const nextConfigPath = path.join(__dirname, '../next.config.js')
describe('next.config.js validation', () => { describe('next.config.js validation', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it.each([ it.each([
{ {
name: 'invalid config types', name: 'invalid config types',
...@@ -43,10 +45,14 @@ describe('next.config.js validation', () => { ...@@ -43,10 +45,14 @@ describe('next.config.js validation', () => {
'it should validate correctly for $name', 'it should validate correctly for $name',
async ({ outputs, configContent }) => { async ({ outputs, configContent }) => {
await fs.writeFile(nextConfigPath, configContent) await fs.writeFile(nextConfigPath, configContent)
const result = await nextBuild(path.join(__dirname, '../'), undefined, { const result = await nextBuild(
path.join(__dirname, '../'),
undefined,
{
stderr: true, stderr: true,
stdout: true, stdout: true,
}) }
)
await fs.remove(nextConfigPath) await fs.remove(nextConfigPath)
for (const output of outputs) { for (const output of outputs) {
...@@ -77,5 +83,6 @@ describe('next.config.js validation', () => { ...@@ -77,5 +83,6 @@ describe('next.config.js validation', () => {
'"env.QUX" is missing' '"env.QUX" is missing'
) )
}) })
}) }
)
}) })
...@@ -27,7 +27,9 @@ describe('Errors on conflict between public file and page file', () => { ...@@ -27,7 +27,9 @@ describe('Errors on conflict between public file and page file', () => {
await killApp(app) await killApp(app)
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('Throws error during build', async () => { it('Throws error during build', async () => {
const conflicts = ['/another/conflict', '/another', '/hello'] const conflicts = ['/another/conflict', '/another', '/hello']
const results = await nextBuild(appDir, [], { const results = await nextBuild(appDir, [], {
...@@ -41,5 +43,6 @@ describe('Errors on conflict between public file and page file', () => { ...@@ -41,5 +43,6 @@ describe('Errors on conflict between public file and page file', () => {
expect(output.indexOf(conflict) > 0).toBe(true) expect(output.indexOf(conflict) > 0).toBe(true)
} }
}) })
}) }
)
}) })
...@@ -8,7 +8,9 @@ const appDir = join(__dirname, '../') ...@@ -8,7 +8,9 @@ const appDir = join(__dirname, '../')
const pagesDir = join(appDir, 'pages') const pagesDir = join(appDir, 'pages')
describe('Conflicting SSG paths', () => { describe('Conflicting SSG paths', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
afterEach(() => fs.remove(pagesDir)) afterEach(() => fs.remove(pagesDir))
it('should show proper error when two dynamic SSG routes have conflicting paths', async () => { it('should show proper error when two dynamic SSG routes have conflicting paths', async () => {
...@@ -185,5 +187,6 @@ describe('Conflicting SSG paths', () => { ...@@ -185,5 +187,6 @@ describe('Conflicting SSG paths', () => {
`path: "/hellO/world" from page: "/[...catchAll]" conflicts with path: "/hello/world"` `path: "/hellO/world" from page: "/[...catchAll]" conflicts with path: "/hello/world"`
) )
}) })
}) }
)
}) })
...@@ -57,7 +57,9 @@ function runTests() { ...@@ -57,7 +57,9 @@ function runTests() {
} }
describe('CSS optimization for SSR apps', () => { describe('CSS optimization for SSR apps', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await fs.writeFile( await fs.writeFile(
nextConfig, nextConfig,
...@@ -77,5 +79,6 @@ describe('CSS optimization for SSR apps', () => { ...@@ -77,5 +79,6 @@ describe('CSS optimization for SSR apps', () => {
await fs.remove(nextConfig) await fs.remove(nextConfig)
}) })
runTests() runTests()
}) }
)
}) })
...@@ -150,7 +150,9 @@ function runTests(dev) { ...@@ -150,7 +150,9 @@ function runTests(dev) {
} }
describe('CSS Module client-side navigation', () => { describe('CSS Module client-side navigation', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? 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)
...@@ -218,7 +220,8 @@ describe('CSS Module client-side navigation', () => { ...@@ -218,7 +220,8 @@ describe('CSS Module client-side navigation', () => {
}) })
runTests() runTests()
}) }
)
describe('dev', () => { describe('dev', () => {
beforeAll(async () => { beforeAll(async () => {
......
...@@ -8,7 +8,9 @@ import escapeStringRegexp from 'escape-string-regexp' ...@@ -8,7 +8,9 @@ import escapeStringRegexp from 'escape-string-regexp'
const fixturesDir = join(__dirname, '../..', 'css-fixtures') const fixturesDir = join(__dirname, '../..', 'css-fixtures')
describe('CSS Customization', () => { describe('CSS Customization', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'custom-configuration') const appDir = join(fixturesDir, 'custom-configuration')
beforeAll(async () => { beforeAll(async () => {
...@@ -31,7 +33,10 @@ describe('CSS Customization', () => { ...@@ -31,7 +33,10 @@ describe('CSS Customization', () => {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8') const cssContent = await readFile(
join(cssFolder, cssFiles[0]),
'utf8'
)
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot( ).toMatchInlineSnapshot(
...@@ -39,7 +44,9 @@ describe('CSS Customization', () => { ...@@ -39,7 +44,9 @@ describe('CSS Customization', () => {
) )
// Contains a source map // Contains a source map
expect(cssContent).toMatch(/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//) expect(cssContent).toMatch(
/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//
)
}) })
it(`should've emitted a source map`, async () => { it(`should've emitted a source map`, async () => {
...@@ -53,7 +60,8 @@ describe('CSS Customization', () => { ...@@ -53,7 +60,8 @@ describe('CSS Customization', () => {
await readFile(join(cssFolder, cssMapFiles[0]), 'utf8') await readFile(join(cssFolder, cssMapFiles[0]), 'utf8')
).trim() ).trim()
const { version, mappings, sourcesContent } = JSON.parse(cssMapContent) const { version, mappings, sourcesContent } =
JSON.parse(cssMapContent)
expect({ version, mappings, sourcesContent }).toMatchInlineSnapshot(` expect({ version, mappings, sourcesContent }).toMatchInlineSnapshot(`
{ {
"mappings": "AACA,gCACE,cACE,WACF,CACF,CAGA,OACE,eAA0B,CAA1B,gBACF", "mappings": "AACA,gCACE,cACE,WACF,CACF,CAGA,OACE,eAA0B,CAA1B,gBACF",
...@@ -99,7 +107,10 @@ describe('CSS Customization', () => { ...@@ -99,7 +107,10 @@ describe('CSS Customization', () => {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8') const cssContent = await readFile(
join(cssFolder, cssFiles[0]),
'utf8'
)
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot( ).toMatchInlineSnapshot(
...@@ -107,7 +118,9 @@ describe('CSS Customization', () => { ...@@ -107,7 +118,9 @@ describe('CSS Customization', () => {
) )
// Contains a source map // Contains a source map
expect(cssContent).toMatch(/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//) expect(cssContent).toMatch(
/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//
)
}) })
it(`should've emitted a source map`, async () => { it(`should've emitted a source map`, async () => {
...@@ -121,7 +134,8 @@ describe('CSS Customization', () => { ...@@ -121,7 +134,8 @@ describe('CSS Customization', () => {
await readFile(join(cssFolder, cssMapFiles[0]), 'utf8') await readFile(join(cssFolder, cssMapFiles[0]), 'utf8')
).trim() ).trim()
const { version, mappings, sourcesContent } = JSON.parse(cssMapContent) const { version, mappings, sourcesContent } =
JSON.parse(cssMapContent)
expect({ version, mappings, sourcesContent }).toMatchInlineSnapshot(` expect({ version, mappings, sourcesContent }).toMatchInlineSnapshot(`
{ {
"mappings": "AACA,gCACE,SACE,UACF,CACA,cACE,WACF,CACF,CAGA,OACE,gBAA4B,CAA5B,iBAA4B,CAA5B,gBAA4B,CAA5B,iBACF", "mappings": "AACA,gCACE,SACE,UACF,CACA,cACE,WACF,CACF,CAGA,OACE,gBAA4B,CAA5B,iBAA4B,CAA5B,gBAA4B,CAA5B,iBACF",
...@@ -214,13 +228,18 @@ describe('CSS Customization', () => { ...@@ -214,13 +228,18 @@ describe('CSS Customization', () => {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8') const cssContent = await readFile(
join(cssFolder, cssFiles[0]),
'utf8'
)
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".video{max-width:400px;max-height:300px}"`) ).toMatchInlineSnapshot(`".video{max-width:400px;max-height:300px}"`)
// Contains a source map // Contains a source map
expect(cssContent).toMatch(/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//) expect(cssContent).toMatch(
/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//
)
}) })
it(`should've emitted a source map`, async () => { it(`should've emitted a source map`, async () => {
...@@ -386,5 +405,6 @@ describe('CSS Customization', () => { ...@@ -386,5 +405,6 @@ describe('CSS Customization', () => {
expect(stderr).toMatch(/Build failed because of webpack errors/) expect(stderr).toMatch(/Build failed because of webpack errors/)
}) })
}) })
}) }
)
}) })
...@@ -7,7 +7,9 @@ import { join } from 'path' ...@@ -7,7 +7,9 @@ import { join } from 'path'
const fixturesDir = join(__dirname, '../fixtures') const fixturesDir = join(__dirname, '../fixtures')
describe('Browserslist: Old', () => { describe('Browserslist: Old', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'browsers-old') const appDir = join(fixturesDir, 'browsers-old')
let stdout let stdout
...@@ -39,11 +41,14 @@ describe('Browserslist: Old', () => { ...@@ -39,11 +41,14 @@ describe('Browserslist: Old', () => {
`"a{-webkit-animation:none 0s ease 0s 1 normal none running;animation:none 0s ease 0s 1 normal none running;-webkit-backface-visibility:visible;backface-visibility:visible;background:transparent none repeat 0 0/auto auto padding-box border-box scroll;border:none;border-collapse:separate;-webkit-border-image:none;border-image:none;-webkit-border-radius:0;border-radius:0;border-spacing:0;bottom:auto;-webkit-box-shadow:none;box-shadow:none;-webkit-box-sizing:content-box;box-sizing:content-box;caption-side:top;clear:none;clip:auto;color:#000;-webkit-columns:auto;-webkit-column-count:auto;-webkit-column-fill:balance;column-fill:balance;-webkit-column-gap:normal;column-gap:normal;-webkit-column-rule:medium none currentColor;column-rule:medium none currentColor;-webkit-column-span:1;column-span:1;-webkit-column-width:auto;columns:auto;content:normal;counter-increment:none;counter-reset:none;cursor:auto;direction:ltr;display:inline;empty-cells:show;float:none;font-family:serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;line-height:normal;height:auto;-ms-hyphens:none;hyphens:none;left:auto;letter-spacing:normal;list-style:disc none outside;margin:0;max-height:none;max-width:none;min-height:0;min-width:0;opacity:1;orphans:2;outline:medium none invert;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;-webkit-perspective:none;perspective:none;-webkit-perspective-origin:50% 50%;perspective-origin:50% 50%;position:static;right:auto;tab-size:8;table-layout:auto;text-align:left;text-align-last:auto;text-decoration:none;text-indent:0;text-shadow:none;text-transform:none;top:auto;-webkit-transform:none;transform:none;-webkit-transform-origin:50% 50% 0;transform-origin:50% 50% 0;-webkit-transform-style:flat;transform-style:flat;-webkit-transition:none 0s ease 0s;transition:none 0s ease 0s;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:2;width:auto;word-spacing:normal;z-index:auto;all:initial}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:2dppx){.image{background-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)}}"` `"a{-webkit-animation:none 0s ease 0s 1 normal none running;animation:none 0s ease 0s 1 normal none running;-webkit-backface-visibility:visible;backface-visibility:visible;background:transparent none repeat 0 0/auto auto padding-box border-box scroll;border:none;border-collapse:separate;-webkit-border-image:none;border-image:none;-webkit-border-radius:0;border-radius:0;border-spacing:0;bottom:auto;-webkit-box-shadow:none;box-shadow:none;-webkit-box-sizing:content-box;box-sizing:content-box;caption-side:top;clear:none;clip:auto;color:#000;-webkit-columns:auto;-webkit-column-count:auto;-webkit-column-fill:balance;column-fill:balance;-webkit-column-gap:normal;column-gap:normal;-webkit-column-rule:medium none currentColor;column-rule:medium none currentColor;-webkit-column-span:1;column-span:1;-webkit-column-width:auto;columns:auto;content:normal;counter-increment:none;counter-reset:none;cursor:auto;direction:ltr;display:inline;empty-cells:show;float:none;font-family:serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;line-height:normal;height:auto;-ms-hyphens:none;hyphens:none;left:auto;letter-spacing:normal;list-style:disc none outside;margin:0;max-height:none;max-width:none;min-height:0;min-width:0;opacity:1;orphans:2;outline:medium none invert;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;-webkit-perspective:none;perspective:none;-webkit-perspective-origin:50% 50%;perspective-origin:50% 50%;position:static;right:auto;tab-size:8;table-layout:auto;text-align:left;text-align-last:auto;text-decoration:none;text-indent:0;text-shadow:none;text-transform:none;top:auto;-webkit-transform:none;transform:none;-webkit-transform-origin:50% 50% 0;transform-origin:50% 50% 0;-webkit-transform-style:flat;transform-style:flat;-webkit-transition:none 0s ease 0s;transition:none 0s ease 0s;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:2;width:auto;word-spacing:normal;z-index:auto;all:initial}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:2dppx){.image{background-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)}}"`
) )
}) })
}) }
)
}) })
describe('Browserslist: New', () => { describe('Browserslist: New', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'browsers-new') const appDir = join(fixturesDir, 'browsers-new')
let stdout let stdout
...@@ -75,5 +80,6 @@ describe('Browserslist: New', () => { ...@@ -75,5 +80,6 @@ describe('Browserslist: New', () => {
`"a{all:initial}@media (min-resolution:2dppx){.image{background-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)}}"` `"a{all:initial}@media (min-resolution:2dppx){.image{background-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)}}"`
) )
}) })
}) }
)
}) })
...@@ -7,7 +7,9 @@ import { join } from 'path' ...@@ -7,7 +7,9 @@ import { join } from 'path'
const fixturesDir = join(__dirname, '../fixtures') const fixturesDir = join(__dirname, '../fixtures')
describe('Custom Properties: Fail for :root {} in CSS Modules', () => { describe('Custom Properties: Fail for :root {} in CSS Modules', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'cp-global-modules') const appDir = join(fixturesDir, 'cp-global-modules')
beforeAll(async () => { beforeAll(async () => {
...@@ -23,11 +25,14 @@ describe('Custom Properties: Fail for :root {} in CSS Modules', () => { ...@@ -23,11 +25,14 @@ describe('Custom Properties: Fail for :root {} in CSS Modules', () => {
expect(stderr).toContain('pages/styles.module.css') expect(stderr).toContain('pages/styles.module.css')
expect(stderr).toContain('Selector ":root" is not pure') expect(stderr).toContain('Selector ":root" is not pure')
}) })
}) }
)
}) })
describe('Custom Properties: Fail for global element in CSS Modules', () => { describe('Custom Properties: Fail for global element in CSS Modules', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'cp-el-modules') const appDir = join(fixturesDir, 'cp-el-modules')
beforeAll(async () => { beforeAll(async () => {
...@@ -43,11 +48,14 @@ describe('Custom Properties: Fail for global element in CSS Modules', () => { ...@@ -43,11 +48,14 @@ describe('Custom Properties: Fail for global element in CSS Modules', () => {
expect(stderr).toContain('pages/styles.module.css') expect(stderr).toContain('pages/styles.module.css')
expect(stderr).toContain('Selector "h1" is not pure') expect(stderr).toContain('Selector "h1" is not pure')
}) })
}) }
)
}) })
describe('CSS Modules: Import Global CSS', () => { describe('CSS Modules: Import Global CSS', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'module-import-global') const appDir = join(fixturesDir, 'module-import-global')
let stdout let stdout
...@@ -77,11 +85,14 @@ describe('CSS Modules: Import Global CSS', () => { ...@@ -77,11 +85,14 @@ describe('CSS Modules: Import Global CSS', () => {
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`"a .styles_foo__G5630{all:initial}"`) ).toMatchInlineSnapshot(`"a .styles_foo__G5630{all:initial}"`)
}) })
}) }
)
}) })
describe('CSS Modules: Importing Invalid Global CSS', () => { describe('CSS Modules: Importing Invalid Global CSS', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'module-import-global-invalid') const appDir = join(fixturesDir, 'module-import-global-invalid')
beforeAll(async () => { beforeAll(async () => {
...@@ -97,11 +108,14 @@ describe('CSS Modules: Importing Invalid Global CSS', () => { ...@@ -97,11 +108,14 @@ describe('CSS Modules: Importing Invalid Global CSS', () => {
expect(stderr).toContain('pages/styles.css') expect(stderr).toContain('pages/styles.css')
expect(stderr).toContain('Selector "a" is not pure') expect(stderr).toContain('Selector "a" is not pure')
}) })
}) }
)
}) })
describe('CSS Modules: Import Exports', () => { describe('CSS Modules: Import Exports', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'module-import-exports') const appDir = join(fixturesDir, 'module-import-exports')
let stdout let stdout
...@@ -131,5 +145,6 @@ describe('CSS Modules: Import Exports', () => { ...@@ -131,5 +145,6 @@ describe('CSS Modules: Import Exports', () => {
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".styles_blk__480DC{color:#000}"`) ).toMatchInlineSnapshot(`".styles_blk__480DC{color:#000}"`)
}) })
}) }
)
}) })
...@@ -7,7 +7,9 @@ import { join } from 'path' ...@@ -7,7 +7,9 @@ import { join } from 'path'
const fixturesDir = join(__dirname, '../fixtures') const fixturesDir = join(__dirname, '../fixtures')
describe('Custom Properties: Pass-Through IE11', () => { describe('Custom Properties: Pass-Through IE11', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'cp-ie-11') const appDir = join(fixturesDir, 'cp-ie-11')
let stdout let stdout
...@@ -37,11 +39,14 @@ describe('Custom Properties: Pass-Through IE11', () => { ...@@ -37,11 +39,14 @@ describe('Custom Properties: Pass-Through IE11', () => {
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`":root{--color:red}h1{color:var(--color)}"`) ).toMatchInlineSnapshot(`":root{--color:red}h1{color:var(--color)}"`)
}) })
}) }
)
}) })
describe('Custom Properties: Pass-Through Modern', () => { describe('Custom Properties: Pass-Through Modern', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'cp-modern') const appDir = join(fixturesDir, 'cp-modern')
let stdout let stdout
...@@ -71,11 +76,14 @@ describe('Custom Properties: Pass-Through Modern', () => { ...@@ -71,11 +76,14 @@ describe('Custom Properties: Pass-Through Modern', () => {
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`":root{--color:red}h1{color:var(--color)}"`) ).toMatchInlineSnapshot(`":root{--color:red}h1{color:var(--color)}"`)
}) })
}) }
)
}) })
describe('Inline Comments: Minify', () => { describe('Inline Comments: Minify', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'inline-comments') const appDir = join(fixturesDir, 'inline-comments')
let stdout let stdout
...@@ -105,5 +113,6 @@ describe('Inline Comments: Minify', () => { ...@@ -105,5 +113,6 @@ describe('Inline Comments: Minify', () => {
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`"*{box-sizing:border-box}"`) ).toMatchInlineSnapshot(`"*{box-sizing:border-box}"`)
}) })
}) }
)
}) })
...@@ -28,7 +28,9 @@ function runTests() { ...@@ -28,7 +28,9 @@ function runTests() {
} }
describe('css-minify', () => { describe('css-minify', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -38,5 +40,6 @@ describe('css-minify', () => { ...@@ -38,5 +40,6 @@ describe('css-minify', () => {
await killApp(app) await killApp(app)
}) })
runTests() runTests()
}) }
)
}) })
...@@ -18,7 +18,9 @@ import { join } from 'path' ...@@ -18,7 +18,9 @@ import { join } from 'path'
const fixturesDir = join(__dirname, '../../css-fixtures') const fixturesDir = join(__dirname, '../../css-fixtures')
describe('Basic CSS Module Support', () => { describe('Basic CSS Module Support', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'basic-module') const appDir = join(fixturesDir, 'basic-module')
let appPort let appPort
...@@ -63,7 +65,9 @@ describe('Basic CSS Module Support', () => { ...@@ -63,7 +65,9 @@ describe('Basic CSS Module Support', () => {
const cssPreload = $('link[rel="preload"][as="style"]') const cssPreload = $('link[rel="preload"][as="style"]')
expect(cssPreload.length).toBe(1) expect(cssPreload.length).toBe(1)
expect(cssPreload.attr('href')).toMatch(/^\/_next\/static\/css\/.*\.css$/) expect(cssPreload.attr('href')).toMatch(
/^\/_next\/static\/css\/.*\.css$/
)
const cssSheet = $('link[rel="stylesheet"]') const cssSheet = $('link[rel="stylesheet"]')
expect(cssSheet.length).toBe(1) expect(cssSheet.length).toBe(1)
...@@ -73,11 +77,14 @@ describe('Basic CSS Module Support', () => { ...@@ -73,11 +77,14 @@ describe('Basic CSS Module Support', () => {
`"index_redText__honUV"` `"index_redText__honUV"`
) )
}) })
}) }
)
}) })
describe('3rd Party CSS Module Support', () => { describe('3rd Party CSS Module Support', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, '3rd-party-module') const appDir = join(fixturesDir, '3rd-party-module')
let appPort let appPort
...@@ -123,7 +130,9 @@ describe('3rd Party CSS Module Support', () => { ...@@ -123,7 +130,9 @@ describe('3rd Party CSS Module Support', () => {
const cssPreload = $('link[rel="preload"][as="style"]') const cssPreload = $('link[rel="preload"][as="style"]')
expect(cssPreload.length).toBe(1) expect(cssPreload.length).toBe(1)
expect(cssPreload.attr('href')).toMatch(/^\/_next\/static\/css\/.*\.css$/) expect(cssPreload.attr('href')).toMatch(
/^\/_next\/static\/css\/.*\.css$/
)
const cssSheet = $('link[rel="stylesheet"]') const cssSheet = $('link[rel="stylesheet"]')
expect(cssSheet.length).toBe(1) expect(cssSheet.length).toBe(1)
...@@ -133,7 +142,8 @@ describe('3rd Party CSS Module Support', () => { ...@@ -133,7 +142,8 @@ describe('3rd Party CSS Module Support', () => {
`"index_foo__6TgnK"` `"index_foo__6TgnK"`
) )
}) })
}) }
)
}) })
describe('Has CSS Module in computed styles in Development', () => { describe('Has CSS Module in computed styles in Development', () => {
...@@ -161,7 +171,9 @@ describe('Has CSS Module in computed styles in Development', () => { ...@@ -161,7 +171,9 @@ describe('Has CSS Module in computed styles in Development', () => {
}) })
describe('Has CSS Module in computed styles in Production', () => { describe('Has CSS Module in computed styles in Production', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'prod-module') const appDir = join(fixturesDir, 'prod-module')
let appPort let appPort
...@@ -193,7 +205,8 @@ describe('Has CSS Module in computed styles in Production', () => { ...@@ -193,7 +205,8 @@ describe('Has CSS Module in computed styles in Production', () => {
) )
expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`) expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`)
}) })
}) }
)
}) })
describe('Can hot reload CSS Module without losing state', () => { describe('Can hot reload CSS Module without losing state', () => {
...@@ -243,7 +256,9 @@ describe('Can hot reload CSS Module without losing state', () => { ...@@ -243,7 +256,9 @@ describe('Can hot reload CSS Module without losing state', () => {
}) })
describe.skip('Invalid CSS Module Usage in node_modules', () => { describe.skip('Invalid CSS Module Usage in node_modules', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'invalid-module') const appDir = join(fixturesDir, 'invalid-module')
beforeAll(async () => { beforeAll(async () => {
...@@ -264,11 +279,14 @@ describe.skip('Invalid CSS Module Usage in node_modules', () => { ...@@ -264,11 +279,14 @@ describe.skip('Invalid CSS Module Usage in node_modules', () => {
/Location:.*node_modules[\\/]example[\\/]index\.mjs/ /Location:.*node_modules[\\/]example[\\/]index\.mjs/
) )
}) })
}) }
)
}) })
describe.skip('Invalid Global CSS Module Usage in node_modules', () => { describe.skip('Invalid Global CSS Module Usage in node_modules', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'invalid-global-module') const appDir = join(fixturesDir, 'invalid-global-module')
beforeAll(async () => { beforeAll(async () => {
...@@ -289,11 +307,14 @@ describe.skip('Invalid Global CSS Module Usage in node_modules', () => { ...@@ -289,11 +307,14 @@ describe.skip('Invalid Global CSS Module Usage in node_modules', () => {
/Location:.*node_modules[\\/]example[\\/]index\.mjs/ /Location:.*node_modules[\\/]example[\\/]index\.mjs/
) )
}) })
}) }
)
}) })
describe('Valid CSS Module Usage from within node_modules', () => { describe('Valid CSS Module Usage from within node_modules', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'nm-module') const appDir = join(fixturesDir, 'nm-module')
beforeAll(async () => { beforeAll(async () => {
...@@ -344,11 +365,14 @@ describe('Valid CSS Module Usage from within node_modules', () => { ...@@ -344,11 +365,14 @@ describe('Valid CSS Module Usage from within node_modules', () => {
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".example_redText__0ctGB{color:red}"`) ).toMatchInlineSnapshot(`".example_redText__0ctGB{color:red}"`)
}) })
}) }
)
}) })
describe('Valid Nested CSS Module Usage from within node_modules', () => { describe('Valid Nested CSS Module Usage from within node_modules', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'nm-module-nested') const appDir = join(fixturesDir, 'nm-module-nested')
beforeAll(async () => { beforeAll(async () => {
...@@ -401,11 +425,14 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => { ...@@ -401,11 +425,14 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => {
`".other2_other2__dYPgz{color:red}.other3_other3__7hgUE{color:violet}.other_className__OA8dV{background:red;color:#ff0}.example_subClass__m6Tyy{background:blue}"` `".other2_other2__dYPgz{color:red}.other3_other3__7hgUE{color:violet}.other_className__OA8dV{background:red;color:#ff0}.example_subClass__m6Tyy{background:blue}"`
) )
}) })
}) }
)
}) })
describe('CSS Module Composes Usage (Basic)', () => { describe('CSS Module Composes Usage (Basic)', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
// This is a very bad feature. Do not use it. // This is a very bad feature. Do not use it.
const appDir = join(fixturesDir, 'composes-basic') const appDir = join(fixturesDir, 'composes-basic')
...@@ -438,11 +465,14 @@ describe('CSS Module Composes Usage (Basic)', () => { ...@@ -438,11 +465,14 @@ describe('CSS Module Composes Usage (Basic)', () => {
`".index_className__jjcZ1{background:red;color:#ff0}.index_subClass__eDzaW{background:blue}"` `".index_className__jjcZ1{background:red;color:#ff0}.index_subClass__eDzaW{background:blue}"`
) )
}) })
}) }
)
}) })
describe('CSS Module Composes Usage (External)', () => { describe('CSS Module Composes Usage (External)', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
// This is a very bad feature. Do not use it. // This is a very bad feature. Do not use it.
const appDir = join(fixturesDir, 'composes-external') const appDir = join(fixturesDir, 'composes-external')
...@@ -475,11 +505,14 @@ describe('CSS Module Composes Usage (External)', () => { ...@@ -475,11 +505,14 @@ describe('CSS Module Composes Usage (External)', () => {
`".other_className__eZV4M{background:red;color:#ff0}.index_subClass__eDzaW{background:blue}"` `".other_className__eZV4M{background:red;color:#ff0}.index_subClass__eDzaW{background:blue}"`
) )
}) })
}) }
)
}) })
describe('Dynamic Route CSS Module Usage', () => { describe('Dynamic Route CSS Module Usage', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'dynamic-route-module') const appDir = join(fixturesDir, 'dynamic-route-module')
let stdout let stdout
...@@ -525,11 +558,14 @@ describe('Dynamic Route CSS Module Usage', () => { ...@@ -525,11 +558,14 @@ describe('Dynamic Route CSS Module Usage', () => {
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`"._post__home__yRmHz{background:red}"`) ).toMatchInlineSnapshot(`"._post__home__yRmHz{background:red}"`)
}) })
}) }
)
}) })
describe('Catch-all Route CSS Module Usage', () => { describe('Catch-all Route CSS Module Usage', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'catch-all-module') const appDir = join(fixturesDir, 'catch-all-module')
let stdout let stdout
...@@ -579,5 +615,6 @@ describe('Catch-all Route CSS Module Usage', () => { ...@@ -579,5 +615,6 @@ describe('Catch-all Route CSS Module Usage', () => {
`".___post__home__e4zfx{background:red}.__55css_home__r8Rnq{color:green}"` `".___post__home__e4zfx{background:red}.__55css_home__r8Rnq{color:green}"`
) )
}) })
}) }
)
}) })
...@@ -6,7 +6,9 @@ import { join } from 'path' ...@@ -6,7 +6,9 @@ import { join } from 'path'
const fixturesDir = join(__dirname, '../..', 'css-fixtures') const fixturesDir = join(__dirname, '../..', 'css-fixtures')
describe('Basic Global Support', () => { describe('Basic Global Support', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'single-global') const appDir = join(fixturesDir, 'single-global')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
...@@ -43,17 +45,24 @@ module.exports = { ...@@ -43,17 +45,24 @@ module.exports = {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
expect(await readFile(join(cssFolder, cssFiles[0]), 'utf8')).toContain( expect(
'color:red' await readFile(join(cssFolder, cssFiles[0]), 'utf8')
) ).toContain('color:red')
})
}) })
}) })
}
)
}) })
describe('Basic Global Support with special characters in path', () => { describe('Basic Global Support with special characters in path', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
const appDir = join(fixturesDir, 'single-global-special-characters', 'a+b') 'production mode',
() => {
const appDir = join(
fixturesDir,
'single-global-special-characters',
'a+b'
)
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => { describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => {
...@@ -89,16 +98,19 @@ module.exports = { ...@@ -89,16 +98,19 @@ module.exports = {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
expect(await readFile(join(cssFolder, cssFiles[0]), 'utf8')).toContain( expect(
'color:red' await readFile(join(cssFolder, cssFiles[0]), 'utf8')
) ).toContain('color:red')
})
}) })
}) })
}
)
}) })
describe('Basic Global Support with src/ dir', () => { describe('Basic Global Support with src/ dir', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'single-global-src') const appDir = join(fixturesDir, 'single-global-src')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
...@@ -135,16 +147,19 @@ module.exports = { ...@@ -135,16 +147,19 @@ module.exports = {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
expect(await readFile(join(cssFolder, cssFiles[0]), 'utf8')).toContain( expect(
'color:red' await readFile(join(cssFolder, cssFiles[0]), 'utf8')
) ).toContain('color:red')
})
}) })
}) })
}
)
}) })
describe('Multi Global Support', () => { describe('Multi Global Support', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'multi-global') const appDir = join(fixturesDir, 'multi-global')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
...@@ -181,15 +196,23 @@ module.exports = { ...@@ -181,15 +196,23 @@ module.exports = {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8') const cssContent = await readFile(
expect(cssContent.replace(/\/\*.*?\*\//g, '').trim()).toMatchSnapshot() join(cssFolder, cssFiles[0]),
}) 'utf8'
)
expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchSnapshot()
}) })
}) })
}
)
}) })
describe('Nested @import() Global Support', () => { describe('Nested @import() Global Support', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'nested-global') const appDir = join(fixturesDir, 'nested-global')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
...@@ -226,16 +249,24 @@ module.exports = { ...@@ -226,16 +249,24 @@ module.exports = {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8') const cssContent = await readFile(
expect(cssContent.replace(/\/\*.*?\*\//g, '').trim()).toMatchSnapshot() join(cssFolder, cssFiles[0]),
}) 'utf8'
)
expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchSnapshot()
}) })
}) })
}
)
}) })
// Tests css ordering // Tests css ordering
describe('Multi Global Support (reversed)', () => { describe('Multi Global Support (reversed)', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'multi-global-reversed') const appDir = join(fixturesDir, 'multi-global-reversed')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
...@@ -272,15 +303,23 @@ module.exports = { ...@@ -272,15 +303,23 @@ module.exports = {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8') const cssContent = await readFile(
expect(cssContent.replace(/\/\*.*?\*\//g, '').trim()).toMatchSnapshot() join(cssFolder, cssFiles[0]),
}) 'utf8'
)
expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchSnapshot()
}) })
}) })
}
)
}) })
describe('CSS URL via `file-loader`', () => { describe('CSS URL via `file-loader`', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'url-global') const appDir = join(fixturesDir, 'url-global')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
...@@ -318,8 +357,13 @@ module.exports = { ...@@ -318,8 +357,13 @@ module.exports = {
const cssFiles = files.filter((f) => /\.css$/.test(f)) const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1) expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8') const cssContent = await readFile(
expect(cssContent.replace(/\/\*.*?\*\//g, '').trim()).toMatchSnapshot() join(cssFolder, cssFiles[0]),
'utf8'
)
expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchSnapshot()
const mediaFiles = await readdir(mediaFolder) const mediaFiles = await readdir(mediaFolder)
expect(mediaFiles.length).toBe(3) expect(mediaFiles.length).toBe(3)
...@@ -338,11 +382,14 @@ module.exports = { ...@@ -338,11 +382,14 @@ module.exports = {
`) `)
}) })
}) })
}) }
)
}) })
describe('CSS URL via `file-loader` and asset prefix (1)', () => { describe('CSS URL via `file-loader` and asset prefix (1)', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'url-global-asset-prefix-1') const appDir = join(fixturesDir, 'url-global-asset-prefix-1')
beforeAll(async () => { beforeAll(async () => {
...@@ -386,11 +433,14 @@ describe('CSS URL via `file-loader` and asset prefix (1)', () => { ...@@ -386,11 +433,14 @@ describe('CSS URL via `file-loader` and asset prefix (1)', () => {
] ]
`) `)
}) })
}) }
)
}) })
describe('CSS URL via `file-loader` and asset prefix (2)', () => { describe('CSS URL via `file-loader` and asset prefix (2)', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'url-global-asset-prefix-2') const appDir = join(fixturesDir, 'url-global-asset-prefix-2')
beforeAll(async () => { beforeAll(async () => {
...@@ -434,5 +484,6 @@ describe('CSS URL via `file-loader` and asset prefix (2)', () => { ...@@ -434,5 +484,6 @@ describe('CSS URL via `file-loader` and asset prefix (2)', () => {
] ]
`) `)
}) })
}) }
)
}) })
...@@ -37,7 +37,9 @@ describe('Ordering with styled-jsx (dev)', () => { ...@@ -37,7 +37,9 @@ describe('Ordering with styled-jsx (dev)', () => {
}) })
describe('Ordering with styled-jsx (prod)', () => { describe('Ordering with styled-jsx (prod)', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'with-styled-jsx') const appDir = join(fixturesDir, 'with-styled-jsx')
let appPort let appPort
...@@ -69,5 +71,6 @@ describe('Ordering with styled-jsx (prod)', () => { ...@@ -69,5 +71,6 @@ describe('Ordering with styled-jsx (prod)', () => {
) )
expect(currentColor).toMatchInlineSnapshot(`"rgb(0, 128, 0)"`) expect(currentColor).toMatchInlineSnapshot(`"rgb(0, 128, 0)"`)
}) })
}) }
)
}) })
...@@ -15,7 +15,9 @@ import { join } from 'path' ...@@ -15,7 +15,9 @@ import { join } from 'path'
const fixturesDir = join(__dirname, '../..', 'css-fixtures') const fixturesDir = join(__dirname, '../..', 'css-fixtures')
describe('CSS Support', () => { describe('CSS Support', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
describe('CSS Compilation and Prefixing', () => { describe('CSS Compilation and Prefixing', () => {
const appDir = join(fixturesDir, 'compilation-and-prefixing') const appDir = join(fixturesDir, 'compilation-and-prefixing')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
...@@ -24,7 +26,9 @@ describe('CSS Support', () => { ...@@ -24,7 +26,9 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => { describe.each([true, false])(
`useLightnincsss(%s)`,
(useLightningcss) => {
beforeAll(async () => { beforeAll(async () => {
nextConfig.write( nextConfig.write(
` `
...@@ -86,7 +90,8 @@ module.exports = { ...@@ -86,7 +90,8 @@ module.exports = {
JSON.parse(cssMapContent) JSON.parse(cssMapContent)
expect({ version, mappings, sourcesContent }).toMatchSnapshot() expect({ version, mappings, sourcesContent }).toMatchSnapshot()
}) })
}) }
)
}) })
describe('React Lifecyce Order (production)', () => { describe('React Lifecyce Order (production)', () => {
...@@ -96,7 +101,9 @@ module.exports = { ...@@ -96,7 +101,9 @@ module.exports = {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => { describe.each([true, false])(
`useLightnincsss(%s)`,
(useLightningcss) => {
beforeAll(async () => { beforeAll(async () => {
nextConfig.write( nextConfig.write(
` `
...@@ -137,7 +144,9 @@ module.exports = { ...@@ -137,7 +144,9 @@ module.exports = {
// Navigate to other: // Navigate to other:
await browser.waitForElementByCss('#link-other').click() await browser.waitForElementByCss('#link-other').click()
const text = await browser.waitForElementByCss('#red-title').text() const text = await browser
.waitForElementByCss('#red-title')
.text()
expect(text).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`) expect(text).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`)
} finally { } finally {
if (browser) { if (browser) {
...@@ -145,14 +154,17 @@ module.exports = { ...@@ -145,14 +154,17 @@ module.exports = {
} }
} }
}) })
}) }
)
}) })
describe('Has CSS in computed styles in Production', () => { describe('Has CSS in computed styles in Production', () => {
const appDir = join(fixturesDir, 'multi-page') const appDir = join(fixturesDir, 'multi-page')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => { describe.each([true, false])(
`useLightnincsss(%s)`,
(useLightningcss) => {
beforeAll(async () => { beforeAll(async () => {
nextConfig.write( nextConfig.write(
` `
...@@ -219,14 +231,17 @@ module.exports = { ...@@ -219,14 +231,17 @@ module.exports = {
) )
expect(styleIndexes).toEqual([0]) expect(styleIndexes).toEqual([0])
}) })
}) }
)
}) })
describe('Good CSS Import from node_modules', () => { describe('Good CSS Import from node_modules', () => {
const appDir = join(fixturesDir, 'npm-import') const appDir = join(fixturesDir, 'npm-import')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => { describe.each([true, false])(
`useLightnincsss(%s)`,
(useLightningcss) => {
beforeAll(async () => { beforeAll(async () => {
nextConfig.write( nextConfig.write(
` `
...@@ -267,14 +282,17 @@ module.exports = { ...@@ -267,14 +282,17 @@ module.exports = {
/nprogress/ /nprogress/
) )
}) })
}) }
)
}) })
describe('Good Nested CSS Import from node_modules', () => { describe('Good Nested CSS Import from node_modules', () => {
const appDir = join(fixturesDir, 'npm-import-nested') const appDir = join(fixturesDir, 'npm-import-nested')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => { describe.each([true, false])(
`useLightnincsss(%s)`,
(useLightningcss) => {
beforeAll(async () => { beforeAll(async () => {
nextConfig.write( nextConfig.write(
` `
...@@ -315,14 +333,18 @@ module.exports = { ...@@ -315,14 +333,18 @@ module.exports = {
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchSnapshot() ).toMatchSnapshot()
}) })
}
)
}) })
}) }
}) )
}) })
// https://github.com/vercel/next.js/issues/15468 // https://github.com/vercel/next.js/issues/15468
describe('CSS Property Ordering', () => { describe('CSS Property Ordering', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'next-issue-15468') const appDir = join(fixturesDir, 'next-issue-15468')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
...@@ -375,5 +397,6 @@ module.exports = { ...@@ -375,5 +397,6 @@ module.exports = {
expect(width2).toMatchInlineSnapshot(`"5px"`) expect(width2).toMatchInlineSnapshot(`"5px"`)
}) })
}) })
}) }
)
}) })
...@@ -133,7 +133,9 @@ useLightningcss: ${useLightningcss} ...@@ -133,7 +133,9 @@ useLightningcss: ${useLightningcss}
}) })
describe('should handle unresolved files gracefully', () => { describe('should handle unresolved files gracefully', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const workDir = join(fixturesDir, 'unresolved-css-url') const workDir = join(fixturesDir, 'unresolved-css-url')
it('should build correctly', async () => { it('should build correctly', async () => {
...@@ -156,7 +158,8 @@ describe('should handle unresolved files gracefully', () => { ...@@ -156,7 +158,8 @@ describe('should handle unresolved files gracefully', () => {
// if it is the combined global CSS file there are double the expected // if it is the combined global CSS file there are double the expected
// results // results
const howMany = content.includes('p{') || content.includes('p,') ? 2 : 1 const howMany =
content.includes('p{') || content.includes('p,') ? 2 : 1
expect(content.match(/\(\/vercel\.svg/g).length).toBe(howMany) expect(content.match(/\(\/vercel\.svg/g).length).toBe(howMany)
// expect(content.match(/\(vercel\.svg/g).length).toBe(howMany) // expect(content.match(/\(vercel\.svg/g).length).toBe(howMany)
...@@ -164,11 +167,14 @@ describe('should handle unresolved files gracefully', () => { ...@@ -164,11 +167,14 @@ describe('should handle unresolved files gracefully', () => {
expect(content.match(/\(https:\/\//g).length).toBe(howMany) expect(content.match(/\(https:\/\//g).length).toBe(howMany)
} }
}) })
}) }
)
}) })
describe('Data URLs', () => { describe('Data URLs', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const workDir = join(fixturesDir, 'data-url') const workDir = join(fixturesDir, 'data-url')
it('should compile successfully', async () => { it('should compile successfully', async () => {
...@@ -188,7 +194,8 @@ describe('Data URLs', () => { ...@@ -188,7 +194,8 @@ describe('Data URLs', () => {
/background:url\("data:[^"]+"\)/ /background:url\("data:[^"]+"\)/
) )
}) })
}) }
)
}) })
describe('Ordering with Global CSS and Modules (dev)', () => { describe('Ordering with Global CSS and Modules (dev)', () => {
...@@ -291,7 +298,9 @@ useLightningcss: ${useLightningcss} ...@@ -291,7 +298,9 @@ useLightningcss: ${useLightningcss}
}) })
describe('Ordering with Global CSS and Modules (prod)', () => { describe('Ordering with Global CSS and Modules (prod)', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'global-and-module-ordering') const appDir = join(fixturesDir, 'global-and-module-ordering')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
...@@ -339,7 +348,8 @@ module.exports = { ...@@ -339,7 +348,8 @@ module.exports = {
expect(currentColor).toMatchInlineSnapshot(`"rgb(0, 0, 255)"`) expect(currentColor).toMatchInlineSnapshot(`"rgb(0, 0, 255)"`)
}) })
}) })
}) }
)
}) })
// https://github.com/vercel/next.js/issues/12445 // https://github.com/vercel/next.js/issues/12445
...@@ -513,7 +523,7 @@ module.exports = { ...@@ -513,7 +523,7 @@ module.exports = {
tests(true) tests(true)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
beforeAll(async () => { beforeAll(async () => {
......
...@@ -15,12 +15,16 @@ import { join } from 'path' ...@@ -15,12 +15,16 @@ import { join } from 'path'
const fixturesDir = join(__dirname, '../..', 'css-fixtures') const fixturesDir = join(__dirname, '../..', 'css-fixtures')
describe('CSS Support', () => { describe('CSS Support', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
describe('CSS Import from node_modules', () => { describe('CSS Import from node_modules', () => {
const appDir = join(fixturesDir, 'npm-import-bad') const appDir = join(fixturesDir, 'npm-import-bad')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => { describe.each([true, false])(
`useLightnincsss(%s)`,
(useLightningcss) => {
beforeAll(async () => { beforeAll(async () => {
nextConfig.write( nextConfig.write(
` `
...@@ -38,15 +42,21 @@ module.exports = { ...@@ -38,15 +42,21 @@ module.exports = {
}) })
it('should fail the build', async () => { it('should fail the build', async () => {
const { code, stderr } = await nextBuild(appDir, [], { stderr: true }) const { code, stderr } = await nextBuild(appDir, [], {
stderr: true,
})
expect(code).toBe(0) expect(code).toBe(0)
expect(stderr).not.toMatch(/Can't resolve '[^']*?nprogress[^']*?'/) expect(stderr).not.toMatch(
/Can't resolve '[^']*?nprogress[^']*?'/
)
expect(stderr).not.toMatch(/Build error occurred/) expect(stderr).not.toMatch(/Build error occurred/)
}) })
}
)
}) })
}) }
}) )
// https://github.com/vercel/next.js/issues/18557 // https://github.com/vercel/next.js/issues/18557
describe('CSS page transition inject <style> with nonce so it works with CSP header', () => { describe('CSS page transition inject <style> with nonce so it works with CSP header', () => {
...@@ -185,7 +195,7 @@ module.exports = { ...@@ -185,7 +195,7 @@ module.exports = {
}) })
} }
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
beforeAll(async () => { beforeAll(async () => {
...@@ -267,7 +277,7 @@ module.exports = { ...@@ -267,7 +277,7 @@ module.exports = {
}) })
} }
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
beforeAll(async () => { beforeAll(async () => {
...@@ -335,7 +345,7 @@ module.exports = { ...@@ -335,7 +345,7 @@ module.exports = {
}) })
} }
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
beforeAll(async () => { beforeAll(async () => {
...@@ -450,7 +460,7 @@ module.exports = { ...@@ -450,7 +460,7 @@ module.exports = {
}) })
} }
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
beforeAll(async () => { beforeAll(async () => {
......
...@@ -6,7 +6,9 @@ import { join } from 'path' ...@@ -6,7 +6,9 @@ import { join } from 'path'
const fixturesDir = join(__dirname, '../..', 'css-fixtures') const fixturesDir = join(__dirname, '../..', 'css-fixtures')
describe('Invalid CSS in _document', () => { describe('Invalid CSS in _document', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'invalid-module-document') const appDir = join(fixturesDir, 'invalid-module-document')
beforeAll(async () => { beforeAll(async () => {
...@@ -25,11 +27,14 @@ describe('Invalid CSS in _document', () => { ...@@ -25,11 +27,14 @@ describe('Invalid CSS in _document', () => {
) )
expect(stderr).toMatch(/Location:.*pages[\\/]_document\.js/) expect(stderr).toMatch(/Location:.*pages[\\/]_document\.js/)
}) })
}) }
)
}) })
describe('Invalid Global CSS', () => { describe('Invalid Global CSS', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'invalid-global') const appDir = join(fixturesDir, 'invalid-global')
beforeAll(async () => { beforeAll(async () => {
...@@ -48,11 +53,14 @@ describe('Invalid Global CSS', () => { ...@@ -48,11 +53,14 @@ describe('Invalid Global CSS', () => {
) )
expect(stderr).toMatch(/Location:.*pages[\\/]index\.js/) expect(stderr).toMatch(/Location:.*pages[\\/]index\.js/)
}) })
}) }
)
}) })
describe('Valid Global CSS from npm', () => { describe('Valid Global CSS from npm', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'import-global-from-module') const appDir = join(fixturesDir, 'import-global-from-module')
beforeAll(async () => { beforeAll(async () => {
...@@ -79,11 +87,14 @@ describe('Valid Global CSS from npm', () => { ...@@ -79,11 +87,14 @@ describe('Valid Global CSS from npm', () => {
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".red-text{color:"red"}"`) ).toMatchInlineSnapshot(`".red-text{color:"red"}"`)
}) })
}) }
)
}) })
describe('Invalid Global CSS with Custom App', () => { describe('Invalid Global CSS with Custom App', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'invalid-global-with-app') const appDir = join(fixturesDir, 'invalid-global-with-app')
beforeAll(async () => { beforeAll(async () => {
...@@ -102,11 +113,14 @@ describe('Invalid Global CSS with Custom App', () => { ...@@ -102,11 +113,14 @@ describe('Invalid Global CSS with Custom App', () => {
) )
expect(stderr).toMatch(/Location:.*pages[\\/]index\.js/) expect(stderr).toMatch(/Location:.*pages[\\/]index\.js/)
}) })
}) }
)
}) })
describe('Valid and Invalid Global CSS with Custom App', () => { describe('Valid and Invalid Global CSS with Custom App', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const appDir = join(fixturesDir, 'valid-and-invalid-global') const appDir = join(fixturesDir, 'valid-and-invalid-global')
beforeAll(async () => { beforeAll(async () => {
...@@ -120,8 +134,11 @@ describe('Valid and Invalid Global CSS with Custom App', () => { ...@@ -120,8 +134,11 @@ describe('Valid and Invalid Global CSS with Custom App', () => {
expect(code).not.toBe(0) expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('styles/global.css') expect(stderr).toContain('styles/global.css')
expect(stderr).toContain('Please move all first-party global CSS imports') expect(stderr).toContain(
'Please move all first-party global CSS imports'
)
expect(stderr).toMatch(/Location:.*pages[\\/]index\.js/) expect(stderr).toMatch(/Location:.*pages[\\/]index\.js/)
}) })
}) }
)
}) })
...@@ -11,7 +11,9 @@ let app ...@@ -11,7 +11,9 @@ let app
// TODO: re-enable with React 18 // TODO: re-enable with React 18
describe.skip('Custom error page exception', () => { describe.skip('Custom error page exception', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir, undefined, { await nextBuild(appDir, undefined, {
nodeArgs, nodeArgs,
...@@ -32,5 +34,6 @@ describe.skip('Custom error page exception', () => { ...@@ -32,5 +34,6 @@ describe.skip('Custom error page exception', () => {
/Application error: a client-side exception has occurred/ /Application error: a client-side exception has occurred/
) )
}) })
}) }
)
}) })
...@@ -27,7 +27,7 @@ const customErrNo404Match = ...@@ -27,7 +27,7 @@ const customErrNo404Match =
/You have added a custom \/_error page without a custom \/404 page/ /You have added a custom \/_error page without a custom \/404 page/
describe('Custom _error', () => { describe('Custom _error', () => {
describe('dev mode 1', () => { describe('development mode 1', () => {
let stderr = '' let stderr = ''
beforeAll(async () => { beforeAll(async () => {
...@@ -50,7 +50,7 @@ describe('Custom _error', () => { ...@@ -50,7 +50,7 @@ describe('Custom _error', () => {
}) })
}) })
describe('dev mode 2', () => { describe('development mode 2', () => {
let stderr = '' let stderr = ''
beforeAll(async () => { beforeAll(async () => {
...@@ -79,7 +79,9 @@ describe('Custom _error', () => { ...@@ -79,7 +79,9 @@ describe('Custom _error', () => {
expect(html).toContain('An error 404 occurred on server') expect(html).toContain('An error 404 occurred on server')
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
let buildOutput = '' let buildOutput = ''
beforeAll(async () => { beforeAll(async () => {
...@@ -99,5 +101,6 @@ describe('Custom _error', () => { ...@@ -99,5 +101,6 @@ describe('Custom _error', () => {
}) })
runTests() runTests()
}) }
)
}) })
...@@ -27,7 +27,7 @@ const runTests = () => { ...@@ -27,7 +27,7 @@ const runTests = () => {
} }
describe('Custom page extension', () => { describe('Custom page extension', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -35,7 +35,9 @@ describe('Custom page extension', () => { ...@@ -35,7 +35,9 @@ describe('Custom page extension', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -43,5 +45,6 @@ describe('Custom page extension', () => { ...@@ -43,5 +45,6 @@ describe('Custom page extension', () => {
}) })
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -44,7 +44,7 @@ const runTests = () => { ...@@ -44,7 +44,7 @@ const runTests = () => {
} }
describe('Custom routes', () => { describe('Custom routes', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -53,7 +53,9 @@ describe('Custom routes', () => { ...@@ -53,7 +53,9 @@ describe('Custom routes', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests(true) runTests(true)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -62,5 +64,6 @@ describe('Custom routes', () => { ...@@ -62,5 +64,6 @@ describe('Custom routes', () => {
}) })
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -61,7 +61,7 @@ describe('Custom routes i18n with index redirect', () => { ...@@ -61,7 +61,7 @@ describe('Custom routes i18n with index redirect', () => {
server.close() server.close()
}) })
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -69,7 +69,9 @@ describe('Custom routes i18n with index redirect', () => { ...@@ -69,7 +69,9 @@ describe('Custom routes i18n with index redirect', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests(true) runTests(true)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -77,5 +79,6 @@ describe('Custom routes i18n with index redirect', () => { ...@@ -77,5 +79,6 @@ describe('Custom routes i18n with index redirect', () => {
}) })
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -168,7 +168,7 @@ describe('Custom routes i18n', () => { ...@@ -168,7 +168,7 @@ describe('Custom routes i18n', () => {
nextConfig.restore() nextConfig.restore()
}) })
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -176,7 +176,9 @@ describe('Custom routes i18n', () => { ...@@ -176,7 +176,9 @@ describe('Custom routes i18n', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests(true) runTests(true)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
appPort = await findPort() appPort = await findPort()
...@@ -184,5 +186,6 @@ describe('Custom routes i18n', () => { ...@@ -184,5 +186,6 @@ describe('Custom routes i18n', () => {
}) })
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -2636,7 +2636,7 @@ describe('Custom routes', () => { ...@@ -2636,7 +2636,7 @@ describe('Custom routes', () => {
await fs.writeFile(nextConfigPath, nextConfigRestoreContent) await fs.writeFile(nextConfigPath, nextConfigRestoreContent)
}) })
describe('dev mode', () => { describe('development mode', () => {
let nextConfigContent let nextConfigContent
beforeAll(async () => { beforeAll(async () => {
...@@ -2686,7 +2686,9 @@ describe('Custom routes', () => { ...@@ -2686,7 +2686,9 @@ describe('Custom routes', () => {
) )
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
const { stdout: buildStdout, stderr: buildStderr } = await nextBuild( const { stdout: buildStdout, stderr: buildStderr } = await nextBuild(
appDir, appDir,
...@@ -2710,7 +2712,8 @@ describe('Custom routes', () => { ...@@ -2710,7 +2712,8 @@ describe('Custom routes', () => {
`rewrites, redirects, and headers are not applied when exporting your application detected` `rewrites, redirects, and headers are not applied when exporting your application detected`
) )
}) })
}) }
)
describe('should load custom routes when only one type is used', () => { describe('should load custom routes when only one type is used', () => {
const runSoloTests = (isDev) => { const runSoloTests = (isDev) => {
...@@ -2807,10 +2810,10 @@ describe('Custom routes', () => { ...@@ -2807,10 +2810,10 @@ describe('Custom routes', () => {
}) })
} }
describe('dev mode', () => { describe('development mode', () => {
runSoloTests(true) runSoloTests(true)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
runSoloTests() runSoloTests()
...@@ -2820,7 +2823,9 @@ describe('Custom routes', () => { ...@@ -2820,7 +2823,9 @@ describe('Custom routes', () => {
}) })
describe('export', () => { describe('export', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
nextConfig.replace('// REPLACEME', `output: 'export',`) nextConfig.replace('// REPLACEME', `output: 'export',`)
const { stdout: buildStdout, stderr: buildStderr } = await nextBuild( const { stdout: buildStdout, stderr: buildStderr } = await nextBuild(
...@@ -2842,5 +2847,6 @@ describe('export', () => { ...@@ -2842,5 +2847,6 @@ describe('export', () => {
`rewrites, redirects, and headers are not applied when exporting your application detected` `rewrites, redirects, and headers are not applied when exporting your application detected`
) )
}) })
}) }
)
}) })
...@@ -141,7 +141,7 @@ describe.each([ ...@@ -141,7 +141,7 @@ describe.each([
}) })
describe('with generateEtags enabled', () => { describe('with generateEtags enabled', () => {
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
beforeAll(async () => { beforeAll(async () => {
...@@ -211,7 +211,7 @@ describe.each([ ...@@ -211,7 +211,7 @@ describe.each([
describe('Error when rendering without starting slash', () => { describe('Error when rendering without starting slash', () => {
afterEach(() => killApp(server)) afterEach(() => killApp(server))
it('should warn in dev mode', async () => { it('should warn in development mode', async () => {
let stderr = '' let stderr = ''
await startServer( await startServer(
{}, {},
...@@ -227,7 +227,7 @@ describe.each([ ...@@ -227,7 +227,7 @@ describe.each([
expect(html).toContain('made it to dashboard') expect(html).toContain('made it to dashboard')
expect(stderr).toContain('Cannot render page with path "dashboard"') expect(stderr).toContain('Cannot render page with path "dashboard"')
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('should warn in production mode', async () => { it('should warn in production mode', async () => {
......
...@@ -129,10 +129,12 @@ describe('GS(S)P Page Errors', () => { ...@@ -129,10 +129,12 @@ describe('GS(S)P Page Errors', () => {
}) })
afterAll(() => fs.writeFile(indexPage, origIndexPage)) afterAll(() => fs.writeFile(indexPage, origIndexPage))
describe('dev mode', () => { describe('development mode', () => {
runTests(true) runTests(true)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
runTests() runTests()
it('Error stack printed to stderr', async () => { it('Error stack printed to stderr', async () => {
...@@ -173,5 +175,6 @@ describe('GS(S)P Page Errors', () => { ...@@ -173,5 +175,6 @@ describe('GS(S)P Page Errors', () => {
await killApp(app) await killApp(app)
} }
}) })
}) }
)
}) })
...@@ -15,7 +15,9 @@ let appPort ...@@ -15,7 +15,9 @@ let appPort
let app let app
describe('De-dedupes scripts in _document', () => { describe('De-dedupes scripts in _document', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
await nextBuild(appDir) await nextBuild(appDir)
...@@ -40,5 +42,6 @@ describe('De-dedupes scripts in _document', () => { ...@@ -40,5 +42,6 @@ describe('De-dedupes scripts in _document', () => {
} }
expect(foundDuplicate).toBe(false) expect(foundDuplicate).toBe(false)
}) })
}) }
)
}) })
...@@ -18,7 +18,9 @@ let app ...@@ -18,7 +18,9 @@ let app
const context = {} const context = {}
describe('disabled runtime JS', () => { describe('disabled runtime JS', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
...@@ -52,9 +54,10 @@ describe('disabled runtime JS', () => { ...@@ -52,9 +54,10 @@ describe('disabled runtime JS', () => {
const $ = cheerio.load(html) const $ = cheerio.load(html)
expect($('link[rel=preload]').length).toBe(0) expect($('link[rel=preload]').length).toBe(0)
}) })
}) }
)
describe('dev mode', () => { describe('development mode', () => {
let appPort let appPort
let app let app
......
...@@ -19,7 +19,7 @@ let app ...@@ -19,7 +19,7 @@ let app
describe('distDir', () => { describe('distDir', () => {
describe('With basic usage', () => { describe('With basic usage', () => {
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
beforeAll(async () => { beforeAll(async () => {
...@@ -48,7 +48,7 @@ describe('distDir', () => { ...@@ -48,7 +48,7 @@ describe('distDir', () => {
) )
}) })
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
await fs.remove(join(appDir, '.next')) await fs.remove(join(appDir, '.next'))
await fs.remove(join(appDir, 'dist')) await fs.remove(join(appDir, 'dist'))
...@@ -71,7 +71,9 @@ describe('distDir', () => { ...@@ -71,7 +71,9 @@ describe('distDir', () => {
expect(await fs.exists(join(__dirname, '/../.next'))).toBeFalsy() expect(await fs.exists(join(__dirname, '/../.next'))).toBeFalsy()
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
it('should throw error with invalid distDir', async () => { it('should throw error with invalid distDir', async () => {
const origNextConfig = await fs.readFile(nextConfig, 'utf8') const origNextConfig = await fs.readFile(nextConfig, 'utf8')
await fs.writeFile(nextConfig, `module.exports = { distDir: '' }`) await fs.writeFile(nextConfig, `module.exports = { distDir: '' }`)
...@@ -94,5 +96,6 @@ describe('distDir', () => { ...@@ -94,5 +96,6 @@ describe('distDir', () => {
expect(stderr.length).toBe(0) expect(stderr.length).toBe(0)
}) })
}) }
)
}) })
...@@ -10,7 +10,9 @@ let appPort ...@@ -10,7 +10,9 @@ let appPort
let app let app
describe('File Dependencies', () => { describe('File Dependencies', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
await nextBuild(appDir) await nextBuild(appDir)
...@@ -72,5 +74,6 @@ describe('File Dependencies', () => { ...@@ -72,5 +74,6 @@ describe('File Dependencies', () => {
backgroundColor: 'rgb(200, 200, 200)', backgroundColor: 'rgb(200, 200, 200)',
}) })
}) })
}) }
)
}) })
...@@ -117,7 +117,9 @@ describe('Test Draft Mode', () => { ...@@ -117,7 +117,9 @@ describe('Test Draft Mode', () => {
await killApp(app) await killApp(app)
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
let appPort, app, cookieString, initialRand let appPort, app, cookieString, initialRand
const getOpts = () => ({ headers: { Cookie: cookieString } }) const getOpts = () => ({ headers: { Cookie: cookieString } })
...@@ -244,5 +246,6 @@ describe('Test Draft Mode', () => { ...@@ -244,5 +246,6 @@ describe('Test Draft Mode', () => {
afterAll(async () => { afterAll(async () => {
await killApp(app) await killApp(app)
}) })
}) }
)
}) })
...@@ -51,7 +51,7 @@ function runTests() { ...@@ -51,7 +51,7 @@ function runTests() {
const nextConfig = join(appDir, 'next.config.js') const nextConfig = join(appDir, 'next.config.js')
describe('Dynamic Optional Routing Root Fallback', () => { describe('Dynamic Optional Routing Root Fallback', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
await fs.remove(join(appDir, '.next')) await fs.remove(join(appDir, '.next'))
...@@ -62,7 +62,9 @@ describe('Dynamic Optional Routing Root Fallback', () => { ...@@ -62,7 +62,9 @@ describe('Dynamic Optional Routing Root Fallback', () => {
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await fs.remove(join(appDir, '.next')) await fs.remove(join(appDir, '.next'))
...@@ -79,5 +81,6 @@ describe('Dynamic Optional Routing Root Fallback', () => { ...@@ -79,5 +81,6 @@ describe('Dynamic Optional Routing Root Fallback', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -39,7 +39,7 @@ function runTests() { ...@@ -39,7 +39,7 @@ function runTests() {
const nextConfig = join(appDir, 'next.config.js') const nextConfig = join(appDir, 'next.config.js')
describe('Dynamic Optional Routing', () => { describe('Dynamic Optional Routing', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -48,7 +48,9 @@ describe('Dynamic Optional Routing', () => { ...@@ -48,7 +48,9 @@ describe('Dynamic Optional Routing', () => {
runTests() runTests()
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
const curConfig = await fs.readFile(nextConfig, 'utf8') const curConfig = await fs.readFile(nextConfig, 'utf8')
...@@ -63,5 +65,6 @@ describe('Dynamic Optional Routing', () => { ...@@ -63,5 +65,6 @@ describe('Dynamic Optional Routing', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests() runTests()
}) }
)
}) })
...@@ -237,7 +237,7 @@ function runInvalidPagesTests(buildFn) { ...@@ -237,7 +237,7 @@ function runInvalidPagesTests(buildFn) {
} }
describe('Dynamic Optional Routing', () => { describe('Dynamic Optional Routing', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort) app = await launchApp(appDir, appPort)
...@@ -255,7 +255,9 @@ describe('Dynamic Optional Routing', () => { ...@@ -255,7 +255,9 @@ describe('Dynamic Optional Routing', () => {
}) })
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
const curConfig = await fs.readFile(nextConfig, 'utf8') const curConfig = await fs.readFile(nextConfig, 'utf8')
...@@ -310,5 +312,6 @@ describe('Dynamic Optional Routing', () => { ...@@ -310,5 +312,6 @@ describe('Dynamic Optional Routing', () => {
await fs.unlink(invalidRoute) await fs.unlink(invalidRoute)
} }
}) })
}) }
)
}) })
...@@ -1579,7 +1579,7 @@ describe('Dynamic Routing', () => { ...@@ -1579,7 +1579,7 @@ describe('Dynamic Routing', () => {
afterAll(() => fs.remove(middlewarePath)) afterAll(() => fs.remove(middlewarePath))
} }
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
await fs.remove(nextConfig) await fs.remove(nextConfig)
...@@ -1591,7 +1591,9 @@ describe('Dynamic Routing', () => { ...@@ -1591,7 +1591,9 @@ describe('Dynamic Routing', () => {
runTests({ dev: true }) runTests({ dev: true })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await fs.remove(nextConfig) await fs.remove(nextConfig)
...@@ -1604,5 +1606,6 @@ describe('Dynamic Routing', () => { ...@@ -1604,5 +1606,6 @@ describe('Dynamic Routing', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests({ dev: false }) runTests({ dev: false })
}) }
)
}) })
...@@ -102,7 +102,7 @@ describe('Edge runtime configurable guards', () => { ...@@ -102,7 +102,7 @@ describe('Edge runtime configurable guards', () => {
) )
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('fails to build because of unallowed code', async () => { it('fails to build because of unallowed code', async () => {
...@@ -306,7 +306,7 @@ describe('Edge runtime configurable guards', () => { ...@@ -306,7 +306,7 @@ 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)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('build and does not warn at runtime', async () => { it('build and does not warn at runtime', async () => {
...@@ -391,7 +391,7 @@ describe('Edge runtime configurable guards', () => { ...@@ -391,7 +391,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`
) )
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('fails to build because of dynamic code evaluation', async () => { it('fails to build because of dynamic code evaluation', async () => {
...@@ -449,7 +449,7 @@ describe('Edge runtime configurable guards', () => { ...@@ -449,7 +449,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`
) )
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
// eslint-disable-next-line jest/no-identical-title // eslint-disable-next-line jest/no-identical-title
......
...@@ -22,7 +22,7 @@ const context = { ...@@ -22,7 +22,7 @@ const context = {
appDir: join(__dirname, '../'), appDir: join(__dirname, '../'),
} }
describe('Page using eval in dev mode', () => { describe('Page using eval in development mode', () => {
let output = '' let output = ''
beforeAll(async () => { beforeAll(async () => {
...@@ -74,7 +74,7 @@ describe.each([ ...@@ -74,7 +74,7 @@ describe.each([
])( ])(
'$title usage of dynamic code evaluation', '$title usage of dynamic code evaluation',
({ extractValue, computeRoute }) => { ({ extractValue, computeRoute }) => {
describe('dev mode', () => { describe('development mode', () => {
let output = '' let output = ''
beforeAll(async () => { beforeAll(async () => {
...@@ -158,7 +158,7 @@ describe.each([ ...@@ -158,7 +158,7 @@ describe.each([
expect(output).not.toContain('DynamicWasmCodeGenerationWarning') expect(output).not.toContain('DynamicWasmCodeGenerationWarning')
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
let buildResult let buildResult
......
...@@ -101,7 +101,7 @@ describe('Edge runtime code with imports', () => { ...@@ -101,7 +101,7 @@ describe('Edge runtime code with imports', () => {
}) })
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('throws unsupported module error in production at runtime and prints error on logs', async () => { it('throws unsupported module error in production at runtime and prints error on logs', async () => {
...@@ -187,7 +187,7 @@ describe('Edge runtime code with imports', () => { ...@@ -187,7 +187,7 @@ describe('Edge runtime code with imports', () => {
}, 'success') }, 'success')
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('throws unsupported module error in production at runtime and prints error on logs', async () => { it('throws unsupported module error in production at runtime and prints error on logs', async () => {
...@@ -258,7 +258,7 @@ describe('Edge runtime code with imports', () => { ...@@ -258,7 +258,7 @@ describe('Edge runtime code with imports', () => {
return 'success' return 'success'
}, 'success') }, 'success')
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('does not build and reports', async () => { it('does not build and reports', async () => {
...@@ -320,7 +320,7 @@ describe('Edge runtime code with imports', () => { ...@@ -320,7 +320,7 @@ describe('Edge runtime code with imports', () => {
expect(res.headers.get('x-from-runtime')).toBeDefined() expect(res.headers.get('x-from-runtime')).toBeDefined()
expectNoError(moduleName) expectNoError(moduleName)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('does not throw in production at runtime', async () => { it('does not throw in production at runtime', async () => {
...@@ -389,7 +389,7 @@ describe('Edge runtime code with imports', () => { ...@@ -389,7 +389,7 @@ describe('Edge runtime code with imports', () => {
expect(res.headers.get('x-from-runtime')).toBe('false') expect(res.headers.get('x-from-runtime')).toBe('false')
expectNoError(moduleName) expectNoError(moduleName)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('does not throw in production at runtime', async () => { it('does not throw in production at runtime', async () => {
......
...@@ -95,7 +95,7 @@ describe('Edge runtime code with imports', () => { ...@@ -95,7 +95,7 @@ describe('Edge runtime code with imports', () => {
return 'success' return 'success'
}, 'success') }, 'success')
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('throws unsupported module error in production at runtime and prints error on logs', async () => { it('throws unsupported module error in production at runtime and prints error on logs', async () => {
...@@ -165,7 +165,7 @@ describe('Edge runtime code with imports', () => { ...@@ -165,7 +165,7 @@ describe('Edge runtime code with imports', () => {
return 'success' return 'success'
}, 'success') }, 'success')
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('does not build and reports module not found error', async () => { it('does not build and reports module not found error', async () => {
...@@ -233,7 +233,7 @@ describe('Edge runtime code with imports', () => { ...@@ -233,7 +233,7 @@ describe('Edge runtime code with imports', () => {
return 'success' return 'success'
}, 'success') }, 'success')
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('does not build and reports module not found error', async () => { it('does not build and reports module not found error', async () => {
...@@ -295,7 +295,7 @@ describe('Edge runtime code with imports', () => { ...@@ -295,7 +295,7 @@ describe('Edge runtime code with imports', () => {
expect(res.status).toBe(200) expect(res.status).toBe(200)
expectNoError(moduleName) expectNoError(moduleName)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it('does not throw in production at runtime', async () => { it('does not throw in production at runtime', async () => {
......
...@@ -72,7 +72,7 @@ describe('Edge runtime code with imports', () => { ...@@ -72,7 +72,7 @@ describe('Edge runtime code with imports', () => {
) )
expect(res.status).toBe(500) expect(res.status).toBe(500)
}) })
;(process.env.TURBOPACK ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
() => { () => {
it(`${title} build test Response`, async () => { it(`${title} build test Response`, async () => {
......
...@@ -50,7 +50,7 @@ function createContext() { ...@@ -50,7 +50,7 @@ function createContext() {
return ctx return ctx
} }
describe('dev mode', () => { describe('development mode', () => {
const context = createContext() const context = createContext()
beforeAll(async () => { beforeAll(async () => {
...@@ -65,7 +65,9 @@ describe('dev mode', () => { ...@@ -65,7 +65,9 @@ describe('dev mode', () => {
it('logs the error correctly', test(context)) it('logs the error correctly', test(context))
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
const context = createContext() const context = createContext()
beforeAll(async () => { beforeAll(async () => {
...@@ -81,4 +83,5 @@ describe('dev mode', () => { ...@@ -81,4 +83,5 @@ describe('dev mode', () => {
}) })
afterAll(() => killApp(context.app)) afterAll(() => killApp(context.app))
it('logs the error correctly', test(context)) it('logs the error correctly', test(context))
}) }
)
...@@ -60,7 +60,7 @@ describe.each([ ...@@ -60,7 +60,7 @@ describe.each([
])('$title using Node.js API', ({ computeRoute }) => { ])('$title using Node.js API', ({ computeRoute }) => {
const appDir = join(__dirname, '..') const appDir = join(__dirname, '..')
describe('dev mode', () => { describe('development mode', () => {
let output = '' let output = ''
let appPort: number let appPort: number
let app = null let app = null
...@@ -110,7 +110,9 @@ Learn more: https://nextjs.org/docs/api-reference/edge-runtime`) ...@@ -110,7 +110,9 @@ Learn more: https://nextjs.org/docs/api-reference/edge-runtime`)
expect(stripAnsi(output)).toInclude(errorHighlight) expect(stripAnsi(output)).toInclude(errorHighlight)
}) })
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
let buildResult let buildResult
beforeAll(async () => { beforeAll(async () => {
...@@ -135,5 +137,6 @@ Learn more: https://nextjs.org/docs/api-reference/edge-runtime`) ...@@ -135,5 +137,6 @@ Learn more: https://nextjs.org/docs/api-reference/edge-runtime`)
expect(buildResult.stderr).toContain(`A Node.js API is used (${api}`) expect(buildResult.stderr).toContain(`A Node.js API is used (${api}`)
} }
) )
}) }
)
}) })
...@@ -132,7 +132,7 @@ const runTests = (mode = 'dev', didReload = false) => { ...@@ -132,7 +132,7 @@ const runTests = (mode = 'dev', didReload = false) => {
} }
describe('Env Config', () => { describe('Env Config', () => {
describe('dev mode', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
output = '' output = ''
appPort = await findPort() appPort = await findPort()
...@@ -358,7 +358,9 @@ describe('Env Config', () => { ...@@ -358,7 +358,9 @@ describe('Env Config', () => {
runTests('test') runTests('test')
}) })
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
const { code } = await nextBuild(appDir, [], { const { code } = await nextBuild(appDir, [], {
env: { env: {
...@@ -378,5 +380,6 @@ describe('Env Config', () => { ...@@ -378,5 +380,6 @@ describe('Env Config', () => {
afterAll(() => killApp(app)) afterAll(() => killApp(app))
runTests('server') runTests('server')
}) }
)
}) })
...@@ -16,7 +16,9 @@ let app ...@@ -16,7 +16,9 @@ let app
let port let port
describe('Handles an Error in _error', () => { describe('Handles an Error in _error', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await nextBuild(appDir)
port = await findPort() port = await findPort()
...@@ -36,5 +38,6 @@ describe('Handles an Error in _error', () => { ...@@ -36,5 +38,6 @@ describe('Handles an Error in _error', () => {
const html = await browser.eval('document.body.innerHTML') const html = await browser.eval('document.body.innerHTML')
expect(html).toMatch(/Internal Server Error/i) expect(html).toMatch(/Internal Server Error/i)
}) })
}) }
)
}) })
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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