Skip to content

Commit 98ec8aa

Browse files
Trottaddaleax
authored andcommitted
test: refactor test-vm-sigint
* Use common.mustNotCall() to confirm SIGINT listeners are not being invoked. * Improve assertion check on integer child argument. * Add blank line per test writing guide. PR-URL: #13902 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 949d1b1 commit 98ec8aa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/parallel/test-vm-sigint.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
const common = require('../common');
3+
34
const assert = require('assert');
45
const vm = require('vm');
56

@@ -15,7 +16,7 @@ if (process.argv[2] === 'child') {
1516
const method = process.argv[3];
1617
const listeners = +process.argv[4];
1718
assert.ok(method);
18-
assert.ok(typeof listeners, 'number');
19+
assert.ok(Number.isInteger(listeners));
1920

2021
const script = `process.send('${method}'); while(true) {}`;
2122
const args = method === 'runInContext' ?
@@ -24,7 +25,7 @@ if (process.argv[2] === 'child') {
2425
const options = { breakOnSigint: true };
2526

2627
for (let i = 0; i < listeners; i++)
27-
process.on('SIGINT', common.noop);
28+
process.on('SIGINT', common.mustNotCall());
2829

2930
assert.throws(() => { vm[method](script, ...args, options); },
3031
/^Error: Script execution interrupted\.$/);

0 commit comments

Comments
 (0)