Skip to content

Commit eeb5cc6

Browse files
dYaleBridgeAR
authored andcommitted
test: add typeerror for vm/compileFunction params
PR-URL: #24179 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 5ca0cf7 commit eeb5cc6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎test/parallel/test-vm-basic.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,20 @@ const vm = require('vm');
209209
}
210210
);
211211

212+
// Testing for non Array type-based failures
213+
[Boolean(),Number(),null,Object(),Symbol(),{}].forEach(
214+
(value)=>{
215+
common.expectsError(()=>{
216+
vm.compileFunction('',value);
217+
},{
218+
type: TypeError,
219+
code: 'ERR_INVALID_ARG_TYPE',
220+
message: 'The "params" argument must be of type Array. '+
221+
`Received type ${typeofvalue}`
222+
});
223+
}
224+
);
225+
212226
assert.strictEqual(
213227
vm.compileFunction(
214228
'return a;',

0 commit comments

Comments
(0)