test: modernize js and tighten equality checking
Changed var --> const and let. Changed assert.notEqual --> assert.notStrictEqual Fixed comment spelling PR-URL: https://github.com/nodejs/node/pull/8618 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
00dd33ce8c
commit
3ffa6a884c
@ -1,19 +1,19 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
var returns = 0;
|
let returns = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Spawns 'pwd' with given options, then test
|
Spawns 'pwd' with given options, then test
|
||||||
- whether the exit code equals forCode,
|
- whether the exit code equals forCode,
|
||||||
- optionally whether the stdout result matches forData
|
- optionally whether the stdout result matches forData
|
||||||
(after removing traling whitespace)
|
(after removing trailing whitespace)
|
||||||
*/
|
*/
|
||||||
function testCwd(options, forCode, forData) {
|
function testCwd(options, forCode, forData) {
|
||||||
var data = '';
|
let data = '';
|
||||||
|
|
||||||
var child = common.spawnPwd(options);
|
const child = common.spawnPwd(options);
|
||||||
|
|
||||||
child.stdout.setEncoding('utf8');
|
child.stdout.setEncoding('utf8');
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ if (common.isWindows) {
|
|||||||
// Assume does-not-exist doesn't exist, expect exitCode=-1 and errno=ENOENT
|
// Assume does-not-exist doesn't exist, expect exitCode=-1 and errno=ENOENT
|
||||||
{
|
{
|
||||||
testCwd({cwd: 'does-not-exist'}, -1).on('error', common.mustCall(function(e) {
|
testCwd({cwd: 'does-not-exist'}, -1).on('error', common.mustCall(function(e) {
|
||||||
assert.equal(e.code, 'ENOENT');
|
assert.strictEqual(e.code, 'ENOENT');
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ testCwd({cwd: undefined}, 0);
|
|||||||
testCwd({cwd: null}, 0);
|
testCwd({cwd: null}, 0);
|
||||||
|
|
||||||
// Check whether all tests actually returned
|
// Check whether all tests actually returned
|
||||||
assert.notEqual(0, returns);
|
assert.notStrictEqual(returns, 0);
|
||||||
process.on('exit', function() {
|
process.on('exit', function() {
|
||||||
assert.equal(0, returns);
|
assert.strictEqual(returns, 0);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user