MCPcopy
hub / github.com/vercel/next.js / getSnapshotTestDescribe

Function getSnapshotTestDescribe

test/lib/next-test-utils.ts:1507–1521  ·  view source on GitHub ↗
(variant: TestVariants)

Source from the content-addressed store, hash-verified

1505// test snapshot when run against turbo. This fn returns describe, or describe.skip dependes on the running context
1506// to avoid force-snapshot update per each runs until turbopack update includes all the changes.
1507export function getSnapshotTestDescribe(variant: TestVariants) {
1508 const runningEnv = variant ?? 'default'
1509 if (runningEnv !== 'default' && runningEnv !== 'turbo') {
1510 throw new Error(
1511 `An invalid test env was passed: ${variant} (only "default" and "turbo" are valid options)`
1512 )
1513 }
1514
1515 const shouldRunTurboDev = shouldUseTurbopack()
1516 const shouldSkip =
1517 (runningEnv === 'turbo' && !shouldRunTurboDev) ||
1518 (runningEnv === 'default' && shouldRunTurboDev)
1519
1520 return shouldSkip ? describe.skip : describe
1521}
1522
1523const nextjsClientComponentNames = [
1524 // Pages Router

Callers

nothing calls this directly

Calls 1

shouldUseTurbopackFunction · 0.90

Tested by

no test coverage detected