Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2d85609

Browse filesBrowse files
sivaprsItalo A. Casas
authored andcommitted
test: refactor the code in test-child-process-spawn-loop.js
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions PR-URL: #10605 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 1329eb4 commit 2d85609
Copy full SHA for 2d85609

File tree

Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Collapse file

‎test/pummel/test-child-process-spawn-loop.js‎

Copy file name to clipboardExpand all lines: test/pummel/test-child-process-spawn-loop.js
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ var assert = require('assert');
44

55
var spawn = require('child_process').spawn;
66

7-
var SIZE = 1000 * 1024;
8-
var N = 40;
9-
var finished = false;
7+
const SIZE = 1000 * 1024;
8+
const N = 40;
9+
let finished = false;
1010

1111
function doSpawn(i) {
12-
var child = spawn('python', ['-c', 'print ' + SIZE + ' * "C"']);
13-
var count = 0;
12+
const child = spawn('python', ['-c', 'print ' + SIZE + ' * "C"']);
13+
let count = 0;
1414

1515
child.stdout.setEncoding('ascii');
16-
child.stdout.on('data', function(chunk) {
16+
child.stdout.on('data', (chunk) => {
1717
count += chunk.length;
1818
});
1919

20-
child.stderr.on('data', function(chunk) {
20+
child.stderr.on('data', (chunk) => {
2121
console.log('stderr: ' + chunk);
2222
});
2323

24-
child.on('close', function() {
24+
child.on('close', () => {
2525
// + 1 for \n or + 2 for \r\n on Windows
26-
assert.equal(SIZE + (common.isWindows ? 2 : 1), count);
26+
assert.strictEqual(SIZE + (common.isWindows ? 2 : 1), count);
2727
if (i < N) {
2828
doSpawn(i + 1);
2929
} else {
@@ -34,6 +34,6 @@ function doSpawn(i) {
3434

3535
doSpawn(0);
3636

37-
process.on('exit', function() {
37+
process.on('exit', () => {
3838
assert.ok(finished);
3939
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.