Skip to content

Commit 2b1999b

Browse files
committed
test: remove unused vars in ChildProcess tests
In addition to removing unused vars, this also fixes an instance where booleans were set presumably to check something but then never used. This now confirms that the events that were setting the booleans are fired. PR-URL: nodejs#4425 Reviewed-By: Johan Bergström <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent fd551c3 commit 2b1999b

12 files changed

+5
-25
lines changed

test/parallel/test-child-process-buffering.js

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
var common = require('../common');
33
var assert = require('assert');
44

5-
var spawn = require('child_process').spawn;
6-
75
var pwd_called = false;
86
var childClosed = false;
97
var childExited = false;

test/parallel/test-child-process-cwd.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22
var common = require('../common');
33
var assert = require('assert');
4-
var spawn = require('child_process').spawn;
5-
var path = require('path');
64

75
var returns = 0;
86

test/parallel/test-child-process-exec-buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var success_count = 0;
99
var str = 'hello';
1010

1111
// default encoding
12-
var child = exec('echo ' + str, function(err, stdout, stderr) {
12+
exec('echo ' + str, function(err, stdout, stderr) {
1313
assert.ok('string', typeof(stdout), 'Expected stdout to be a string');
1414
assert.ok('string', typeof(stderr), 'Expected stderr to be a string');
1515
assert.equal(str + os.EOL, stdout);

test/parallel/test-child-process-exec-cwd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (common.isWindows) {
1616
dir = '/dev';
1717
}
1818

19-
var child = exec(pwdcommand, {cwd: dir}, function(err, stdout, stderr) {
19+
exec(pwdcommand, {cwd: dir}, function(err, stdout, stderr) {
2020
if (err) {
2121
error_count++;
2222
console.log('error!: ' + err.code);

test/parallel/test-child-process-fork-dgram.js

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ if (common.isWindows) {
2525
}
2626

2727
if (process.argv[2] === 'child') {
28-
var childCollected = 0;
2928
var server;
3029

3130
process.on('message', function removeMe(msg, clusterServer) {

test/parallel/test-child-process-fork-exec-path.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22
var assert = require('assert');
3-
var cp = require('child_process');
43
var fs = require('fs');
54
var path = require('path');
65
var common = require('../common');

test/parallel/test-child-process-fork-ref2.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22
require('../common');
3-
var assert = require('assert');
43
var fork = require('child_process').fork;
54

65
if (process.argv[2] === 'child') {

test/parallel/test-child-process-spawn-error.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22
var common = require('../common');
3-
var fs = require('fs');
43
var spawn = require('child_process').spawn;
54
var assert = require('assert');
65

test/parallel/test-child-process-stdin.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,20 @@ var response = '';
1818
var exitStatus = -1;
1919
var closed = false;
2020

21-
var gotStdoutEOF = false;
22-
2321
cat.stdout.setEncoding('utf8');
2422
cat.stdout.on('data', function(chunk) {
2523
console.log('stdout: ' + chunk);
2624
response += chunk;
2725
});
2826

29-
cat.stdout.on('end', function() {
30-
gotStdoutEOF = true;
31-
});
32-
33-
34-
var gotStderrEOF = false;
27+
cat.stdout.on('end', common.mustCall(function() {}));
3528

3629
cat.stderr.on('data', function(chunk) {
3730
// shouldn't get any stderr output
3831
assert.ok(false);
3932
});
4033

41-
cat.stderr.on('end', function(chunk) {
42-
gotStderrEOF = true;
43-
});
44-
34+
cat.stderr.on('end', common.mustCall(function() {}));
4535

4636
cat.on('exit', function(status) {
4737
console.log('exit event');

test/parallel/test-child-process-stdio-inherit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ function grandparent() {
3131

3232
function parent() {
3333
// should not immediately exit.
34-
var child = common.spawnCat({ stdio: 'inherit' });
34+
common.spawnCat({ stdio: 'inherit' });
3535
}

test/parallel/test-child-process-stdio.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
var common = require('../common');
33
var assert = require('assert');
4-
var spawn = require('child_process').spawn;
54

65
var options = {stdio: ['pipe']};
76
var child = common.spawnPwd(options);

test/parallel/test-child-process-stdout-flush-exit.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
var common = require('../common');
33
var assert = require('assert');
4-
var path = require('path');
54

65
// if child process output to console and exit
76
if (process.argv[2] === 'child') {

0 commit comments

Comments
 (0)