diff --git a/test/parallel/test-vm-basic.js b/test/parallel/test-vm-basic.js index df0c7df1062c14..29e2a8b5251934 100644 --- a/test/parallel/test-vm-basic.js +++ b/test/parallel/test-vm-basic.js @@ -209,6 +209,20 @@ const vm = require('vm'); } ); + // Testing for non Array type-based failures + [Boolean(), Number(), null, Object(), Symbol(), {}].forEach( + (value) => { + common.expectsError(() => { + vm.compileFunction('', value); + }, { + type: TypeError, + code: 'ERR_INVALID_ARG_TYPE', + message: 'The "params" argument must be of type Array. ' + + `Received type ${typeof value}` + }); + } + ); + assert.strictEqual( vm.compileFunction( 'return a;',