test: rename process.argv[0] to process.execPath, rename ex to err

PR-URL: https://github.com/nodejs/node/pull/23488
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Kayla Altepeter 2018-10-12 09:49:09 -07:00 committed by Ruben Bridgewater
parent d5824f8552
commit 61f5543e5b
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -29,8 +29,8 @@ const { execFile } = require('child_process');
// test for leaked global detection // test for leaked global detection
{ {
const p = fixtures.path('leakedGlobal.js'); const p = fixtures.path('leakedGlobal.js');
execFile(process.argv[0], [p], common.mustCall((ex, stdout, stderr) => { execFile(process.execPath, [p], common.mustCall((err, stdout, stderr) => {
assert.notStrictEqual(ex.code, 0); assert.notStrictEqual(err.code, 0);
assert.ok(/\bAssertionError\b.*\bUnexpected global\b.*\bgc\b/.test(stderr)); assert.ok(/\bAssertionError\b.*\bUnexpected global\b.*\bgc\b/.test(stderr));
})); }));
} }
@ -85,8 +85,8 @@ const failFixtures = [
]; ];
for (const p of failFixtures) { for (const p of failFixtures) {
const [file, expected] = p; const [file, expected] = p;
execFile(process.argv[0], [file], common.mustCall((ex, stdout, stderr) => { execFile(process.execPath, [file], common.mustCall((err, stdout, stderr) => {
assert.ok(ex); assert.ok(err);
assert.strictEqual(stderr, ''); assert.strictEqual(stderr, '');
const firstLine = stdout.split('\n').shift(); const firstLine = stdout.split('\n').shift();
assert.strictEqual(firstLine, expected); assert.strictEqual(firstLine, expected);