Skip to content

Commit f7f662c

Browse files
edsadritaloacasas
authored andcommitted
test: improve test-child-process-exec-buffer
* use const instead of var for required modules * use assert.strictEqual instead of assert.equal * use assert.strictEqual instead of assert.ok PR-URL: #10275 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
1 parent 4a25756 commit f7f662c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
'use strict';
22
const common = require('../common');
3-
var assert = require('assert');
4-
var exec = require('child_process').exec;
5-
var os = require('os');
6-
var str = 'hello';
3+
const assert = require('assert');
4+
const exec = require('child_process').exec;
5+
const os = require('os');
6+
const str = 'hello';
77

88
// default encoding
99
exec('echo ' + str, common.mustCall(function(err, stdout, stderr) {
10-
assert.ok('string', typeof stdout, 'Expected stdout to be a string');
11-
assert.ok('string', typeof stderr, 'Expected stderr to be a string');
12-
assert.equal(str + os.EOL, stdout);
10+
assert.strictEqual(typeof stdout, 'string', 'Expected stdout to be a string');
11+
assert.strictEqual(typeof stderr, 'string', 'Expected stderr to be a string');
12+
assert.strictEqual(str + os.EOL, stdout);
1313
}));
1414

1515
// no encoding (Buffers expected)
1616
exec('echo ' + str, {
1717
encoding: null
1818
}, common.mustCall(function(err, stdout, stderr) {
19-
assert.ok(stdout instanceof Buffer, 'Expected stdout to be a Buffer');
20-
assert.ok(stderr instanceof Buffer, 'Expected stderr to be a Buffer');
21-
assert.equal(str + os.EOL, stdout.toString());
19+
assert.strictEqual(stdout instanceof Buffer, true,
20+
'Expected stdout to be a Buffer');
21+
assert.strictEqual(stderr instanceof Buffer, true,
22+
'Expected stderr to be a Buffer');
23+
assert.strictEqual(str + os.EOL, stdout.toString());
2224
}));

0 commit comments

Comments
 (0)