Skip to content

Commit 0c7f18e

Browse files
rpgeeganagetargos
authored andcommitted
test: test error when breakOnSigint is not a boolean for evaluate
PR-URL: #27503 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent a18692c commit 0c7f18e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/parallel/test-vm-module-errors.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,27 @@ async function checkExecution() {
250250
})();
251251
}
252252

253+
// Check for error thrown when breakOnSigint is not a boolean for evaluate()
254+
async function checkInvalidOptionForEvaluate() {
255+
await assert.rejects(async () => {
256+
const m = new SourceTextModule('export const a = 1; export var b = 2');
257+
await m.evaluate({ breakOnSigint: 'a-string' });
258+
}, {
259+
name: 'TypeError',
260+
message:
261+
'The "options.breakOnSigint" property must be of type boolean. ' +
262+
'Received type string',
263+
code: 'ERR_INVALID_ARG_TYPE'
264+
});
265+
}
266+
253267
const finished = common.mustCall();
254268

255269
(async function main() {
256270
await checkArgType();
257271
await checkModuleState();
258272
await checkLinking();
259273
await checkExecution();
274+
await checkInvalidOptionForEvaluate();
260275
finished();
261276
})();

0 commit comments

Comments
 (0)