@@ -5,34 +5,34 @@ const assert = require('assert');
55const { WASI } = require ( 'wasi' ) ;
66
77// If args is undefined, it should default to [] and should not throw.
8- new WASI ( { } ) ;
8+ new WASI ( { version : 'preview1' } ) ;
99
1010// If args is not an Array and not undefined, it should throw.
11- assert . throws ( ( ) => { new WASI ( { args : 'fhqwhgads' } ) ; } ,
11+ assert . throws ( ( ) => { new WASI ( { version : 'preview1' , args : 'fhqwhgads' } ) ; } ,
1212 { code : 'ERR_INVALID_ARG_TYPE' , message : / \b a r g s \b / } ) ;
1313
1414// If env is not an Object and not undefined, it should throw.
15- assert . throws ( ( ) => { new WASI ( { env : 'fhqwhgads' } ) ; } ,
15+ assert . throws ( ( ) => { new WASI ( { version : 'preview1' , env : 'fhqwhgads' } ) ; } ,
1616 { code : 'ERR_INVALID_ARG_TYPE' , message : / \b e n v \b / } ) ;
1717
1818// If preopens is not an Object and not undefined, it should throw.
19- assert . throws ( ( ) => { new WASI ( { preopens : 'fhqwhgads' } ) ; } ,
19+ assert . throws ( ( ) => { new WASI ( { version : 'preview1' , preopens : 'fhqwhgads' } ) ; } ,
2020 { code : 'ERR_INVALID_ARG_TYPE' , message : / \b p r e o p e n s \b / } ) ;
2121
2222// If returnOnExit is not a boolean and not undefined, it should throw.
23- assert . throws ( ( ) => { new WASI ( { returnOnExit : 'fhqwhgads' } ) ; } ,
23+ assert . throws ( ( ) => { new WASI ( { version : 'preview1' , returnOnExit : 'fhqwhgads' } ) ; } ,
2424 { code : 'ERR_INVALID_ARG_TYPE' , message : / \b r e t u r n O n E x i t \b / } ) ;
2525
2626// If stdin is not an int32 and not undefined, it should throw.
27- assert . throws ( ( ) => { new WASI ( { stdin : 'fhqwhgads' } ) ; } ,
27+ assert . throws ( ( ) => { new WASI ( { version : 'preview1' , stdin : 'fhqwhgads' } ) ; } ,
2828 { code : 'ERR_INVALID_ARG_TYPE' , message : / \b s t d i n \b / } ) ;
2929
3030// If stdout is not an int32 and not undefined, it should throw.
31- assert . throws ( ( ) => { new WASI ( { stdout : 'fhqwhgads' } ) ; } ,
31+ assert . throws ( ( ) => { new WASI ( { version : 'preview1' , stdout : 'fhqwhgads' } ) ; } ,
3232 { code : 'ERR_INVALID_ARG_TYPE' , message : / \b s t d o u t \b / } ) ;
3333
3434// If stderr is not an int32 and not undefined, it should throw.
35- assert . throws ( ( ) => { new WASI ( { stderr : 'fhqwhgads' } ) ; } ,
35+ assert . throws ( ( ) => { new WASI ( { version : 'preview1' , stderr : 'fhqwhgads' } ) ; } ,
3636 { code : 'ERR_INVALID_ARG_TYPE' , message : / \b s t d e r r \b / } ) ;
3737
3838// If options is provided, but not an object, the constructor should throw.
@@ -43,13 +43,16 @@ assert.throws(() => { new WASI({ stderr: 'fhqwhgads' }); },
4343
4444// Verify that exceptions thrown from the binding layer are handled.
4545assert . throws ( ( ) => {
46- new WASI ( { preopens : { '/sandbox' : '__/not/real/path' } } ) ;
46+ new WASI ( { version : 'preview1' , preopens : { '/sandbox' : '__/not/real/path' } } ) ;
4747} , { code : 'UVWASI_ENOENT' , message : / u v w a s i _ i n i t / } ) ;
4848
4949// If version is not a string, it should throw
5050assert . throws ( ( ) => { new WASI ( { version : { x : 'y' } } ) ; } ,
5151 { code : 'ERR_INVALID_ARG_TYPE' , message : / \b v e r s i o n \b / } ) ;
5252
53+ // If version is not specified, it should throw.
54+ assert . throws ( ( ) => { new WASI ( ) ; } ,
55+ { code : 'ERR_INVALID_ARG_TYPE' , message : / \b v e r s i o n \b / } ) ;
5356
5457// If version is an unsupported version, it should throw
5558assert . throws ( ( ) => { new WASI ( { version : 'not_a_version' } ) ; } ,
0 commit comments