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 <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
This commit is contained in:
Kayla Altepeter 2018-10-12 11:28:54 -07:00 committed by Rich Trott
parent b2d8ae0a14
commit 6cd5c7420a

View File

@ -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();