Skip to content

Commit 6e51845

Browse files
authored
Rename process.env.TURBOPACK to process.env.IS_TURBOPACK_TEST for tests (#77892)
Preparation for removing `process.env.TURBOPACK` being added to Turbopack tests. That way we can properly test `next start` without `process.env.TURBOPACK` being set. <!-- 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 # -->
1 parent 8e7cd39 commit 6e51845

File tree

174 files changed

+1020
-971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+1020
-971
lines changed

.github/workflows/build_and_test.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ jobs:
240240
react: ['', '18.3.1']
241241
uses: ./.github/workflows/build_reusable.yml
242242
with:
243-
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" TURBOPACK=1 TURBOPACK_DEV=1 NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=dev NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --test-pattern '^(test\/(development|e2e))/.*\.test\.(js|jsx|ts|tsx)$' --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY}
243+
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_DEV=1 NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=dev NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --test-pattern '^(test\/(development|e2e))/.*\.test\.(js|jsx|ts|tsx)$' --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY}
244244
stepName: 'test-turbopack-dev-react-${{ matrix.react }}-${{ matrix.group }}'
245245
secrets: inherit
246246

@@ -262,7 +262,7 @@ jobs:
262262
uses: ./.github/workflows/build_reusable.yml
263263
with:
264264
nodeVersion: 18.18.2
265-
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" TURBOPACK=1 TURBOPACK_DEV=1 NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
265+
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-dev-tests-manifest.json" IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_DEV=1 NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
266266
stepName: 'test-turbopack-integration-react-${{ matrix.react }}-${{ matrix.group }}'
267267
secrets: inherit
268268

@@ -287,7 +287,7 @@ jobs:
287287
uses: ./.github/workflows/build_reusable.yml
288288
with:
289289
nodeVersion: 18.18.2
290-
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-build-tests-manifest.json" TURBOPACK=1 TURBOPACK_BUILD=1 NEXT_TEST_MODE=start NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
290+
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-build-tests-manifest.json" IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_BUILD=1 NEXT_TEST_MODE=start NEXT_TEST_REACT_VERSION="${{ matrix.react }}" node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
291291
stepName: 'test-turbopack-production-react-${{ matrix.react }}-${{ matrix.group }}'
292292
secrets: inherit
293293

@@ -303,7 +303,7 @@ jobs:
303303
uses: ./.github/workflows/build_reusable.yml
304304
with:
305305
nodeVersion: 18.18.2
306-
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-build-tests-manifest.json" TURBOPACK=1 TURBOPACK_BUILD=1 node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
306+
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-build-tests-manifest.json" IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_BUILD=1 node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type integration
307307
stepName: 'test-turbopack-production-integration-${{ matrix.group }}'
308308
secrets: inherit
309309

.github/workflows/turbopack-nextjs-build-integration-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: turbopack-production
1414
test_type: production
1515
run_before_test: |
16-
export TURBOPACK=1 TURBOPACK_BUILD=1
16+
export IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_BUILD=1
1717
# Failing tests take longer (due to timeouts and retries). Since we have
1818
# many failing tests, we need smaller groups and longer timeouts, in case
1919
# a group gets stuck with a cluster of failing tests.

.github/workflows/turbopack-nextjs-dev-integration-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ jobs:
1313
name: turbopack-development
1414
test_type: development
1515
run_before_test: |
16-
export TURBOPACK=1
16+
export IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_DEV=1
1717
secrets: inherit

bench/heavy-npm-deps/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"dev-turbopack": "next dev --turbopack",
77
"dev-webpack": "next dev",
8-
"build-turbopack": "TURBOPACK=1 TURBOPACK_BUILD=1 next build",
8+
"build-turbopack": "next build --turbopack",
99
"build-webpack": "next build",
1010
"start-turbopack": "TURBOPACK=1 next start",
1111
"start-webpack": "next start",

contributing/core/testing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ Add `NEXT_TEST_TRACE=1` to enable test profiling. It's useful for improving our
109109

110110
### Testing Turbopack
111111

112-
To run the test suite using Turbopack, you can use the `TURBOPACK=1` environment variable:
112+
To run the test suite using Turbopack, you can use the `-turbo` version of the npm script:
113113

114114
```sh
115-
TURBOPACK=1 pnpm test-dev test/e2e/app-dir/app/
115+
pnpm test-dev-turbo test/e2e/app-dir/app/
116116
```
117117

118118
If you want to run a test again both Turbopack and Webpack, use Jest's `--projects` flag:

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
"test-unit": "jest test/unit/ packages/next/ packages/font",
1818
"test-dev": "cross-env NEXT_TEST_MODE=dev pnpm testheadless",
1919
"test-dev-rspack": "pnpm run with-rspack pnpm run test-dev",
20-
"test-dev-turbo": "cross-env NEXT_TEST_MODE=dev TURBOPACK=1 TURBOPACK_DEV=1 pnpm testheadless",
20+
"test-dev-turbo": "cross-env NEXT_TEST_MODE=dev IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_DEV=1 pnpm testheadless",
2121
"test-start": "cross-env NEXT_TEST_MODE=start pnpm testheadless",
2222
"test-start-rspack": "pnpm run with-rspack pnpm run test-start",
23-
"test-start-turbo": "cross-env NEXT_TEST_MODE=start TURBOPACK=1 TURBOPACK_BUILD=1 pnpm testheadless",
23+
"test-start-turbo": "cross-env NEXT_TEST_MODE=start IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_BUILD=1 pnpm testheadless",
2424
"test-deploy": "cross-env NEXT_TEST_MODE=deploy pnpm testheadless",
2525
"testonly-dev": "cross-env NEXT_TEST_MODE=dev pnpm testonly",
2626
"testonly-dev-rspack": "pnpm run with-rspack pnpm run testonly-dev",
27-
"testonly-dev-turbo": "cross-env NEXT_TEST_MODE=dev TURBOPACK=1 TURBOPACK_DEV=1 pnpm testonly",
27+
"testonly-dev-turbo": "cross-env NEXT_TEST_MODE=dev IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_DEV=1 pnpm testonly",
2828
"testonly-start": "cross-env NEXT_TEST_MODE=start pnpm testonly",
2929
"testonly-start-rspack": "pnpm run with-rspack pnpm run testonly-start",
30-
"testonly-start-turbo": "cross-env NEXT_TEST_MODE=start TURBOPACK=1 TURBOPACK_BUILD=1 pnpm testonly",
30+
"testonly-start-turbo": "cross-env NEXT_TEST_MODE=start IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_BUILD=1 pnpm testonly",
3131
"testonly-deploy": "cross-env NEXT_TEST_MODE=deploy pnpm testonly",
3232
"test": "pnpm testheadless",
3333
"test-rspack": "pnpm run with-rspack pnpm run test",
34-
"test-turbo": "cross-env TURBOPACK=1 TURBOPACK_DEV=1 TURBOPACK_BUILD=1 pnpm testheadless",
34+
"test-turbo": "cross-env IS_TURBOPACK_TEST=1 TURBOPACK=1 TURBOPACK_DEV=1 TURBOPACK_BUILD=1 pnpm testheadless",
3535
"testonly": "jest --runInBand",
3636
"testheadless": "cross-env HEADLESS=true pnpm testonly",
3737
"genstats": "cross-env LOCAL_STATS=true node .github/actions/next-stats-action/src/index.js",

test/development/acceptance-app/app-hmr-changes.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Error overlay - RSC build errors', () => {
2222
})
2323

2424
// TODO: The error overlay is not closed when restoring the working code.
25-
;(process.env.TURBOPACK ? describe : describe.skip)(
25+
;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)(
2626
'Skipped in webpack',
2727
() => {
2828
it('should handle successive HMR changes with errors correctly', async () => {

test/development/acceptance-app/editor-links.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('Error overlay - editor links', () => {
8383
await clickSourceFile(browser)
8484
await check(() => editorRequestsCount, /1/)
8585
})
86-
;(process.env.TURBOPACK ? describe.skip : describe)(
86+
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
8787
'opening links in import traces',
8888
() => {
8989
it('should be possible to open import trace files on RSC parse error', async () => {

test/development/acceptance-app/invalid-imports.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('Error Overlay invalid imports', () => {
6464
await session.patch(pageFile, withoutUseClient)
6565

6666
await session.assertHasRedbox()
67-
if (process.env.TURBOPACK) {
67+
if (process.env.IS_TURBOPACK_TEST) {
6868
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
6969
"./app
7070
Invalid import
@@ -146,7 +146,7 @@ describe('Error Overlay invalid imports', () => {
146146
await session.patch(pageFile, withoutUseClient)
147147

148148
await session.assertHasRedbox()
149-
if (process.env.TURBOPACK) {
149+
if (process.env.IS_TURBOPACK_TEST) {
150150
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
151151
"./node_modules/client-only-package
152152
Invalid import
@@ -226,7 +226,7 @@ describe('Error Overlay invalid imports', () => {
226226
await session.patch(file, "'use client'\n" + content)
227227

228228
await session.assertHasRedbox()
229-
if (process.env.TURBOPACK) {
229+
if (process.env.IS_TURBOPACK_TEST) {
230230
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
231231
"./node_modules/server-only-package
232232
Invalid import

test/development/acceptance-app/rsc-build-errors.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ describe('Error overlay - RSC build errors', () => {
345345
await expect(session.getRedboxSource()).resolves.toMatch(
346346
/must be a Client \n| Component/
347347
)
348-
if (process.env.TURBOPACK) {
348+
if (process.env.IS_TURBOPACK_TEST) {
349349
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
350350
.toMatchInlineSnapshot(`
351351
"./app/server-with-errors/error-file/error.js (1:1)

test/development/acceptance-app/version-staleness.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('Error Overlay version staleness', () => {
4747

4848
await session.openRedbox()
4949

50-
if (process.env.TURBOPACK) {
50+
if (process.env.IS_TURBOPACK_TEST) {
5151
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
5252
"Next.js 1.0.0 (outdated)
5353
Turbopack"
@@ -89,7 +89,7 @@ describe('Error Overlay version staleness', () => {
8989
`
9090
)
9191

92-
if (process.env.TURBOPACK) {
92+
if (process.env.IS_TURBOPACK_TEST) {
9393
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
9494
"Next.js 2.0.0 (outdated)
9595
Turbopack"
@@ -128,7 +128,7 @@ describe('Error Overlay version staleness', () => {
128128
`
129129
)
130130

131-
if (process.env.TURBOPACK) {
131+
if (process.env.IS_TURBOPACK_TEST) {
132132
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
133133
"Next.js 3.0.0 (outdated)
134134
Turbopack"

test/development/acceptance/ReactRefreshLogBox.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ describe('ReactRefreshLogBox', () => {
367367
`
368368
)
369369

370-
if (process.env.TURBOPACK) {
370+
if (process.env.IS_TURBOPACK_TEST) {
371371
await expect(browser).toDisplayRedbox(`
372372
{
373373
"count": 1,

test/development/acceptance/server-component-compiler-errors-in-pages.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
5151
/That only works in a Server Component/
5252
)
5353

54-
if (process.env.TURBOPACK) {
54+
if (process.env.IS_TURBOPACK_TEST) {
5555
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
5656
.toMatchInlineSnapshot(`
5757
"./components/Comp.js (1:1)
@@ -128,7 +128,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
128128
/That only works in a Server Component/
129129
)
130130

131-
if (process.env.TURBOPACK) {
131+
if (process.env.IS_TURBOPACK_TEST) {
132132
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
133133
.toMatchInlineSnapshot(`
134134
"./components/Comp.js (1:1)
@@ -207,7 +207,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
207207
/That only works in a Server Component/
208208
)
209209

210-
if (process.env.TURBOPACK) {
210+
if (process.env.IS_TURBOPACK_TEST) {
211211
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
212212
.toMatchInlineSnapshot(`
213213
"./components/Comp.js (1:10)

test/development/app-dir/server-component-next-dynamic-ssr-false/server-component-next-dynamic-ssr-false.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
1818
source: await getRedboxSource(browser),
1919
}
2020

21-
if (process.env.TURBOPACK) {
21+
if (process.env.IS_TURBOPACK_TEST) {
2222
expect(redbox.description).toMatchInlineSnapshot(
2323
`"Ecmascript file had an error"`
2424
)

test/development/basic/allowed-dev-origins.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe.each([['', '/docs']])(
172172
await retry(async () => {
173173
// TODO: These requests seem to be blocked regardless of our handling only when running with Turbopack
174174
// Investigate why this is the case
175-
if (!process.env.TURBOPACK) {
175+
if (!process.env.IS_TURBOPACK_TEST) {
176176
expect(await browser.elementByCss('#status').text()).toBe('OK')
177177
}
178178

test/development/basic/barrel-optimization/barrel-optimization-mui.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { nextTestSetup } from 'e2e-utils'
33
import { assertNoRedbox } from 'next-test-utils'
44

55
// Skipped in Turbopack, will be added later.
6-
;(process.env.TURBOPACK ? describe.skip : describe)(
6+
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
77
'Skipped in Turbopack',
88
() => {
99
describe('optimizePackageImports - mui', () => {

test/development/basic/barrel-optimization/barrel-optimization.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { join } from 'path'
22
import { nextTestSetup } from 'e2e-utils'
33
// Skipped in Turbopack, will be added later.
4-
;(process.env.TURBOPACK ? describe.skip : describe)(
4+
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
55
'Skipped in Turbopack',
66
() => {
77
describe('optimizePackageImports - basic', () => {

test/development/basic/hmr/error-recovery.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe.each([
9999
throw err
100100
}
101101
})
102-
;(process.env.TURBOPACK ? it.skip : it)(
102+
;(process.env.IS_TURBOPACK_TEST ? it.skip : it)(
103103
// this test fails frequently with turbopack
104104
'should not continously poll a custom error page',
105105
async () => {
@@ -171,7 +171,7 @@ describe.each([
171171
await getRedboxSource(browser)
172172
)
173173

174-
if (basePath === '' && process.env.TURBOPACK) {
174+
if (basePath === '' && process.env.IS_TURBOPACK_TEST) {
175175
expect(source).toMatchInlineSnapshot(`
176176
"./pages/hmr/about2.js (7:1)
177177
Parsing ecmascript source code failed
@@ -234,7 +234,7 @@ describe.each([
234234
Import trace for requested module:
235235
./pages/hmr/about2.js"
236236
`)
237-
} else if (basePath === '/docs' && process.env.TURBOPACK) {
237+
} else if (basePath === '/docs' && process.env.IS_TURBOPACK_TEST) {
238238
expect(source).toMatchInlineSnapshot(`
239239
"./pages/hmr/about2.js (7:1)
240240
Parsing ecmascript source code failed
@@ -308,7 +308,7 @@ describe.each([
308308
})
309309
})
310310

311-
if (!process.env.TURBOPACK) {
311+
if (!process.env.IS_TURBOPACK_TEST) {
312312
// Turbopack doesn't have this restriction
313313
it('should show the error on all pages', async () => {
314314
const aboutPage = join('pages', 'hmr', 'about2.js')
@@ -577,7 +577,7 @@ describe.each([
577577
await assertHasRedbox(browser)
578578
expect(await getRedboxHeader(browser)).toMatch('Build Error')
579579

580-
if (process.env.TURBOPACK) {
580+
if (process.env.IS_TURBOPACK_TEST) {
581581
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
582582
"./components/parse-error.xyz
583583
Unknown module type
@@ -670,7 +670,7 @@ describe.each([
670670
let redboxSource = await getRedboxSource(browser)
671671

672672
redboxSource = redboxSource.replace(`${next.testDir}`, '.')
673-
if (process.env.TURBOPACK) {
673+
if (process.env.IS_TURBOPACK_TEST) {
674674
expect(next.normalizeTestDirContent(redboxSource))
675675
.toMatchInlineSnapshot(`
676676
"./components/parse-error.js (3:1)
@@ -829,7 +829,7 @@ describe.each([
829829
}
830830
})
831831

832-
if (!process.env.TURBOPACK) {
832+
if (!process.env.IS_TURBOPACK_TEST) {
833833
it('should have client HMR events in trace file', async () => {
834834
const traceData = await next.readFile('.next/trace')
835835
expect(traceData).toContain('client-hmr-latency')

test/development/basic/next-dynamic/next-dynamic.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('next/dynamic', () => {
4040
[`${srcPrefix}/pages/_document.js`]: customDocumentGipContent,
4141
}),
4242
// When it's not turbopack and babel is enabled, we add a .babelrc file.
43-
...(!process.env.TURBOPACK &&
43+
...(!process.env.IS_TURBOPACK_TEST &&
4444
process.env.TEST_BABEL === '1' && {
4545
'.babelrc': `{ "presets": ["next/babel"] }`,
4646
}),
@@ -58,15 +58,15 @@ describe('next/dynamic', () => {
5858
}
5959

6060
// Turbopack doesn't support babel.
61-
;(process.env.TURBOPACK && process.env.TEST_BABEL === '1'
61+
;(process.env.IS_TURBOPACK_TEST && process.env.TEST_BABEL === '1'
6262
? describe.skip
6363
: describe)('Dynamic import', () => {
6464
describe('default behavior', () => {
6565
it('should render dynamic import components', async () => {
6666
const $ = await get$(basePath + '/dynamic/ssr')
6767
// Make sure the client side knows it has to wait for the bundle
6868
expect(JSON.parse($('#__NEXT_DATA__').html()).dynamicIds).toContain(
69-
process.env.TURBOPACK
69+
process.env.IS_TURBOPACK_TEST
7070
? '[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)'
7171
: 'pages/dynamic/ssr.js -> ../../components/hello1'
7272
)
@@ -77,7 +77,7 @@ describe('next/dynamic', () => {
7777
const $ = await get$(basePath + '/dynamic/function')
7878
// Make sure the client side knows it has to wait for the bundle
7979
expect(JSON.parse($('#__NEXT_DATA__').html()).dynamicIds).toContain(
80-
process.env.TURBOPACK
80+
process.env.IS_TURBOPACK_TEST
8181
? '[project]/components/hello1.js [client] (ecmascript, next/dynamic entry)'
8282
: 'pages/dynamic/function.js -> ../../components/hello1'
8383
)
@@ -224,7 +224,7 @@ describe('next/dynamic', () => {
224224
}
225225
})
226226
// Turbopack doesn't have this feature.
227-
;(process.env.TURBOPACK ? describe.skip : describe)(
227+
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
228228
'custom chunkfilename',
229229
() => {
230230
it('should render the correct filename', async () => {
@@ -279,7 +279,7 @@ describe('next/dynamic', () => {
279279
})
280280

281281
// TODO: Make this test work with Turbopack. Currently the test relies on `chunkFileName` which is not supported by Turbopack.
282-
;(process.env.TURBOPACK ? describe.skip : describe)(
282+
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
283283
'Multiple modules',
284284
() => {
285285
it('should only include the rendered module script tag', async () => {

test/development/basic/styled-components-disabled.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { retry } from 'next-test-utils'
66

77
// TODO: Somehow the warning doesn't show up with Turbopack, even though the transform is not enabled.
88
// TODO: It no longer shows up with Webpack either in tests. Manual repro does work though.
9-
;(process.env.TURBOPACK ? describe.skip : describe.skip)(
9+
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe.skip)(
1010
'styled-components SWC transform',
1111
() => {
1212
let next: NextInstance

test/development/next-font/font-loader-in-document-error.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('font-loader-in-document-error', () => {
1919
test('next/font inside _document', async () => {
2020
const browser = await webdriver(next.url, '/')
2121
await assertHasRedbox(browser)
22-
if (process.env.TURBOPACK) {
22+
if (process.env.IS_TURBOPACK_TEST) {
2323
// TODO: Turbopack doesn't include pages/
2424
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
2525
"./_document.js

0 commit comments

Comments
 (0)