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
1a9ee198
Commit
1a9ee198
authored
Sep 30, 2025
by
Niklas Mischkulnig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve `should encode chunk path correctly` test
parent
347adf54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
43 deletions
+42
-43
index.test.ts
test/e2e/app-dir/app/index.test.ts
+42
-43
No files found.
test/e2e/app-dir/app/index.test.ts
View file @
1a9ee198
...
@@ -13,26 +13,25 @@ import {
...
@@ -13,26 +13,25 @@ import {
const
isPPREnabledByDefault
=
process
.
env
.
__NEXT_EXPERIMENTAL_PPR
===
'true'
const
isPPREnabledByDefault
=
process
.
env
.
__NEXT_EXPERIMENTAL_PPR
===
'true'
describe
(
'app dir - basic'
,
()
=>
{
describe
(
'app dir - basic'
,
()
=>
{
const
{
next
,
isNextDev
,
isNextStart
,
isNextDeploy
,
isTurbopack
}
=
const
{
next
,
isNextDev
,
isNextStart
,
isNextDeploy
}
=
nextTestSetup
({
nextTestSetup
({
files
:
__dirname
,
files
:
__dirname
,
buildCommand
:
process
.
env
.
NEXT_EXPERIMENTAL_COMPILE
buildCommand
:
process
.
env
.
NEXT_EXPERIMENTAL_COMPILE
?
'pnpm compile-mode'
?
'pnpm compile-mode'
:
undefined
,
:
undefined
,
packageJson
:
{
packageJson
:
{
scripts
:
{
scripts
:
{
'compile-mode'
:
process
.
env
.
NEXT_EXPERIMENTAL_COMPILE
'compile-mode'
:
process
.
env
.
NEXT_EXPERIMENTAL_COMPILE
?
`next build --experimental-build-mode=compile && next build --experimental-build-mode=generate-env`
?
`next build --experimental-build-mode=compile && next build --experimental-build-mode=generate-env`
:
undefined
,
:
undefined
,
},
},
dependencies
:
{
nanoid
:
'4.0.1'
,
},
env
:
{
NEXT_PUBLIC_TEST_ID
:
Date
.
now
()
+
''
,
},
},
})
},
dependencies
:
{
nanoid
:
'4.0.1'
,
},
env
:
{
NEXT_PUBLIC_TEST_ID
:
Date
.
now
()
+
''
,
},
})
if
(
isNextStart
)
{
if
(
isNextStart
)
{
it
(
'should have correct cache-control for SSR routes'
,
async
()
=>
{
it
(
'should have correct cache-control for SSR routes'
,
async
()
=>
{
...
@@ -169,32 +168,32 @@ describe('app dir - basic', () => {
...
@@ -169,32 +168,32 @@ describe('app dir - basic', () => {
})
})
}
}
// Turbopack has different chunking in dev/production which results in the entrypoint name not being included in the outputs.
it
(
'should encode chunk path correctly'
,
async
()
=>
{
if
(
!
process
.
env
.
IS_TURBOPACK_TEST
)
{
const
requests
=
[]
it
(
'should encode chunk path correctly'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/dynamic-client/first/second'
,
{
await
next
.
fetch
(
'/dynamic-client/first/second'
)
beforePageLoad
(
page
)
{
const
browser
=
await
next
.
browser
(
'/'
)
page
.
on
(
'request'
,
(
req
)
=>
{
const
requests
=
[]
requests
.
push
(
req
.
url
())
browser
.
on
(
'request'
,
(
req
)
=>
{
})
requests
.
push
(
req
.
url
())
},
})
})
await
browser
.
eval
(
await
browser
.
waitForElementByCss
(
'#id-page-params'
)
'window.location.href = "/dynamic-client/first/second"'
)
await
browser
.
waitForElementByCss
(
'#id-page-params'
)
expect
(
requests
).
not
.
toEqual
(
expect
.
arrayContaining
([
expect
.
stringContaining
(
'[category]'
)])
)
expect
(
// Turbopack doesn't recreate the original folder structure for the output chunks
requests
.
some
(
if
(
!
process
.
env
.
IS_TURBOPACK_TEST
)
{
(
req
)
=>
expect
(
requests
).
toEqual
(
req
.
includes
(
// e.g. _next/static/chunks/app/dynamic-client/%5Bcategory%5D/%5Bid%5D/page-6e188d657a208f8e.js
encodeURI
(
isTurbopack
?
'[category]_[id]'
:
'/[category]/[id]'
)
expect
.
arrayContaining
([
)
&&
req
.
includes
(
'.js'
)
expect
.
stringMatching
(
/.*%5Bcategory%5D
\/
%5Bid%5D.*
\.
js$/
),
)
]
)
)
.
toBe
(
true
)
)
}
)
}
}
}
)
it
.
each
([
it
.
each
([
{
pathname
:
'/redirect-1'
},
{
pathname
:
'/redirect-1'
},
...
@@ -393,7 +392,7 @@ describe('app dir - basic', () => {
...
@@ -393,7 +392,7 @@ describe('app dir - basic', () => {
it
(
'should serve polyfills for browsers that do not support modules'
,
async
()
=>
{
it
(
'should serve polyfills for browsers that do not support modules'
,
async
()
=>
{
const
html
=
await
next
.
render
(
'/dashboard/index'
)
const
html
=
await
next
.
render
(
'/dashboard/index'
)
expect
(
html
).
toMatch
(
expect
(
html
).
toMatch
(
isTurbopack
process
.
env
.
IS_TURBOPACK_TEST
?
/<script src="
\/
_next
\/
static
\/
chunks
\/([\w
-
]
*polyfill-nomodule|
[
0-9a-f
]
+
)\.
js" noModule="">/
?
/<script src="
\/
_next
\/
static
\/
chunks
\/([\w
-
]
*polyfill-nomodule|
[
0-9a-f
]
+
)\.
js" noModule="">/
:
/<script src="
\/
_next
\/
static
\/
chunks
\/
polyfills
(
-
\w
+
)?\.
js" noModule="">/
:
/<script src="
\/
_next
\/
static
\/
chunks
\/
polyfills
(
-
\w
+
)?\.
js" noModule="">/
)
)
...
...
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