diff --git a/tests/setupJest.ts b/tests/setupJest.ts index 761aa6341..bbb52f47a 100644 --- a/tests/setupJest.ts +++ b/tests/setupJest.ts @@ -31,11 +31,12 @@ global.WebAssembly.instantiateStreaming = jest.fn< [Response | PromiseLike, WebAssembly.Imports?] >( async ( - source: Response | PromiseLike | WebAssembly.Module, + source: Response | PromiseLike, importObject: WebAssembly.Imports | undefined, ) => { - if (source instanceof WebAssembly.Module) { - return WebAssembly.instantiate(source, importObject); + const response = await source; + const buffer = await response.arrayBuffer(); + return WebAssembly.instantiate(buffer, importObject); } const response = await source; const buffer = await response.arrayBuffer();