From 99dc9d03deb4838ceaa7abb39a7a4dfa12c89ce9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 24 Jun 2017 15:47:38 -0700 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/13902 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock Reviewed-By: James M Snell --- test/parallel/test-vm-sigint.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-vm-sigint.js b/test/parallel/test-vm-sigint.js index 4d93ec32c0..b1ad616405 100644 --- a/test/parallel/test-vm-sigint.js +++ b/test/parallel/test-vm-sigint.js @@ -1,5 +1,6 @@ 'use strict'; const common = require('../common'); + const assert = require('assert'); const vm = require('vm'); @@ -15,7 +16,7 @@ if (process.argv[2] === 'child') { const method = process.argv[3]; const listeners = +process.argv[4]; assert.ok(method); - assert.ok(typeof listeners, 'number'); + assert.ok(Number.isInteger(listeners)); const script = `process.send('${method}'); while(true) {}`; const args = method === 'runInContext' ? @@ -24,7 +25,7 @@ if (process.argv[2] === 'child') { const options = { breakOnSigint: true }; for (let i = 0; i < listeners; i++) - process.on('SIGINT', common.noop); + process.on('SIGINT', common.mustNotCall()); assert.throws(() => { vm[method](script, ...args, options); }, /^Error: Script execution interrupted\.$/);