mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
If a build time fetch cache is present from a previous build we don't want to unexpectedly use it when flush to disk is set to false in a successive build as it can leverage stale data unexpectedly. x-ref: [slack thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1701266754905909) Closes NEXT-1750 Co-authored-by: Zack Tanner <[email protected]>
34 lines
769 B
TypeScript
34 lines
769 B
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
|
|
createNextDescribe(
|
|
'app fetch build cache',
|
|
{
|
|
files: __dirname,
|
|
},
|
|
({ next }) => {
|
|
let initialData
|
|
|
|
it('should have done initial build', async () => {
|
|
const $ = await next.render$('/')
|
|
expect($('#page').text()).toBe('index page')
|
|
|
|
initialData = $('#data').text()
|
|
expect(initialData).toBeTruthy()
|
|
})
|
|
|
|
it('should not use stale data if present', async () => {
|
|
await next.stop()
|
|
|
|
next.env['NOW_BUILDER'] = '1'
|
|
await next.start()
|
|
|
|
const $ = await next.render$('/')
|
|
expect($('#page').text()).toBe('index page')
|
|
|
|
const newData = $('#data').text()
|
|
expect(newData).toBeTruthy()
|
|
expect(newData).not.toBe(initialData)
|
|
})
|
|
}
|
|
)
|