next.js/test/development/app-dir/turbopack-loader-file-dependencies/turbopack-loader-file-dependencies.test.ts
turbopack-loader-file-dependencies.test.ts26 lines665 B
import { nextTestSetup } from 'e2e-utils'
import { waitFor } from 'next-test-utils'

describe('turbopack-loader-file-dependencies', () => {
  const { next } = nextTestSetup({
    files: __dirname,
  })

  it('should update when the dependency file changes', async () => {
    const $ = await next.render$('/')
    const initialText = await $('p').text()
    expect(initialText).toBeTruthy()

    await next.patchFile(
      'utils/file-dependency.ts',
      'export const magicValue = "magic-value-2";'
    )

    await waitFor(1000)

    const $2 = await next.render$('/')
    const newText = await $2('p').text()
    expect(newText).not.toBe(initialText)
  })
})
Quest for Codev2.0.0
/
SIGN IN