mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 15:30:56 +01:00
147317f60c
Refs: https://github.com/nodejs/node/pull/30770/files#r353051438 PR-URL: https://github.com/nodejs/node/pull/30800 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
23 lines
827 B
JavaScript
23 lines
827 B
JavaScript
'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', message: /\bargs\b/ });
|
|
|
|
// If env is not an Object and not undefined, it should throw.
|
|
assert.throws(() => { new WASI({ env: 'fhqwhgads' }); },
|
|
{ code: 'ERR_INVALID_ARG_TYPE', message: /\benv\b/ });
|
|
|
|
// If preopens is not an Object and not undefined, it should throw.
|
|
assert.throws(() => { new WASI({ preopens: 'fhqwhgads' }); },
|
|
{ code: 'ERR_INVALID_ARG_TYPE', message: /\bpreopens\b/ });
|