Skip to content

Commit ddecf0a

Browse files
TrottMylesBorins
authored andcommitted
test: refactor test-preload
* assert.equal() -> assert.strictEqual() * replace template string with a string; no variable substitution or concatenation or anything like that PR-URL: #9803 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 81b16d0 commit ddecf0a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

test/parallel/test-preload.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ childProcess.exec(nodeBinary + ' '
3737
+ fixtureB,
3838
function(err, stdout, stderr) {
3939
if (err) throw err;
40-
assert.equal(stdout, 'A\nB\n');
40+
assert.strictEqual(stdout, 'A\nB\n');
4141
});
4242

4343
// test preloading multiple modules works
@@ -46,7 +46,7 @@ childProcess.exec(nodeBinary + ' '
4646
+ fixtureC,
4747
function(err, stdout, stderr) {
4848
if (err) throw err;
49-
assert.equal(stdout, 'A\nB\nC\n');
49+
assert.strictEqual(stdout, 'A\nB\nC\n');
5050
});
5151

5252
// test that preloading a throwing module aborts
@@ -55,7 +55,7 @@ childProcess.exec(nodeBinary + ' '
5555
+ fixtureB,
5656
function(err, stdout, stderr) {
5757
if (err) {
58-
assert.equal(stdout, 'A\n');
58+
assert.strictEqual(stdout, 'A\n');
5959
} else {
6060
throw new Error('Preload should have failed');
6161
}
@@ -67,7 +67,7 @@ childProcess.exec(nodeBinary + ' '
6767
+ '-e "console.log(\'hello\');"',
6868
function(err, stdout, stderr) {
6969
if (err) throw err;
70-
assert.equal(stdout, 'A\nhello\n');
70+
assert.strictEqual(stdout, 'A\nhello\n');
7171
});
7272

7373
// test that preload can be used with stdin
@@ -76,14 +76,14 @@ const stdinProc = childProcess.spawn(
7676
['--require', fixtureA],
7777
{stdio: 'pipe'}
7878
);
79-
stdinProc.stdin.end('console.log(\'hello\');');
79+
stdinProc.stdin.end("console.log('hello');");
8080
var stdinStdout = '';
8181
stdinProc.stdout.on('data', function(d) {
8282
stdinStdout += d;
8383
});
8484
stdinProc.on('close', function(code) {
85-
assert.equal(code, 0);
86-
assert.equal(stdinStdout, 'A\nhello\n');
85+
assert.strictEqual(code, 0);
86+
assert.strictEqual(stdinStdout, 'A\nhello\n');
8787
});
8888

8989
// test that preload can be used with repl
@@ -98,12 +98,12 @@ replProc.stdout.on('data', function(d) {
9898
replStdout += d;
9999
});
100100
replProc.on('close', function(code) {
101-
assert.equal(code, 0);
101+
assert.strictEqual(code, 0);
102102
const output = [
103103
'A',
104104
'> '
105105
].join('\n');
106-
assert.equal(replStdout, output);
106+
assert.strictEqual(replStdout, output);
107107
});
108108

109109
// test that preload placement at other points in the cmdline
@@ -114,7 +114,7 @@ childProcess.exec(nodeBinary + ' '
114114
+ preloadOption([fixtureA, fixtureB]),
115115
function(err, stdout, stderr) {
116116
if (err) throw err;
117-
assert.equal(stdout, 'A\nB\nhello\n');
117+
assert.strictEqual(stdout, 'A\nB\nhello\n');
118118
});
119119

120120
// test that preload works with -i
@@ -123,7 +123,7 @@ const interactive = childProcess.exec(nodeBinary + ' '
123123
+ '-i',
124124
common.mustCall(function(err, stdout, stderr) {
125125
assert.ifError(err);
126-
assert.strictEqual(stdout, `> 'test'\n> `);
126+
assert.strictEqual(stdout, "> 'test'\n> ");
127127
}));
128128

129129
interactive.stdin.write('a\n');

0 commit comments

Comments
 (0)