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
e0e23b69
Commit
e0e23b69
authored
Jan 29, 2026
by
Niklas Mischkulnig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
header test
parent
b38c7f3b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
27 deletions
+53
-27
deployment-skew.test.ts
...dir/segment-cache/deployment-skew/deployment-skew.test.ts
+53
-27
No files found.
test/e2e/app-dir/segment-cache/deployment-skew/deployment-skew.test.ts
View file @
e0e23b69
...
...
@@ -2,12 +2,12 @@ import type * as Playwright from 'playwright'
import
webdriver
from
'next-webdriver'
import
{
createRouterAct
}
from
'router-act'
import
{
findPort
}
from
'next-test-utils'
import
{
isNextDeploy
,
isNextDev
}
from
'e2e-utils'
import
{
isNextDeploy
,
isNextDev
,
isNextStart
,
nextTestSetup
}
from
'e2e-utils'
import
{
build
,
start
}
from
'./servers.mjs'
describe
(
'segment cache (deployment skew)'
,
()
=>
{
if
(
isNextDev
||
isNextDeploy
)
{
test
(
'should not run during dev
or deploy test runs
'
,
()
=>
{})
if
(
isNextDev
)
{
test
(
'should not run during dev'
,
()
=>
{})
return
}
...
...
@@ -21,39 +21,65 @@ describe('segment cache (deployment skew)', () => {
// start a proxy server that rewrites incoming requests to one or the other
// based on the request information.
let
cleanup
:
()
=>
Promise
<
void
>
let
port
:
number
if
(
isNextStart
)
{
let
cleanup
:
()
=>
Promise
<
void
>
let
port
:
number
describe
(
'with BUILD_ID'
,
()
=>
{
beforeAll
(
async
()
=>
{
build
(
'BUILD_ID'
)
const
proxyPort
=
(
port
=
await
findPort
())
const
nextPort1
=
await
findPort
()
const
nextPort2
=
await
findPort
()
cleanup
=
await
start
(
proxyPort
,
nextPort1
,
nextPort2
,
'BUILD_ID'
)
})
describe
(
'with BUILD_ID'
,
()
=>
{
beforeAll
(
async
()
=>
{
build
(
'BUILD_ID'
)
const
proxyPort
=
(
port
=
await
findPort
())
const
nextPort1
=
await
findPort
()
const
nextPort2
=
await
findPort
()
cleanup
=
await
start
(
proxyPort
,
nextPort1
,
nextPort2
,
'BUILD_ID'
)
})
afterAll
(
async
()
=>
{
await
cleanup
()
})
afterAll
(
async
()
=>
{
await
cleanup
()
runTests
(()
=>
port
)
})
runTests
(()
=>
port
)
})
describe
(
'with NEXT_DEPLOYMENT_ID'
,
()
=>
{
beforeAll
(
async
()
=>
{
build
(
'DEPLOYMENT_ID'
)
const
proxyPort
=
(
port
=
await
findPort
())
const
nextPort1
=
await
findPort
()
const
nextPort2
=
await
findPort
()
cleanup
=
await
start
(
proxyPort
,
nextPort1
,
nextPort2
,
'DEPLOYMENT_ID'
)
})
describe
(
'with NEXT_DEPLOYMENT_ID'
,
()
=>
{
beforeAll
(
async
()
=>
{
build
(
'DEPLOYMENT_ID'
)
const
proxyPort
=
(
port
=
await
findPort
())
const
nextPort1
=
await
findPort
()
const
nextPort2
=
await
findPort
()
cleanup
=
await
start
(
proxyPort
,
nextPort1
,
nextPort2
,
'DEPLOYMENT_ID'
)
afterAll
(
async
()
=>
{
await
cleanup
()
})
runTests
(()
=>
port
)
})
}
afterAll
(
async
()
=>
{
await
cleanup
()
describe
(
'header with deployment id'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
env
:
{
// rely on skew protection when deployed
NEXT_DEPLOYMENT_ID
:
isNextDeploy
?
undefined
:
'test-deployment-id'
,
},
})
runTests
(()
=>
port
)
// Deployment skew is hard to properly e2e deploy test, so this just checks for the header
it
(
'header is set on RSC responses'
,
async
()
=>
{
for
(
const
route
of
[
'/dynamic-page'
,
'/static-page'
])
{
await
next
.
fetch
(
route
)
let
res
=
await
next
.
fetch
(
`
${
route
}
?_rsc=`
,
{
headers
:
{
rsc
:
'1'
},
})
expect
(
res
.
status
).
toBe
(
200
)
expect
(
res
.
headers
.
get
(
'content-type'
)).
toBe
(
'text/x-component'
)
expect
(
res
.
headers
.
get
(
'x-nextjs-deployment-id'
)).
toBeTruthy
()
}
})
})
})
...
...
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