Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: vm module error thrown when breakOnSigint is not a boolean evaluate() #27503

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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. \
rpgeeganage marked this conversation as resolved.
Show resolved Hide resolved
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();
})();