Skip to content

Commit

Permalink
test: test error when breakOnSigint is not a boolean for evaluate
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rpgeeganage authored and ZYSzys committed May 11, 2019
1 parent 56ab82e commit 8b78fbd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/parallel/test-vm-module-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,27 @@ async function checkExecution() {
})();
}

// Check for error thrown when breakOnSigint is not a boolean for evaluate()
async function checkInvalidOptionForEvaluate() {
await assert.rejects(async () => {
const m = new SourceTextModule('export const a = 1; export var b = 2');
await m.evaluate({ breakOnSigint: 'a-string' });
}, {
name: 'TypeError',
message:
'The "options.breakOnSigint" property must be of type boolean. ' +
'Received type string',
code: 'ERR_INVALID_ARG_TYPE'
});
}

const finished = common.mustCall();

(async function main() {
await checkArgType();
await checkModuleState();
await checkLinking();
await checkExecution();
await checkInvalidOptionForEvaluate();
finished();
})();

0 comments on commit 8b78fbd

Please sign in to comment.