wasi.start() throws type error
- Version: v14.2.0
- Platform: windows
- Subsystem: none
What steps will reproduce the bug?
I am not sure exactly how to reproduce this bug, but when I use jest, I run the following code.
try { if (this.wasi) { console.log(this.instance.exports._start); console.log(this.instance instanceof WebAssembly.Instance); this.wasi.start(this.instance); console.log("ran!"); } else { // collect all the top level function pointers, tests, groups, and logs this.wasm._start(); } } catch (ex) { console.log(ex); }
console.log
[Function: 62]
at TestContext.visit (src/test/TestContext.ts:298:19)
console.log
true
at TestContext.visit (src/test/TestContext.ts:299:19)
console.log
TypeError [ERR_INVALID_ARG_TYPE]: The "instance" argument must be an WebAssembly.Instance. Received an instance of Instance
at WASI.start (wasi.js:75:13)
How often does it reproduce? Is there a required condition?
I doubt this is jest related, and it looks like wasi seems to have a different version of WebAssembly.Instance, because it logs true.
Related question: Is it possible that jest would modify the WebAssembly class?
What is the expected behavior?
I suppose that the module shouldn't throw an error, because it appears to be an instance of an Instance.
What do you see instead?
TypeError [ERR_INVALID_ARG_TYPE]: The "instance" argument must be an WebAssembly.Instance. Received an instance of Instance
at WASI.start (wasi.js:75:13)
... unrelated stack frames
Additional information
I will be happy to help debug this, but it's currently 3am. Will update this with an appropriate script to replicate this without jest.
EDIT: Removed postfix ! operators because they are typescript related. Whoops.