While running my wasm code in unit testing a function, I am getting this error:
CompileError: AsyncCompile: Wasm decoding failed: expected magic word 00 61 73 6d, found 3c 21 44 4f @+0
Though I have successfully added the compiled wasm file to the directory and the main part is code is running with browser but not with tests.
The tests are running with tape and browserified.
const imports = {
env:{
// paceOp: require('pace').op,
consoleLog:console.log,
perform: function(x,y){
let pixel = options.changePixel(
pixels.get(x, y, 0),
pixels.get(x, y, 1),
pixels.get(x, y, 2),
pixels.get(x, y, 3),
x,
y
);
pixels.set(x, y, 0, pixel[0]);
pixels.set(x, y, 1, pixel[1]);
pixels.set(x, y, 2, pixel[2]);
pixels.set(x, y, 3, pixel[3]);
}
}
};
const inBrowser = (options.inBrowser)?1:0;
const test = (process.env.TEST)?1:0;
fetch('./test.wasm').then(response =>
response.arrayBuffer()
).then(bytes =>
WebAssembly.instantiate(bytes, imports)
).then(results => {
results.instance.exports.manipulatePixel(pixels.shape[0],pixels.shape[1],inBrowser, test);
extraOperation();
}).catch(err=>{
console.log(err)
});
Can someone please help me with it!! Thanks in advance..
Aucun commentaire:
Enregistrer un commentaire