diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 6be0ca4e3f83bc..aa320996aa4b16 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -15,3 +15,7 @@ rules: inspector-check: error ## common module is mandatory in tests required-modules: [error, common] + +# Global scoped methods and vars +globals: + WebAssembly: false diff --git a/test/fixtures/test.wasm b/test/fixtures/test.wasm new file mode 100644 index 00000000000000..8b19588df228b7 Binary files /dev/null and b/test/fixtures/test.wasm differ diff --git a/test/parallel/test-wasm-simple.js b/test/parallel/test-wasm-simple.js new file mode 100644 index 00000000000000..6227875fd8a9df --- /dev/null +++ b/test/parallel/test-wasm-simple.js @@ -0,0 +1,18 @@ +'use strict'; + +require('../common'); + +const assert = require('assert'); +const fixtures = require('../common/fixtures'); + +const buffer = fixtures.readSync('test.wasm'); + +assert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly'); + +WebAssembly.instantiate(buffer, {}).then((results) => { + assert.strictEqual( + results.instance.exports.addTwo(10, 20), + 30, + 'Exported function should add two numbers.', + ); +});