MCPcopy Index your code
hub / github.com/nodejs/node / checkInvalidOptionForEvaluate

Function checkInvalidOptionForEvaluate

test/parallel/test-vm-module-errors.js:202–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

200
201// Check for error thrown when breakOnSigint is not a boolean for evaluate()
202async function checkInvalidOptionForEvaluate() {
203 await assert.rejects(async () => {
204 const m = new SourceTextModule('export const a = 1; export let b = 2');
205 await m.evaluate({ breakOnSigint: 'a-string' });
206 }, {
207 name: 'TypeError',
208 message:
209 'The "options.breakOnSigint" property must be of type boolean. ' +
210 "Received type string ('a-string')",
211 code: 'ERR_INVALID_ARG_TYPE'
212 });
213
214 {
215 ['link', 'evaluate'].forEach(async (method) => {
216 await assert.rejects(async () => {
217 await Module.prototype[method]();
218 }, { code: 'ERR_INVALID_THIS' });
219 });
220 }
221}
222
223function checkInvalidCachedData() {
224 [true, false, 'foo', {}, Array, function() {}].forEach((invalidArg) => {

Callers 1

Calls 2

forEachMethod · 0.65
evaluateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…