forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathturbo.ts
More file actions
34 lines (30 loc) · 1.05 KB
/
turbo.ts
File metadata and controls
34 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
let loggedTurbopack = false
/**
* Utility function to determine if a given test case needs to run with --turbo.
*
* This is primarily for the gradual test enablement with latest turbopack upstream changes.
*
* Note: it could be possible to dynamically create test cases itself (createDevTest(): it.each([...])), but
* it makes hard to conform with existing lint rules. Instead, starting off from manual fixture setup and
* update test cases accordingly as turbopack changes enable more test cases.
*/
export function shouldRunTurboDevTest(): boolean {
if (!!process.env.TEST_WASM) {
return false
}
const shouldRunTurboDev = !!process.env.TURBOPACK
if (shouldRunTurboDev && !loggedTurbopack) {
require('console').log(
`Running tests with turbopack because environment variable TURBOPACK is set`
)
loggedTurbopack = true
}
return shouldRunTurboDev
}
export function getTurbopackFlag(): string {
if (!!process.env.TURBOPACK) {
return '--turbo'
} else {
throw Error(`Cannot get the flag for running turbopack`)
}
}