Skip to content

Commit f7f662c

Browse files
edsadrItalo A. Casas
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
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
'use strict';
22
constcommon=require('../common');
3-
varassert=require('assert');
4-
varexec=require('child_process').exec;
5-
varos=require('os');
6-
varstr='hello';
3+
constassert=require('assert');
4+
constexec=require('child_process').exec;
5+
constos=require('os');
6+
conststr='hello';
77

88
// default encoding
99
exec('echo '+str,common.mustCall(function(err,stdout,stderr){
10-
assert.ok('string',typeofstdout,'Expected stdout to be a string');
11-
assert.ok('string',typeofstderr,'Expected stderr to be a string');
12-
assert.equal(str+os.EOL,stdout);
10+
assert.strictEqual(typeofstdout,'string','Expected stdout to be a string');
11+
assert.strictEqual(typeofstderr,'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(stdoutinstanceofBuffer,'Expected stdout to be a Buffer');
20-
assert.ok(stderrinstanceofBuffer,'Expected stderr to be a Buffer');
21-
assert.equal(str+os.EOL,stdout.toString());
19+
assert.strictEqual(stdoutinstanceofBuffer,true,
20+
'Expected stdout to be a Buffer');
21+
assert.strictEqual(stderrinstanceofBuffer,true,
22+
'Expected stderr to be a Buffer');
23+
assert.strictEqual(str+os.EOL,stdout.toString());
2224
}));

0 commit comments

Comments
(0)