Fix tests with sync WASM loading

This commit is contained in:
Andras Schmelczer 2025-07-08 21:21:16 +01:00
parent 23ae960372
commit 693705ae62
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
2 changed files with 13 additions and 1 deletions

View 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;

View file

@ -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`,
},
};