Skip to content

Commit

Permalink
test: add typeerror for vm/compileFunction params
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dYale authored and BridgeAR committed Nov 15, 2018
1 parent 5ca0cf7 commit eeb5cc6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/parallel/test-vm-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;',
Expand Down

0 comments on commit eeb5cc6

Please sign in to comment.