Skip to content

Commit

Permalink
test(integration): fix --turbo tests fixture setup (#55293)
Browse files Browse the repository at this point in the history
### What?

Update few test fixture setup doesn't invoke --turbo based on the conditions.

Closes WEB-1543
  • Loading branch information
kwonoj authored Sep 18, 2023
1 parent f393f55 commit 1105501
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 18 deletions.
5 changes: 4 additions & 1 deletion test/development/basic/barrel-optimization.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { join } from 'path'
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { shouldRunTurboDevTest } from '../../lib/next-test-utils'

describe('optimizePackageImports', () => {
let next: NextInstance
Expand All @@ -27,7 +28,9 @@ describe('optimizePackageImports', () => {
scripts: {
setup: `cp -r ./node_modules_bak/* ./node_modules`,
build: `yarn setup && next build`,
dev: `yarn setup && next dev`,
dev: `yarn setup && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start',
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { createNextDescribe } from 'e2e-utils'
import https from 'https'
import { renderViaHTTP } from 'next-test-utils'
import { renderViaHTTP, shouldRunTurboDevTest } from 'next-test-utils'

createNextDescribe(
'experimental-https-server (generated certificate)',
{
files: __dirname,
startCommand: 'yarn next dev --experimental-https',
startCommand: `yarn next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
} --experimental-https`,
skipStart: !process.env.CI,
},
({ next }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { createNextDescribe } from 'e2e-utils'
import https from 'https'
import { renderViaHTTP } from 'next-test-utils'
import { renderViaHTTP, shouldRunTurboDevTest } from 'next-test-utils'

createNextDescribe(
'experimental-https-server (provided certificate)',
{
files: __dirname,
startCommand:
'yarn next dev --experimental-https --experimental-https-key ./certificates/localhost-key.pem --experimental-https-cert ./certificates/localhost.pem',
startCommand: `yarn next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
} --experimental-https --experimental-https-key ./certificates/localhost-key.pem --experimental-https-cert ./certificates/localhost.pem`,
},
({ next }) => {
const agent = new https.Agent({
Expand Down
10 changes: 6 additions & 4 deletions test/development/typescript-auto-install/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { check, renderViaHTTP } from 'next-test-utils'
import { check, renderViaHTTP, shouldRunTurboDevTest } from 'next-test-utils'
import webdriver from 'next-webdriver'
import stripAnsi from 'strip-ansi'

Expand All @@ -11,9 +11,9 @@ describe('typescript-auto-install', () => {
next = await createNext({
files: {
'pages/index.js': `
export default function Page() {
export default function Page() {
return <p>hello world</p>
}
}
`,
},
env: {
Expand All @@ -26,7 +26,9 @@ describe('typescript-auto-install', () => {
RUN_ID: '',
BUILD_NUMBER: '',
},
startCommand: 'yarn next dev',
startCommand: `yarn next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
installCommand: 'yarn',
dependencies: {},
})
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/app-dir/app-external/app-external.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createNextDescribe } from 'e2e-utils'
import { shouldRunTurboDevTest } from '../../../lib/next-test-utils'

async function resolveStreamResponse(response: any, onData?: any) {
let result = ''
Expand Down Expand Up @@ -27,7 +28,9 @@ createNextDescribe(
scripts: {
setup: `cp -r ./node_modules_bak/* ./node_modules`,
build: 'yarn setup && next build',
dev: 'yarn setup && next dev',
dev: `yarn setup && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start',
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { fetchViaHTTP } from 'next-test-utils'
import { fetchViaHTTP, shouldRunTurboDevTest } from 'next-test-utils'

describe('Edge compiler module exports preference', () => {
let next: NextInstance
Expand Down Expand Up @@ -38,7 +38,9 @@ describe('Edge compiler module exports preference', () => {
scripts: {
setup: `cp -r ./my-lib ./node_modules`,
build: 'yarn setup && next build',
dev: 'yarn setup && next dev',
dev: `yarn setup && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start',
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createNextDescribe } from 'e2e-utils'
import { shouldRunTurboDevTest } from '../../lib/next-test-utils'

createNextDescribe(
'edge-runtime uses edge-light import specifier for packages',
Expand All @@ -8,7 +9,9 @@ createNextDescribe(
scripts: {
setup: 'cp -r ./node_modules_bak/* ./node_modules',
build: 'yarn setup && next build',
dev: 'yarn setup && next dev',
dev: `yarn setup && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start',
},
},
Expand Down
11 changes: 9 additions & 2 deletions test/e2e/middleware-general/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import fs from 'fs-extra'
import { join } from 'path'
import webdriver from 'next-webdriver'
import { NextInstance } from 'test/lib/next-modes/base'
import { check, fetchViaHTTP, waitFor } from 'next-test-utils'
import {
check,
fetchViaHTTP,
shouldRunTurboDevTest,
waitFor,
} from 'next-test-utils'
import { createNext, FileRef } from 'e2e-utils'

const urlsError = 'Please use only absolute URLs'
Expand Down Expand Up @@ -46,7 +51,9 @@ describe('Middleware Runtime', () => {
scripts: {
setup: `cp -r ./shared-package ./node_modules`,
build: 'yarn setup && next build',
dev: 'yarn setup && next dev',
dev: `yarn setup && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start',
},
},
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/transpile-packages/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'path'
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import webdriver from 'next-webdriver'
import { shouldRunTurboDevTest } from '../../lib/next-test-utils'

describe('transpile packages', () => {
let next: NextInstance
Expand All @@ -23,7 +24,9 @@ describe('transpile packages', () => {
scripts: {
setup: `cp -r ./node_modules_bak/* ./node_modules`,
build: 'yarn setup && next build',
dev: 'yarn setup && next dev',
dev: `yarn setup && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start',
},
},
Expand Down
3 changes: 2 additions & 1 deletion test/production/pnpm-support/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
initNextServerScript,
killApp,
renderViaHTTP,
shouldRunTurboDevTest,
} from 'next-test-utils'

describe('pnpm support', () => {
Expand Down Expand Up @@ -72,7 +73,7 @@ describe('pnpm support', () => {
},
packageJson: {
scripts: {
dev: 'next dev',
dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
build: 'next build',
start: 'next start',
},
Expand Down

0 comments on commit 1105501

Please sign in to comment.