diff options
author | cjihrig <cjihrig@gmail.com> | 2019-12-14 19:14:02 +0300 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2019-12-17 08:02:04 +0300 |
commit | efb908409eae37c32d7a71ec267c5fec2bcc4c8a (patch) | |
tree | 762124f0378ee6530b5c64c0f7f9c43ab122bbf0 /test | |
parent | ce49f90e14212cd900aba69bac76a8af288d2b58 (diff) |
wasi: require CLI flag to require() wasi module
This commit ensures that the WASI module cannot be require()'ed
without a CLI flag while the module is still experimental.
This fixes a regression from
https://github.com/nodejs/node/pull/30778.
PR-URL: https://github.com/nodejs/node/pull/30963
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/wasi/test-wasi-require-flag.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/wasi/test-wasi-require-flag.js b/test/wasi/test-wasi-require-flag.js new file mode 100644 index 00000000000..0a52ea952d2 --- /dev/null +++ b/test/wasi/test-wasi-require-flag.js @@ -0,0 +1,9 @@ +'use strict'; +// This test verifies that the WASI module cannot be require()'ed without a +// CLI flag while it is still experimental. +require('../common'); +const assert = require('assert'); + +assert.throws(() => { + require('wasi'); +}, /^Error: Cannot find module 'wasi'/); |