mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? Changing an env var that is used in an RSC doesn't lead to HMR updates. It only refetches the RSC stream and no compilation happens at all since the env var is consumed only at runtime. This test did pass before as the `run_once` created a task for the `project_update` and we counted that as computation. Changing this to `turbo_tasks::run` removes the once task and no computation happens at all.
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { FileRef, nextTestSetup } from 'e2e-utils'
|
|
import { retry } from 'next-test-utils'
|
|
import path from 'path'
|
|
|
|
const envFile = '.env.development.local'
|
|
|
|
describe(`app-dir hmr-env`, () => {
|
|
const { next } = nextTestSetup({
|
|
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
|
|
patchFileDelay: 1000,
|
|
})
|
|
|
|
it.each(['node', 'node-module-var', 'edge', 'edge-module-var'])(
|
|
'should update server components pages when env files is changed (%s)',
|
|
async (page) => {
|
|
const browser = await next.browser(`/env/${page}`)
|
|
expect(await browser.elementByCss('p').text()).toBe('mac')
|
|
|
|
await next.patchFile(envFile, 'MY_DEVICE="ipad"', async () => {
|
|
await retry(async () => {
|
|
expect(await browser.elementByCss('p').text()).toBe('ipad')
|
|
})
|
|
})
|
|
|
|
// ensure it's restored back to "mac" before the next test
|
|
await retry(async () => {
|
|
expect(await browser.elementByCss('p').text()).toBe('mac')
|
|
})
|
|
|
|
expect(next.cliOutput).not.toContain('FATAL')
|
|
}
|
|
)
|
|
})
|