Skip to content

Commit eba04da

Browse files
Cleanup shouldRunTurboDevTest usage (#82603)
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
1 parent 662918f commit eba04da

File tree

13 files changed

+30
-72
lines changed

13 files changed

+30
-72
lines changed

test/development/basic/tailwind-jit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { join } from 'path'
22
import webdriver, { Playwright } from 'next-webdriver'
33
import { FileRef, nextTestSetup } from 'e2e-utils'
4-
import { check, shouldRunTurboDevTest } from 'next-test-utils'
4+
import { check } from 'next-test-utils'
55

66
// [TODO]: It is unclear why turbopack takes longer to run this test
77
// remove once it's fixed
8-
if (shouldRunTurboDevTest()) {
8+
if (process.env.IS_TURBOPACK_TEST) {
99
jest.setTimeout(1000 * 60 * 5)
1010
}
1111

test/development/experimental-https-server/https-server-opengraph-image.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import { nextTestSetup } from 'e2e-utils'
2-
import { shouldRunTurboDevTest } from 'next-test-utils'
32

43
describe('experimental-https-server OpenGraph image', () => {
54
const { next, skipped } = nextTestSetup({
65
files: __dirname,
7-
startCommand: `pnpm next ${
8-
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
9-
} --experimental-https`,
6+
startCommand: 'pnpm next dev --experimental-https',
107
skipStart: !process.env.NEXT_TEST_CI,
118
})
129
if (skipped) return

test/development/experimental-https-server/https-server.generated-key.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { nextTestSetup } from 'e2e-utils'
22
import https from 'https'
3-
import { renderViaHTTP, shouldRunTurboDevTest } from 'next-test-utils'
3+
import { renderViaHTTP } from 'next-test-utils'
44

55
describe('experimental-https-server (generated certificate)', () => {
66
const { next, skipped } = nextTestSetup({
77
files: __dirname,
8-
startCommand: `pnpm next ${
9-
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
10-
} --experimental-https`,
8+
startCommand: 'pnpm next dev --experimental-https',
119
skipStart: !process.env.NEXT_TEST_CI,
1210
})
1311
if (skipped) return

test/development/experimental-https-server/https-server.provided-key.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { nextTestSetup } from 'e2e-utils'
22
import https from 'https'
3-
import { renderViaHTTP, shouldRunTurboDevTest } from 'next-test-utils'
3+
import { renderViaHTTP } from 'next-test-utils'
44

55
describe('experimental-https-server (provided certificate)', () => {
66
const { next } = nextTestSetup({
77
files: __dirname,
8-
startCommand: `pnpm next ${
9-
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
10-
} --experimental-https --experimental-https-key ./certificates/localhost-key.pem --experimental-https-cert ./certificates/localhost.pem`,
8+
startCommand: `pnpm next dev --experimental-https --experimental-https-key ./certificates/localhost-key.pem --experimental-https-cert ./certificates/localhost.pem`,
119
})
1210
const agent = new https.Agent({
1311
rejectUnauthorized: false,

test/e2e/app-dir/app-external/app-external.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { nextTestSetup } from 'e2e-utils'
2-
import {
3-
assertNoRedbox,
4-
check,
5-
retry,
6-
shouldRunTurboDevTest,
7-
} from 'next-test-utils'
2+
import { assertNoRedbox, check, retry } from 'next-test-utils'
83

94
async function resolveStreamResponse(response: any, onData?: any) {
105
let result = ''
@@ -30,7 +25,7 @@ describe('app dir - external dependency', () => {
3025
packageJson: {
3126
scripts: {
3227
build: 'next build',
33-
dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
28+
dev: 'next dev',
3429
start: 'next start',
3530
},
3631
},

test/e2e/edge-compiler-module-exports-preference/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createNext } from 'e2e-utils'
22
import { NextInstance } from 'e2e-utils'
3-
import { fetchViaHTTP, shouldRunTurboDevTest } from 'next-test-utils'
3+
import { fetchViaHTTP } from 'next-test-utils'
44

55
describe('Edge compiler module exports preference', () => {
66
let next: NextInstance
@@ -44,7 +44,7 @@ describe('Edge compiler module exports preference', () => {
4444
packageJson: {
4545
scripts: {
4646
build: 'next build',
47-
dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
47+
dev: 'next dev',
4848
start: 'next start',
4949
},
5050
},

test/e2e/edge-runtime-uses-edge-light-import-specifier-for-packages/edge-runtime-uses-edge-light-import-specifier-for-packages.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { nextTestSetup } from 'e2e-utils'
2-
import { shouldRunTurboDevTest } from '../../lib/next-test-utils'
32

43
describe('edge-runtime uses edge-light import specifier for packages', () => {
54
const { next, skipped } = nextTestSetup({
65
files: __dirname,
76
packageJson: {
87
scripts: {
98
build: 'next build',
10-
dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
9+
dev: 'next dev',
1110
start: 'next start',
1211
},
1312
},

test/e2e/middleware-general/test/index.test.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import fs from 'fs-extra'
44
import { join } from 'path'
55
import webdriver from 'next-webdriver'
66
import { isNextStart, NextInstance } from 'e2e-utils'
7-
import {
8-
check,
9-
fetchViaHTTP,
10-
shouldRunTurboDevTest,
11-
waitFor,
12-
} from 'next-test-utils'
7+
import { check, fetchViaHTTP, waitFor } from 'next-test-utils'
138
import { createNext, FileRef } from 'e2e-utils'
149

1510
const urlsError = 'Please use only absolute URLs'
@@ -89,9 +84,7 @@ describe('Middleware Runtime', () => {
8984
scripts: {
9085
setup: `cp -r ./shared-package ./node_modules`,
9186
build: 'pnpm run setup && next build',
92-
dev: `pnpm run setup && next ${
93-
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
94-
}`,
87+
dev: 'pnpm run setup && next dev',
9588
start: 'next start',
9689
},
9790
},

test/lib/e2e-utils/index.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ import { NextInstance, NextInstanceOpts } from '../next-modes/base'
66
import { NextDevInstance } from '../next-modes/next-dev'
77
import { NextStartInstance } from '../next-modes/next-start'
88
import { NextDeployInstance } from '../next-modes/next-deploy'
9-
import { shouldRunTurboDevTest } from '../next-test-utils'
9+
import { shouldUseTurbopack } from '../next-test-utils'
1010

1111
export type { NextInstance }
1212

1313
// increase timeout to account for pnpm install time
1414
// if either test runs for the --turbo or have a custom timeout, set reduced timeout instead.
1515
// this is due to current --turbo test have a lot of tests fails with timeouts, ends up the whole
1616
// test job exceeds the 6 hours limit.
17-
let testTimeout = shouldRunTurboDevTest()
18-
? (240 * 1000) / 2
19-
: (process.platform === 'win32' ? 240 : 120) * 1000
17+
let testTimeout = (process.platform === 'win32' ? 240 : 120) * 1000
2018

2119
if (process.env.NEXT_E2E_TEST_TIMEOUT) {
2220
try {
@@ -166,7 +164,7 @@ export async function createNext(
166164
return await trace('createNext').traceAsyncFn(async (rootSpan) => {
167165
const useTurbo = !!process.env.NEXT_TEST_WASM
168166
? false
169-
: opts?.turbo ?? shouldRunTurboDevTest()
167+
: opts?.turbo ?? shouldUseTurbopack()
170168

171169
if (testMode === 'dev') {
172170
// next dev
@@ -291,8 +289,7 @@ export function nextTestSetup(
291289
},
292290
get isTurbopack(): boolean {
293291
return Boolean(
294-
!process.env.NEXT_TEST_WASM &&
295-
(options.turbo ?? shouldRunTurboDevTest())
292+
!process.env.NEXT_TEST_WASM && (options.turbo ?? shouldUseTurbopack())
296293
)
297294
},
298295

test/lib/next-modes/next-dev.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import spawn from 'cross-spawn'
22
import { Span } from 'next/dist/trace'
33
import { NextInstance } from './base'
4-
import { getTurbopackFlag } from '../turbo'
54
import { retry, waitFor } from 'next-test-utils'
65
import stripAnsi from 'strip-ansi'
76

@@ -33,7 +32,7 @@ export class NextDevInstance extends NextInstance {
3332
let startArgs = [
3433
'pnpm',
3534
'next',
36-
useTurbo ? getTurbopackFlag() : undefined,
35+
useTurbo ? '--turbopack' : undefined,
3736
].filter(Boolean) as string[]
3837

3938
if (this.startCommand) {

0 commit comments

Comments
 (0)