diff --git a/test/parallel/test-vm-basic.js b/test/parallel/test-vm-basic.js index 54b7c45ff8043a..11d64f54ab83e6 100644 --- a/test/parallel/test-vm-basic.js +++ b/test/parallel/test-vm-basic.js @@ -207,6 +207,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;',