Skip to content

Commit 30756e3

Browse files
Trotttargos
authored andcommitted
test: improve wasi test coverage
Add test coverage for options validation in WASI constructor. PR-URL: #30770 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent fb31ab5 commit 30756e3

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)