11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst { Worker } = require('worker_threads'); 71cb0ef41Sopenharmony_ciconst wasmModule = new WebAssembly.Module(fixtures.readSync('simple.wasm')); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst worker = new Worker(` 101cb0ef41Sopenharmony_ciconst { parentPort } = require('worker_threads'); 111cb0ef41Sopenharmony_ciparentPort.once('message', ({ wasmModule }) => { 121cb0ef41Sopenharmony_ci const instance = new WebAssembly.Instance(wasmModule); 131cb0ef41Sopenharmony_ci parentPort.postMessage(instance.exports.add(10, 20)); 141cb0ef41Sopenharmony_ci}); 151cb0ef41Sopenharmony_ci`, { eval: true }); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciworker.once('message', common.mustCall((num) => assert.strictEqual(num, 30))); 181cb0ef41Sopenharmony_ciworker.postMessage({ wasmModule }); 19