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
Next Next commit
test: add typeerror for vm/compileFunction params
  • Loading branch information
dYale committed Nov 6, 2018
commit a401f13bbe8a005c7f75cd300105d65a19fbc236
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