From 07a3e15c276625225b1820d59a7fcc628c79202c Mon Sep 17 00:00:00 2001 From: Ruwan Geeganage Date: Tue, 30 Apr 2019 22:48:38 +0200 Subject: [PATCH 1/2] vm: test error when breakOnSigint is not a boolean for evaluate --- test/parallel/test-vm-module-errors.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/parallel/test-vm-module-errors.js b/test/parallel/test-vm-module-errors.js index c6f36c4483517c..b48188203a71c8 100644 --- a/test/parallel/test-vm-module-errors.js +++ b/test/parallel/test-vm-module-errors.js @@ -250,6 +250,20 @@ 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() { @@ -257,5 +271,6 @@ const finished = common.mustCall(); await checkModuleState(); await checkLinking(); await checkExecution(); + await checkInvalidOptionForEvaluate(); finished(); })(); From c71eb2671e58d58a3876a6608a9eb3a7ffe322f0 Mon Sep 17 00:00:00 2001 From: Ruwan Geeganage Date: Thu, 2 May 2019 21:11:08 +0200 Subject: [PATCH 2/2] removed the backslash --- test/parallel/test-vm-module-errors.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-vm-module-errors.js b/test/parallel/test-vm-module-errors.js index b48188203a71c8..a92863b1251c57 100644 --- a/test/parallel/test-vm-module-errors.js +++ b/test/parallel/test-vm-module-errors.js @@ -258,8 +258,8 @@ async function checkInvalidOptionForEvaluate() { }, { name: 'TypeError', message: - 'The "options.breakOnSigint" property must be of type boolean. \ -Received type string', + 'The "options.breakOnSigint" property must be of type boolean. ' + + 'Received type string', code: 'ERR_INVALID_ARG_TYPE' }); }