File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
packages/vitest/src/integrations/env
test/core/test/environments Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -249,6 +249,10 @@ function createCompatRequest(utils: CompatUtils) {
249249 super ( ...args )
250250 }
251251 }
252+
253+ static [ Symbol . hasInstance ] ( instance : unknown ) : boolean {
254+ return instance instanceof NodeRequest_
255+ }
252256 }
253257}
254258
@@ -261,6 +265,10 @@ function createJSDOMCompatURL(utils: CompatUtils): typeof URL {
261265 }
262266 return NodeURL . createObjectURL ( blob )
263267 }
268+
269+ static [ Symbol . hasInstance ] ( instance : unknown ) : boolean {
270+ return instance instanceof NodeURL
271+ }
264272 } as typeof URL
265273}
266274
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ test('Fetch API accepts other APIs', async () => {
3838 const searchParams = new URLSearchParams ( )
3939 searchParams . set ( 'key' , 'value' )
4040 expect . soft ( ( ) => new Request ( 'http://localhost' , { method : 'POST' , body : searchParams } ) ) . not . toThrowError ( )
41+
42+ const clone = request . clone ( )
43+ expect . soft ( clone ) . toBeInstanceOf ( Request )
4144} )
4245
4346test ( 'fetch api doesnt override the init object' , ( ) => {
You can’t perform that action at this time.
0 commit comments