Unverified Commit e2de3c0b authored by Jimmy Miller's avatar Jimmy Miller Committed by GitHub

test: scope loader build dependency update to Turbopack (#99380)

Run the loader build-dependency update assertion only with Turbopack.
Webpack records `addBuildDependency` for build-cache invalidation but
does not watch it for dev recompilation, which caused this assertion to
fail in webpack CI. Replace the neighboring dependency-file test’s fixed
delay with polling so it waits for the actual update.
parent 52ee9256
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry, waitFor } from 'next-test-utils' import { retry } from 'next-test-utils'
describe('turbopack-loader-file-dependencies', () => { describe('turbopack-loader-file-dependencies', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
...@@ -16,11 +16,11 @@ describe('turbopack-loader-file-dependencies', () => { ...@@ -16,11 +16,11 @@ describe('turbopack-loader-file-dependencies', () => {
'export const magicValue = "magic-value-2";' 'export const magicValue = "magic-value-2";'
) )
await waitFor(1000) await retry(async () => {
const $2 = await next.render$('/')
const $2 = await next.render$('/') const newText = $2('p').text()
const newText = await $2('p').text() expect(newText).not.toBe(initialText)
expect(newText).not.toBe(initialText) })
}) })
it('should update when a missing dependency is created', async () => { it('should update when a missing dependency is created', async () => {
...@@ -40,6 +40,7 @@ describe('turbopack-loader-file-dependencies', () => { ...@@ -40,6 +40,7 @@ describe('turbopack-loader-file-dependencies', () => {
) )
}) })
// @force-gate turbopack
it('should update when a build dependency changes', async () => { it('should update when a build dependency changes', async () => {
const $ = await next.render$('/') const $ = await next.render$('/')
expect($('p').text()).toContain('build dependency: build-one') expect($('p').text()).toContain('build dependency: build-one')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment