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
a90827be
Unverified
Commit
a90827be
authored
Aug 18, 2025
by
Steven
Committed by
GitHub
Aug 18, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(test): update sharp api test (#82740)
Testing to see if sharp works with turbopack
parent
480a0e1d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
185 additions
and
231 deletions
+185
-231
package-lock.json
test/integration/sharp-api/app/package-lock.json
+171
-223
package.json
test/integration/sharp-api/app/package.json
+1
-1
custom-sharp.js
test/integration/sharp-api/app/pages/api/custom-sharp.js
+9
-2
sharp-api.test.ts
test/integration/sharp-api/test/sharp-api.test.ts
+4
-5
No files found.
test/integration/sharp-api/app/package-lock.json
View file @
a90827be
This diff is collapsed.
Click to expand it.
test/integration/sharp-api/app/package.json
View file @
a90827be
...
...
@@ -2,6 +2,6 @@
"private"
:
true
,
"packageManager"
:
"npm@10.4.0"
,
"dependencies"
:
{
"sharp"
:
"
latest
"
"sharp"
:
"
^0.34.3
"
}
}
test/integration/sharp-api/app/pages/api/custom-sharp.js
View file @
a90827be
import
sharp
from
'sharp'
export
default
function
handler
(
req
,
res
)
{
res
.
json
({
success
:
Boolean
(
sharp
)
})
export
default
async
function
handler
(
req
,
res
)
{
const
roundedCorners
=
Buffer
.
from
(
'<svg><rect x="0" y="0" width="200" height="200" rx="50" ry="50"/></svg>'
)
const
buffer
=
await
sharp
(
roundedCorners
).
resize
(
200
,
200
).
png
().
toBuffer
()
res
.
setHeader
(
'content-type'
,
'image/png'
)
res
.
setHeader
(
'content-length'
,
buffer
.
byteLength
)
res
.
end
(
buffer
)
}
test/integration/sharp-api/test/sharp-api.test.ts
View file @
a90827be
...
...
@@ -12,11 +12,9 @@ import fs from 'fs-extra'
import
{
join
}
from
'path'
const
appDir
=
join
(
__dirname
,
'../app'
)
let
app
,
appPort
let
app
,
appPort
// Skip as Turbopack doesn't support `next build` yet
;(
process
.
env
.
IS_TURBOPACK_TEST
?
describe
.
skip
:
describe
)(
'sharp api'
,
()
=>
{
describe
(
'sharp api'
,
()
=>
{
beforeAll
(
async
()
=>
{
await
execa
(
'npm'
,
[
'install'
],
{
cwd
:
appDir
,
stdio
:
'inherit'
})
await
nextBuild
(
appDir
)
...
...
@@ -34,7 +32,8 @@ let app,
it
(
'should handle custom sharp usage'
,
async
()
=>
{
const
res
=
await
fetchViaHTTP
(
appPort
,
'/api/custom-sharp'
)
expect
(
res
.
status
).
toBe
(
200
)
expect
(
await
res
.
json
()).
toEqual
({
success
:
true
})
expect
(
res
.
headers
.
get
(
'content-type'
)).
toBe
(
'image/png'
)
expect
((
await
res
.
arrayBuffer
()).
byteLength
).
toBeGreaterThan
(
0
)
const
traceFile
=
await
fs
.
readJson
(
join
(
appDir
,
...
...
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