mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: improve wasi test coverage
Add test coverage for options validation in WASI constructor. PR-URL: https://github.com/nodejs/node/pull/30770 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
fd33df7f33
commit
45b74fbb5b
1 file changed
+22
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
// Flags: --experimental-wasi-unstable-preview0
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const { WASI } = require('wasi');
|
||||
|
||||
// If args is undefined, it should default to [] and should not throw.
|
||||
new WASI({});
|
||||
|
||||
// If args is not an Array and not undefined, it should throw.
|
||||
assert.throws(() => { new WASI({ args: 'fhqwhgads' }); },
|
||||
{ code: 'ERR_INVALID_ARG_TYPE' });
|
||||
|
||||
// If env is not an Object and not undefined, it should throw.
|
||||
assert.throws(() => { new WASI({ env: 'fhqwhgads' }); },
|
||||
{ code: 'ERR_INVALID_ARG_TYPE' });
|
||||
|
||||
// If preopens is not an Object and not undefined, it should throw.
|
||||
assert.throws(() => { new WASI({ preopens: 'fhqwhgads' }); },
|
||||
{ code: 'ERR_INVALID_ARG_TYPE' });
|
||||
Reference in new issue
Block a user