Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor test-preload #9803

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions test/parallel/test-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ childProcess.exec(nodeBinary + ' '
+ fixtureB,
function(err, stdout, stderr) {
if (err) throw err;
assert.equal(stdout, 'A\nB\n');
assert.strictEqual(stdout, 'A\nB\n');
});

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

// test that preloading a throwing module aborts
Expand All @@ -55,7 +55,7 @@ childProcess.exec(nodeBinary + ' '
+ fixtureB,
function(err, stdout, stderr) {
if (err) {
assert.equal(stdout, 'A\n');
assert.strictEqual(stdout, 'A\n');
} else {
throw new Error('Preload should have failed');
}
Expand All @@ -67,7 +67,7 @@ childProcess.exec(nodeBinary + ' '
+ '-e "console.log(\'hello\');"',
function(err, stdout, stderr) {
if (err) throw err;
assert.equal(stdout, 'A\nhello\n');
assert.strictEqual(stdout, 'A\nhello\n');
});

// test that preload can be used with stdin
Expand All @@ -76,14 +76,14 @@ const stdinProc = childProcess.spawn(
['--require', fixtureA],
{stdio: 'pipe'}
);
stdinProc.stdin.end('console.log(\'hello\');');
stdinProc.stdin.end("console.log('hello');");
var stdinStdout = '';
stdinProc.stdout.on('data', function(d) {
stdinStdout += d;
});
stdinProc.on('close', function(code) {
assert.equal(code, 0);
assert.equal(stdinStdout, 'A\nhello\n');
assert.strictEqual(code, 0);
assert.strictEqual(stdinStdout, 'A\nhello\n');
});

// test that preload can be used with repl
Expand All @@ -98,12 +98,12 @@ replProc.stdout.on('data', function(d) {
replStdout += d;
});
replProc.on('close', function(code) {
assert.equal(code, 0);
assert.strictEqual(code, 0);
const output = [
'A',
'> '
].join('\n');
assert.equal(replStdout, output);
assert.strictEqual(replStdout, output);
});

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

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

interactive.stdin.write('a\n');
Expand Down