Skip to content

Commit a857c9a

Browse files
makenovaaddaleax
authored andcommitted
test: refactor test-vm-debug-context
change var to const or let change assert.equal to assert.strictEqual PR-URL: #9875 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 13eea40 commit a857c9a

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

test/parallel/test-vm-debug-context.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable no-debugger */
22
'use strict';
3-
var common = require('../common');
4-
var assert = require('assert');
5-
var vm = require('vm');
6-
var spawn = require('child_process').spawn;
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const vm = require('vm');
6+
const spawn = require('child_process').spawn;
77

88
assert.throws(function() {
99
vm.runInDebugContext('*');
@@ -21,8 +21,8 @@ assert.throws(function() {
2121
vm.runInDebugContext('(function(f) { f(f) })(function(f) { f(f) })');
2222
}, /RangeError/);
2323

24-
assert.equal(typeof vm.runInDebugContext('this'), 'object');
25-
assert.equal(typeof vm.runInDebugContext('Debug'), 'object');
24+
assert.strictEqual(typeof vm.runInDebugContext('this'), 'object');
25+
assert.strictEqual(typeof vm.runInDebugContext('Debug'), 'object');
2626

2727
assert.strictEqual(vm.runInDebugContext(), undefined);
2828
assert.strictEqual(vm.runInDebugContext(0), 0);
@@ -46,11 +46,11 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined);
4646
debugger;
4747
}
4848

49-
assert.equal(breaks, 0);
49+
assert.strictEqual(breaks, 0);
5050
Debug.setListener(ondebugevent);
51-
assert.equal(breaks, 0);
51+
assert.strictEqual(breaks, 0);
5252
breakpoint();
53-
assert.equal(breaks, 1);
53+
assert.strictEqual(breaks, 1);
5454
}
5555

5656
// Can set listeners and breakpoints on a single line file
@@ -73,24 +73,24 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined);
7373

7474
// See https://github.com/nodejs/node/issues/1190, fatal errors should not
7575
// crash the process.
76-
var script = common.fixturesDir + '/vm-run-in-debug-context.js';
77-
var proc = spawn(process.execPath, [script]);
78-
var data = [];
76+
const script = common.fixturesDir + '/vm-run-in-debug-context.js';
77+
let proc = spawn(process.execPath, [script]);
78+
const data = [];
7979
proc.stdout.on('data', common.fail);
8080
proc.stderr.on('data', data.push.bind(data));
8181
proc.stderr.once('end', common.mustCall(function() {
82-
var haystack = Buffer.concat(data).toString('utf8');
82+
const haystack = Buffer.concat(data).toString('utf8');
8383
assert(/SyntaxError: Unexpected token \*/.test(haystack));
8484
}));
8585
proc.once('exit', common.mustCall(function(exitCode, signalCode) {
86-
assert.equal(exitCode, 1);
87-
assert.equal(signalCode, null);
86+
assert.strictEqual(exitCode, 1);
87+
assert.strictEqual(signalCode, null);
8888
}));
8989

9090
proc = spawn(process.execPath, [script, 'handle-fatal-exception']);
9191
proc.stdout.on('data', common.fail);
9292
proc.stderr.on('data', common.fail);
9393
proc.once('exit', common.mustCall(function(exitCode, signalCode) {
94-
assert.equal(exitCode, 42);
95-
assert.equal(signalCode, null);
94+
assert.strictEqual(exitCode, 42);
95+
assert.strictEqual(signalCode, null);
9696
}));

0 commit comments

Comments
 (0)