Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
6aa630c6
Unverified
Commit
6aa630c6
authored
Jun 24, 2025
by
Jiachi Liu
Committed by
GitHub
Jun 24, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] separate hmr env test (#80802)
parent
370b0971
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
44 deletions
+56
-44
hmr-env.test.ts
test/development/app-hmr/hmr-env.test.ts
+56
-0
hmr.test.ts
test/development/app-hmr/hmr.test.ts
+0
-44
No files found.
test/development/app-hmr/hmr-env.test.ts
0 → 100644
View file @
6aa630c6
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
()
=>
{
let
logs
await
retry
(
async
()
=>
{
logs
=
await
browser
.
log
()
expect
(
logs
).
toEqual
(
expect
.
arrayContaining
([
expect
.
objectContaining
({
message
:
expect
.
stringContaining
(
'[Fast Refresh] done'
),
source
:
'log'
,
}),
])
)
})
await
retry
(
async
()
=>
{
expect
(
await
browser
.
elementByCss
(
'p'
).
text
()).
toBe
(
'ipad'
)
})
expect
(
logs
).
toEqual
(
expect
.
arrayContaining
([
expect
.
objectContaining
({
message
:
expect
.
stringContaining
(
'[Fast Refresh] done in'
),
source
:
'log'
,
}),
])
)
})
// 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'
)
}
)
})
test/development/app-hmr/hmr.test.ts
View file @
6aa630c6
...
...
@@ -107,50 +107,6 @@ describe(`app-dir-hmr`, () => {
expect
(
next
.
cliOutput
).
not
.
toContain
(
'FATAL'
)
})
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
()
=>
{
let
logs
await
retry
(
async
()
=>
{
logs
=
await
browser
.
log
()
expect
(
logs
).
toEqual
(
expect
.
arrayContaining
([
expect
.
objectContaining
({
message
:
expect
.
stringContaining
(
'[Fast Refresh] done'
),
source
:
'log'
,
}),
])
)
})
await
retry
(
async
()
=>
{
expect
(
await
browser
.
elementByCss
(
'p'
).
text
()).
toBe
(
'ipad'
)
})
expect
(
logs
).
toEqual
(
expect
.
arrayContaining
([
expect
.
objectContaining
({
message
:
expect
.
stringContaining
(
'[Fast Refresh] done in'
),
source
:
'log'
,
}),
])
)
})
// 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'
)
}
)
it
(
'should have no unexpected action error for hmr'
,
async
()
=>
{
expect
(
next
.
cliOutput
).
not
.
toContain
(
'Unexpected action'
)
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment