mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
test: test error when breakOnSigint is not a boolean for evaluate
PR-URL: https://github.com/nodejs/node/pull/27503 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
56ab82e910
commit
8b78fbd49e
@ -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();
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user