fix app-prefetch-false-loading deploy test (#66811)

This gates the part that depends on runtime logs. This test is still
valuable without this particular check.
This commit is contained in:
Zack Tanner 2024-06-12 17:13:24 -07:00 committed by GitHub
parent 107a45fa6c
commit 7c97f56bfd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 8 deletions

View file

@ -33,7 +33,6 @@
"test/e2e/app-dir/rsc-webpack-loader/rsc-webpack-loader.test.ts",
"test/e2e/swc-warnings/index.test.ts",
"test/e2e/third-parties/index.test.ts",
"test/e2e/app-dir/app-prefetch-false-loading/app-prefetch-false-loading.test.ts",
"test/e2e/app-dir/app-routes-client-component/app-routes-client-component.test.ts",
"test/e2e/app-dir/app-routes/app-custom-route-base-path.test.ts",
"test/e2e/app-dir/mdx/mdx.test.ts",

View file

@ -2,7 +2,7 @@ import { nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils'
describe('app-prefetch-false-loading', () => {
const { next } = nextTestSetup({
const { next, isNextDeploy } = nextTestSetup({
files: __dirname,
})
@ -28,12 +28,17 @@ describe('app-prefetch-false-loading', () => {
expect(initialRandomNumber).toBe(newRandomNumber)
await check(() => {
const logOccurrences =
next.cliOutput.slice(logStartIndex).split('re-fetching in layout')
.length - 1
// Deploy doesn't have access to runtime logs. This assertion is also redundant since if
// the layout was re-fetched, the `no-store` on the random number would have resulted in a new value.
// Keeping this here for consistency with the original test.
if (!isNextDeploy) {
await check(() => {
const logOccurrences =
next.cliOutput.slice(logStartIndex).split('re-fetching in layout')
.length - 1
return logOccurrences
}, 1)
return logOccurrences
}, 1)
}
})
})