Fix tests with sync WASM loading
This commit is contained in:
parent
23ae960372
commit
693705ae62
2 changed files with 13 additions and 1 deletions
9
reconcile-js/__mocks__/wasm.js
Normal file
9
reconcile-js/__mocks__/wasm.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Read the actual WASM file and convert to base64 for testing
|
||||
const wasmPath = path.join(__dirname, '../../pkg/reconcile_bg.wasm');
|
||||
const wasmBuffer = fs.readFileSync(wasmPath);
|
||||
const wasmBase64 = wasmBuffer.toString('base64');
|
||||
|
||||
module.exports = wasmBase64;
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
module.exports = {
|
||||
preset: "ts-jest/presets/js-with-babel-esm"
|
||||
preset: 'ts-jest/presets/js-with-babel-esm',
|
||||
moduleNameMapper: {
|
||||
'^reconcile/reconcile_bg\\.wasm$': `<rootDir>/__mocks__/wasm.js`,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue