From 484dccbd447e21a20f23d6e1690b67e6c2a3c08e Mon Sep 17 00:00:00 2001 From: Kayla Altepeter Date: Fri, 12 Oct 2018 11:28:54 -0700 Subject: [PATCH] test: adding test coverage for SourceTextModule.evaluate This checks that invalid option throws an error. PR-URL: https://github.com/nodejs/node/pull/23595 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Anna Henningsen Reviewed-By: Tiancheng "Timothy" Gu --- test/parallel/test-vm-module-errors.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/parallel/test-vm-module-errors.js b/test/parallel/test-vm-module-errors.js index 6803e0d86b3ff4..a6b2a6e797a1bb 100644 --- a/test/parallel/test-vm-module-errors.js +++ b/test/parallel/test-vm-module-errors.js @@ -131,6 +131,15 @@ async function checkModuleState() { message: 'Module status must be one of instantiated, evaluated, and errored' }); + await expectsRejection(async () => { + const m = new SourceTextModule(''); + await m.evaluate(false); + }, { + code: 'ERR_INVALID_ARG_TYPE', + message: 'The "options" argument must be of type Object. ' + + 'Received type boolean' + }); + await expectsRejection(async () => { const m = await createEmptyLinkedModule(); await m.evaluate();