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:
parent
b2d8ae0a14
commit
6cd5c7420a
@ -131,6 +131,15 @@ async function checkModuleState() {
|
|||||||
message: 'Module status must be one of instantiated, evaluated, and errored'
|
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 () => {
|
await expectsRejection(async () => {
|
||||||
const m = await createEmptyLinkedModule();
|
const m = await createEmptyLinkedModule();
|
||||||
await m.evaluate();
|
await m.evaluate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user