Skip to content

Commit

Permalink
fix: wpts on node v18.13.0+ (nodejs#1859)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev authored and crysmags committed Feb 27, 2024
1 parent 5c33e64 commit 40c7698
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/fetch/formdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function makeEntry (name, value, filename) {
lastModified: value.lastModified
}

value = value instanceof File
value = (NativeFile && value instanceof NativeFile) || value instanceof UndiciFile
? new File([value], filename, options)
: new FileLike(value, filename, options)
}
Expand Down
3 changes: 2 additions & 1 deletion test/wpt/runner/runner/worker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { join } from 'node:path'
import { runInThisContext } from 'node:vm'
import { parentPort, workerData } from 'node:worker_threads'
import { readFileSync } from 'node:fs'
import buffer from 'node:buffer'
import {
setGlobalOrigin,
Response,
Expand Down Expand Up @@ -34,7 +35,7 @@ Object.defineProperties(globalThis, {
},
File: {
...globalPropertyDescriptors,
value: File
value: buffer.File ?? File
},
FormData: {
...globalPropertyDescriptors,
Expand Down
2 changes: 1 addition & 1 deletion test/wpt/status/FileAPI.status.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"File-constructor.any.js": {
"fail": [
"flaky": [
"Using type in File constructor: nonparsable"
]
},
Expand Down

0 comments on commit 40c7698

Please sign in to comment.