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
c66662b9
Unverified
Commit
c66662b9
authored
Jul 01, 2026
by
Niklas Mischkulnig
Committed by
GitHub
Jul 01, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: Improve immutable static asset tests (#95349)
Cleanup and improve tests
parent
c5b8ea43
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
36 deletions
+27
-36
asset-prefix-absolute-no-path.test.ts
...set-prefix-absolute/asset-prefix-absolute-no-path.test.ts
+1
-4
asset-prefix-absolute.test.ts
...p-dir/asset-prefix-absolute/asset-prefix-absolute.test.ts
+0
-3
asset-prefix-with-basepath.test.ts
...t-prefix-with-basepath/asset-prefix-with-basepath.test.ts
+1
-4
asset-prefix.test.ts
test/e2e/app-dir/asset-prefix/asset-prefix.test.ts
+1
-4
deployment-id-handling.test.ts
...ion/deployment-id-handling/deployment-id-handling.test.ts
+24
-21
No files found.
test/e2e/app-dir/asset-prefix-absolute/asset-prefix-absolute-no-path.test.ts
View file @
c66662b9
...
...
@@ -14,10 +14,7 @@ describe('app-dir absolute assetPrefix', () => {
let
bundles
=
[]
for
(
const
script
of
$
(
'script'
).
toArray
())
{
const
{
src
}
=
script
.
attribs
if
(
src
?.
includes
(
'https://example.vercel.sh/_next/static'
)
||
src
?.
includes
(
'https://example.vercel.sh/_next/static/immutable'
)
)
{
if
(
src
?.
includes
(
'https://example.vercel.sh/_next/static'
))
{
bundles
.
push
(
src
)
}
}
...
...
test/e2e/app-dir/asset-prefix-absolute/asset-prefix-absolute.test.ts
View file @
c66662b9
...
...
@@ -17,9 +17,6 @@ describe('app-dir absolute assetPrefix', () => {
if
(
src
?.
startsWith
(
'https://example.vercel.sh/custom-asset-prefix/_next/static'
)
||
src
?.
startsWith
(
'https://example.vercel.sh/custom-asset-prefix/_next/static/immutable'
)
)
{
bundles
.
push
(
src
)
...
...
test/e2e/app-dir/asset-prefix-with-basepath/asset-prefix-with-basepath.test.ts
View file @
c66662b9
...
...
@@ -40,10 +40,7 @@ describe('app-dir assetPrefix with basePath handling', () => {
let
bundles
=
[]
for
(
const
script
of
$
(
'script'
).
toArray
())
{
const
{
src
}
=
script
.
attribs
if
(
src
?.
includes
(
'/custom-asset-prefix/_next/static'
)
||
src
?.
includes
(
'/custom-asset-prefix/_next/static/immutable'
)
)
{
if
(
src
?.
includes
(
'/custom-asset-prefix/_next/static'
))
{
bundles
.
push
(
src
)
}
}
...
...
test/e2e/app-dir/asset-prefix/asset-prefix.test.ts
View file @
c66662b9
...
...
@@ -38,10 +38,7 @@ describe('app-dir assetPrefix handling', () => {
let
bundles
=
[]
for
(
const
script
of
$
(
'script'
).
toArray
())
{
const
{
src
}
=
script
.
attribs
if
(
src
?.
includes
(
'/custom-asset-prefix/_next/static'
)
||
src
?.
includes
(
'/custom-asset-prefix/_next/static/immutable'
)
)
{
if
(
src
?.
includes
(
'/custom-asset-prefix/_next/static'
))
{
bundles
.
push
(
src
)
}
}
...
...
test/production/deployment-id-handling/deployment-id-handling.test.ts
View file @
c66662b9
...
...
@@ -3,6 +3,14 @@ import { NextAdapter } from 'next'
import
{
retry
}
from
'next-test-utils'
import
{
join
}
from
'node:path'
const
immutableAssetsFilter
=
(
p
)
=>
p
.
includes
(
'/_next/static/'
)
&&
!
(
p
.
includes
(
'/_buildManifest.js'
)
||
p
.
includes
(
'/_clientMiddlewareManifest.js'
)
||
p
.
includes
(
'/_ssgManifest.js'
)
)
describe
.
each
([
[
'NEXT_DEPLOYMENT_ID'
,
''
],
[
'CUSTOM_DEPLOYMENT_ID'
,
''
],
...
...
@@ -11,17 +19,15 @@ describe.each([
])(
'deployment-id-handling enabled with %s%s'
,
(
envKey
,
runtimeServerDeploymentId
)
=>
{
if
(
envKey
===
'NEXT_DEPLOYMENT_ID_IMMUTABLE'
&&
!
process
.
env
.
IS_TURBOPACK_TEST
)
{
const
usesImmutableAssets
=
envKey
===
'NEXT_DEPLOYMENT_ID_IMMUTABLE'
if
(
usesImmutableAssets
&&
!
process
.
env
.
IS_TURBOPACK_TEST
)
{
it
.
skip
(
'skip for webpack'
,
()
=>
{})
return
}
const
deploymentId
=
Date
.
now
()
+
''
const
immutableAssetToken
=
envKey
===
'NEXT_DEPLOYMENT_ID_IMMUTABLE'
?
''
:
deploymentId
const
immutableAssetToken
=
usesImmutableAssets
?
''
:
deploymentId
const
{
next
}
=
nextTestSetup
({
files
:
join
(
__dirname
,
'app'
),
...
...
@@ -35,11 +41,12 @@ describe.each([
})
const
validateTokenForRequest
=
(
url
:
string
)
=>
{
const
token
=
url
.
includes
(
'/_next/static/immutable/'
)
?
// Turbopack-emitted chunks
immutableAssetToken
:
// e.g. /_next/static/build-id/_ssgManifest.js
deploymentId
const
token
=
usesImmutableAssets
&&
immutableAssetsFilter
(
url
)
?
// Turbopack-emitted chunks
immutableAssetToken
:
// e.g. /_next/static/build-id/_ssgManifest.js
deploymentId
if
(
token
)
{
expect
(
url
).
toContain
(
'dpl='
+
token
)
}
else
{
...
...
@@ -184,19 +191,13 @@ describe.each([
)
})
if
(
envKey
===
'NEXT_DEPLOYMENT_ID_IMMUTABLE'
)
{
if
(
usesImmutableAssets
)
{
it
(
'should emit hashes to adapter'
,
async
()
=>
{
const
{
outputs
}:
Parameters
<
NextAdapter
[
'onBuildComplete'
]
>
[
0
]
=
await
next
.
readJSON
(
'build-complete.json'
)
const
immutableAssets
=
outputs
.
staticFiles
.
filter
(
(
a
)
=>
a
.
pathname
.
startsWith
(
'/_next/static/'
)
&&
!
(
a
.
pathname
.
endsWith
(
'/_buildManifest.js'
)
||
a
.
pathname
.
endsWith
(
'/_clientMiddlewareManifest.js'
)
||
a
.
pathname
.
endsWith
(
'/_ssgManifest.js'
)
)
const
immutableAssets
=
outputs
.
staticFiles
.
filter
((
p
)
=>
immutableAssetsFilter
(
p
.
pathname
)
)
expect
(
immutableAssets
).
not
.
toBeEmpty
()
expect
(
immutableAssets
).
toSatisfyAll
(
...
...
@@ -205,7 +206,9 @@ describe.each([
// This check also ensure that we don't accidentally forget to content hash sourcemap
// files (i.e. 0cz1d0mv5g_q7.js is content hashed, but 0cz1d0mv5g_q7.js.map is not a
// content hash of itself)..
f
.
immutableHash
&&
f
.
pathname
.
includes
(
f
.
immutableHash
.
slice
(
0
,
13
))
f
.
immutableHash
&&
f
.
pathname
.
includes
(
f
.
immutableHash
.
slice
(
0
,
13
))
&&
f
.
pathname
.
startsWith
(
'/_next/static/immutable'
)
)
})
}
...
...
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