File size: 1,092 Bytes
1e92f2d |
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 35 |
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.NEXT_TEST_WASM) {
return false
}
const shouldRunTurboDev = !!process.env.IS_TURBOPACK_TEST
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.IS_TURBOPACK_TEST) {
return '--turbo'
} else {
throw Error(`Cannot get the flag for running turbopack`)
}
}
|