1// Flags: --experimental-wasm-modules 2import '../common/index.mjs'; 3import { path } from '../common/fixtures.mjs'; 4import { add, addImported } from '../fixtures/es-modules/simple.wasm'; 5import { state } from '../fixtures/es-modules/wasm-dep.mjs'; 6import { strictEqual, ok } from 'assert'; 7import { spawn } from 'child_process'; 8 9strictEqual(state, 'WASM Start Executed'); 10 11strictEqual(add(10, 20), 30); 12 13strictEqual(addImported(0), 42); 14 15strictEqual(state, 'WASM JS Function Executed'); 16 17strictEqual(addImported(1), 43); 18 19// Test warning message 20const child = spawn(process.execPath, [ 21 '--experimental-wasm-modules', 22 path('/es-modules/wasm-modules.mjs'), 23]); 24 25let stderr = ''; 26child.stderr.setEncoding('utf8'); 27child.stderr.on('data', (data) => { 28 stderr += data; 29}); 30child.on('close', (code, signal) => { 31 strictEqual(code, 0); 32 strictEqual(signal, null); 33 ok(stderr.toString().includes( 34 'ExperimentalWarning: Importing Web Assembly modules is ' + 35 'an experimental feature. This feature could change at any time' 36 )); 37}); 38