Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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]>
  • Loading branch information
dYale authored and cfanoulis committed Nov 15, 2018
commit c0cd39b0b9d229d412188a08e4ae097867d29973
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