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
3e0c228f
Unverified
Commit
3e0c228f
authored
Jun 09, 2025
by
Jiachi Liu
Committed by
GitHub
Jun 09, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] separate tracing error test from action test suite (#80324)
parent
d6949670
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
64 additions
and
20 deletions
+64
-20
app-action.test.ts
test/e2e/app-dir/actions/app-action.test.ts
+1
-12
actions.js
test/e2e/app-dir/actions/app/client/actions.js
+0
-7
data.txt
test/e2e/app-dir/actions/data.txt
+0
-1
action-tracing.test.ts
.../production/app-dir/action-tracing/action-tracing.test.ts
+19
-0
action.ts
test/production/app-dir/action-tracing/app/action.ts
+14
-0
layout.tsx
test/production/app-dir/action-tracing/app/layout.tsx
+8
-0
page.tsx
test/production/app-dir/action-tracing/app/page.tsx
+15
-0
data.txt
test/production/app-dir/action-tracing/data.txt
+1
-0
next.config.js
test/production/app-dir/action-tracing/next.config.js
+6
-0
No files found.
test/e2e/app-dir/actions/app-action.test.ts
View file @
3e0c228f
...
@@ -10,7 +10,7 @@ import {
...
@@ -10,7 +10,7 @@ import {
import
type
{
Request
,
Response
}
from
'playwright'
import
type
{
Request
,
Response
}
from
'playwright'
import
fs
from
'fs-extra'
import
fs
from
'fs-extra'
import
nodeFs
from
'fs'
import
nodeFs
from
'fs'
import
path
,
{
join
}
from
'path'
import
{
join
}
from
'path'
import
{
outdent
}
from
'outdent'
import
{
outdent
}
from
'outdent'
const
GENERIC_RSC_ERROR
=
const
GENERIC_RSC_ERROR
=
...
@@ -31,17 +31,6 @@ describe('app-dir action handling', () => {
...
@@ -31,17 +31,6 @@ describe('app-dir action handling', () => {
},
},
})
})
if
(
isNextStart
)
{
it
(
'should trace server action imported by client correctly'
,
async
()
=>
{
const
traceData
=
await
next
.
readJSON
(
path
.
join
(
'.next'
,
'server'
,
'app'
,
'client'
,
'page.js.nft.json'
)
)
expect
(
traceData
.
files
.
some
((
file
)
=>
file
.
includes
(
'data.txt'
))).
toBe
(
true
)
})
}
it
(
'should handle action correctly with middleware rewrite'
,
async
()
=>
{
it
(
'should handle action correctly with middleware rewrite'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/rewrite-to-static-first'
)
const
browser
=
await
next
.
browser
(
'/rewrite-to-static-first'
)
let
actionRequestStatus
:
number
|
undefined
let
actionRequestStatus
:
number
|
undefined
...
...
test/e2e/app-dir/actions/app/client/actions.js
View file @
3e0c228f
...
@@ -5,13 +5,6 @@ import 'server-only'
...
@@ -5,13 +5,6 @@ import 'server-only'
import
{
redirect
}
from
'next/navigation'
import
{
redirect
}
from
'next/navigation'
import
{
headers
,
cookies
}
from
'next/headers'
import
{
headers
,
cookies
}
from
'next/headers'
try
{
require
(
'fs'
).
readFileSync
(
require
(
'path'
).
join
(
process
.
cwd
(),
'data.txt'
),
'utf8'
)
}
catch
{}
export
async
function
getHeaders
()
{
export
async
function
getHeaders
()
{
console
.
log
(
'accept header:'
,
(
await
headers
()).
get
(
'accept'
))
console
.
log
(
'accept header:'
,
(
await
headers
()).
get
(
'accept'
))
;(
await
cookies
()).
set
(
'test-cookie'
,
Date
.
now
())
;(
await
cookies
()).
set
(
'test-cookie'
,
Date
.
now
())
...
...
test/e2e/app-dir/actions/data.txt
deleted
100644 → 0
View file @
d6949670
hello world
\ No newline at end of file
test/production/app-dir/action-tracing/action-tracing.test.ts
0 → 100644
View file @
3e0c228f
import
{
nextTestSetup
}
from
'e2e-utils'
import
path
from
'path'
describe
(
'action-tracing'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
,
skipDeployment
:
true
,
})
if
(
skipped
)
return
it
(
'should trace server action imported by client correctly'
,
async
()
=>
{
const
traceData
=
(
await
next
.
readJSON
(
path
.
join
(
'.next'
,
'server'
,
'app'
,
'page.js.nft.json'
)
))
as
{
files
:
string
[]
}
expect
(
traceData
.
files
.
some
((
file
)
=>
file
.
includes
(
'data.txt'
))).
toBe
(
true
)
})
})
test/production/app-dir/action-tracing/app/action.ts
0 → 100644
View file @
3e0c228f
'use server'
try
{
if
(
process
.
env
.
NEXT_RUNTIME
!==
'edge'
)
{
require
(
'fs'
).
readFileSync
(
require
(
'path'
).
join
(
process
.
cwd
(),
'data.txt'
),
'utf8'
)
}
}
catch
{}
export
async
function
action
()
{
return
'action'
}
test/production/app-dir/action-tracing/app/layout.tsx
0 → 100644
View file @
3e0c228f
import
{
ReactNode
}
from
'react'
export
default
function
Root
({
children
}:
{
children
:
ReactNode
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/production/app-dir/action-tracing/app/page.tsx
0 → 100644
View file @
3e0c228f
'use client'
import
{
action
}
from
'./action'
export
default
function
Page
()
{
return
(
<
button
onClick=
{
()
=>
{
action
()
}
}
>
click
</
button
>
)
}
test/production/app-dir/action-tracing/data.txt
0 → 100644
View file @
3e0c228f
data
\ No newline at end of file
test/production/app-dir/action-tracing/next.config.js
0 → 100644
View file @
3e0c228f
/**
* @type {import('next').NextConfig}
*/
const
nextConfig
=
{}
module
.
exports
=
nextConfig
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