Skip to content

Commit bcd5491

Browse files
committed
test: improve wasi test coverage
Add test coverage for options validation in WASI constructor. PR-URL: #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>
1 parent cc5c3b5 commit bcd5491

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
// Flags: --experimental-wasi-unstable-preview0
4+
5+
require('../common');
6+
const assert = require('assert');
7+
const { WASI } = require('wasi');
8+
9+
// If args is undefined, it should default to [] and should not throw.
10+
new WASI({});
11+
12+
// If args is not an Array and not undefined, it should throw.
13+
assert.throws(() => { new WASI({ args: 'fhqwhgads' }); },
14+
{ code: 'ERR_INVALID_ARG_TYPE' });
15+
16+
// If env is not an Object and not undefined, it should throw.
17+
assert.throws(() => { new WASI({ env: 'fhqwhgads' }); },
18+
{ code: 'ERR_INVALID_ARG_TYPE' });
19+
20+
// If preopens is not an Object and not undefined, it should throw.
21+
assert.throws(() => { new WASI({ preopens: 'fhqwhgads' }); },
22+
{ code: 'ERR_INVALID_ARG_TYPE' });

0 commit comments

Comments
 (0)