diff options
Diffstat (limited to 'test/es-module/test-esm-wasm.mjs')
-rw-r--r-- | test/es-module/test-esm-wasm.mjs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/es-module/test-esm-wasm.mjs b/test/es-module/test-esm-wasm.mjs index 46df5994af..b2218ce2f0 100644 --- a/test/es-module/test-esm-wasm.mjs +++ b/test/es-module/test-esm-wasm.mjs @@ -1,8 +1,10 @@ // Flags: --experimental-wasm-modules import '../common/index.mjs'; +import { path } from '../common/fixtures.mjs'; import { add, addImported } from '../fixtures/es-modules/simple.wasm'; import { state } from '../fixtures/es-modules/wasm-dep.mjs'; -import { strictEqual } from 'assert'; +import { strictEqual, ok } from 'assert'; +import { spawn } from 'child_process'; strictEqual(state, 'WASM Start Executed'); @@ -13,3 +15,23 @@ strictEqual(addImported(0), 42); strictEqual(state, 'WASM JS Function Executed'); strictEqual(addImported(1), 43); + +// Test warning message +const child = spawn(process.execPath, [ + '--experimental-wasm-modules', + path('/es-modules/wasm-modules.mjs') +]); + +let stderr = ''; +child.stderr.setEncoding('utf8'); +child.stderr.on('data', (data) => { + stderr += data; +}); +child.on('close', (code, signal) => { + strictEqual(code, 0); + strictEqual(signal, null); + ok(stderr.toString().includes( + 'ExperimentalWarning: Importing Web Assembly modules is ' + + 'an experimental feature. This feature could change at any time' + )); +}); |