Skip to content

Commit

Permalink
debugg
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Jan 13, 2023
1 parent 5f2809f commit a5dc002
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/lib/next-test-utils.js
Expand Up @@ -940,3 +940,20 @@ export function shouldRunTurboDevTest() {
// If the test path matches the glob pattern, add additional case to run the test with `--turbo` flag.
return isMatch
}

// WEB-168: There are some differences / incompletes in turbopack implementation enforces jest requires to update
// test snapshot when run against turbo. This fn returns describe, or describe.skip dependes on the running context
// to avoid force-snapshot update per each runs until turbopack update includes all the changes.
export function getSnapshotTestDescribe(variant) {
const runningEnv = variant ?? 'default'
if (runningEnv !== 'default' && runningEnv !== 'turbo') {
throw new Error(`Check if test env passed correctly ${variant}`)
}

const shouldRunTurboDev = shouldRunTurboDevTest()
const shouldSkip =
(runningEnv === 'turbo' && !shouldRunTurboDev) ||
(runningEnv === 'default' && shouldRunTurboDev)

return shouldSkip ? describe.skip : describe
}

0 comments on commit a5dc002

Please sign in to comment.