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
0e5fb496
Unverified
Commit
0e5fb496
authored
Apr 01, 2023
by
Shu Ding
Committed by
GitHub
Apr 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test to ensure image generation works in the Node.js runtime (#47719)
Check the test case for more details.
parent
7f063886
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
route.js
test/e2e/og-api/app/app/og-node/route.js
+8
-0
index.test.ts
test/e2e/og-api/index.test.ts
+8
-0
No files found.
test/e2e/og-api/app/app/og-node/route.js
0 → 100644
View file @
0e5fb496
import
{
ImageResponse
}
from
'@vercel/og'
export
async
function
GET
()
{
return
new
ImageResponse
(
<
div
>
hi
<
/div>,
{
width
:
1200
,
height
:
630
,
})
}
test/e2e/og-api/index.test.ts
View file @
0e5fb496
...
@@ -38,6 +38,14 @@ describe('og-api', () => {
...
@@ -38,6 +38,14 @@ describe('og-api', () => {
expect
(
body
.
size
).
toBeGreaterThan
(
0
)
expect
(
body
.
size
).
toBeGreaterThan
(
0
)
})
})
it
(
'should work in app route in node runtime'
,
async
()
=>
{
const
res
=
await
fetchViaHTTP
(
next
.
url
,
'/og-node'
)
expect
(
res
.
status
).
toBe
(
200
)
expect
(
res
.
headers
.
get
(
'content-type'
)).
toContain
(
'image/png'
)
const
body
=
await
res
.
blob
()
expect
(
body
.
size
).
toBeGreaterThan
(
0
)
})
if
((
global
as
any
).
isNextStart
)
{
if
((
global
as
any
).
isNextStart
)
{
it
(
'should copy files correctly'
,
async
()
=>
{
it
(
'should copy files correctly'
,
async
()
=>
{
expect
(
next
.
cliOutput
).
not
.
toContain
(
'Failed to copy traced files'
)
expect
(
next
.
cliOutput
).
not
.
toContain
(
'Failed to copy traced files'
)
...
...
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