Skip to content

test: s/assert.notEqual()/assert.notStrictEqual()/ #10541

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

Merged
merged 1 commit into from
Jan 6, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion test/addons/load-long-path/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ fs.writeFileSync(addonDestinationPath, contents);

// Attempt to load at long path destination
const addon = require(addonDestinationPath);
assert.notEqual(addon, null);
assert.notStrictEqual(addon, null);
assert.strictEqual(addon.hello(), 'world');
4 changes: 2 additions & 2 deletions test/disabled/test-setuidgid.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const assert = require('assert');
var oldgid = process.getgid();
process.setgid('nobody');
var newgid = process.getgid();
assert.notEqual(newgid, oldgid, 'gids expected to be different');
assert.notStrictEqual(newgid, oldgid, 'gids expected to be different');

var olduid = process.getuid();
process.setuid('nobody');
var newuid = process.getuid();
assert.notEqual(newuid, olduid, 'uids expected to be different');
assert.notStrictEqual(newuid, olduid, 'uids expected to be different');

try {
process.setuid('nobody1234');
Expand Down
2 changes: 1 addition & 1 deletion test/doctool/test-doctool-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ testData.forEach(function(item) {
const actual = output.replace(/\s/g, '');
// Assert that the input stripped of all whitespace contains the
// expected list
assert.notEqual(actual.indexOf(expected), -1);
assert.notStrictEqual(actual.indexOf(expected), -1);
}));
}));
}));
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/not-main-module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const assert = require('assert');
assert.notEqual(module, require.main, 'require.main should not == module');
assert.notEqual(module, process.mainModule,
'process.mainModule should not === module');
assert.notStrictEqual(module, require.main, 'require.main should not == module');
assert.notStrictEqual(module, process.mainModule,
'process.mainModule should not === module');
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-spawn-shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const cp = require('child_process');
// Verify that a shell is, in fact, executed
const doesNotExist = cp.spawn('does-not-exist', {shell: true});

assert.notEqual(doesNotExist.spawnfile, 'does-not-exist');
assert.notStrictEqual(doesNotExist.spawnfile, 'does-not-exist');
doesNotExist.on('error', common.fail);
doesNotExist.on('exit', common.mustCall((code, signal) => {
assert.strictEqual(signal, null);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-spawnsync-shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const cp = require('child_process');
// Verify that a shell is, in fact, executed
const doesNotExist = cp.spawnSync('does-not-exist', {shell: true});

assert.notEqual(doesNotExist.file, 'does-not-exist');
assert.notStrictEqual(doesNotExist.file, 'does-not-exist');
assert.strictEqual(doesNotExist.error, undefined);
assert.strictEqual(doesNotExist.signal, null);

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
strings.shift());
assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
strings.shift());
assert.notEqual(-1, strings.shift().indexOf('foo: [Object]'));
assert.ok(strings.shift().includes('foo: [Object]'));
assert.strictEqual(-1, strings.shift().indexOf('baz'));
assert.ok(/^label: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^__proto__: \d+\.\d{3}ms$/.test(strings.shift().trim()));
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-crypto-fips.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ function testHelper(stream, args, expectedOutput, cmd, env) {

function responseHandler(buffer, expectedOutput) {
const response = buffer.toString();
assert.notEqual(0, response.length);
assert.notStrictEqual(response.length, 0);
if (FIPS_ENABLED !== expectedOutput && FIPS_DISABLED !== expectedOutput) {
// In the case of expected errors just look for a substring.
assert.notEqual(-1, response.indexOf(expectedOutput));
assert.ok(response.includes(expectedOutput));
} else {
// Normal path where we expect either FIPS enabled or disabled.
assert.strictEqual(expectedOutput, Number(response));
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-crypto-hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ assert.deepStrictEqual(
// stream interface should produce the same result.
assert.deepStrictEqual(a5, a3, 'stream interface is consistent');
assert.deepStrictEqual(a6, a3, 'stream interface is consistent');
assert.notEqual(a7, undefined, 'no data should return data');
assert.notEqual(a8, undefined, 'empty string should generate data');
assert.notStrictEqual(a7, undefined, 'no data should return data');
assert.notStrictEqual(a8, undefined, 'empty string should generate data');

// Test multiple updates to same hash
var h1 = crypto.createHash('sha1').update('Test123').digest('hex');
Expand Down Expand Up @@ -100,7 +100,7 @@ assert.strictEqual(
'4b21bbd1a68e690a730ddcb5a8bc94ead9879ffe82580767ad7ec6fa8ba2dea6' +
'43a821af66afa9a45b6a78c712fecf0e56dc7f43aef4bcfc8eb5b4d8dca6ea5b');

assert.notEqual(
assert.notStrictEqual(
hutf8,
crypto.createHash('sha512').update('УТФ-8 text', 'latin1').digest('hex'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ function runTestWithoutAbortOnUncaughtException() {
assert(!stderr.includes(domainErrMsg), 'stderr output must not ' +
'include domain\'s error\'s message');

assert.notEqual(err.code, 0,
'child process should have exited with a non-zero ' +
'exit code, but did not');
assert.notStrictEqual(err.code, 0,
'child process should have exited with a ' +
'non-zero exit code, but did not');
});
}

function runTestWithAbortOnUncaughtException() {
child_process.exec(createTestCmdLine({
withAbortOnUncaughtException: true
}), function onTestDone(err, stdout, stderr) {
assert.notEqual(err.code, RAN_UNCAUGHT_EXCEPTION_HANDLER_EXIT_CODE,
'child process should not have run its uncaughtException ' +
'event handler');
assert.notStrictEqual(err.code, RAN_UNCAUGHT_EXCEPTION_HANDLER_EXIT_CODE,
'child process should not have run its ' +
'uncaughtException event handler');
assert(common.nodeProcessAborted(err.code, err.signal),
'process should have aborted, but did not');
});
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-event-emitter-remove-all-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function listener() {}
assert.deepStrictEqual(bazListeners, [listener, listener]);
// After calling removeAllListeners(),
// new listeners arrays is different from the old.
assert.notEqual(ee.listeners('bar'), barListeners);
assert.notEqual(ee.listeners('baz'), bazListeners);
assert.notStrictEqual(ee.listeners('bar'), barListeners);
assert.notStrictEqual(ee.listeners('baz'), bazListeners);
}

{
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-fs-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fs.access(__filename, fs.R_OK, common.mustCall((err) => {
}));

fs.access(doesNotExist, common.mustCall((err) => {
assert.notEqual(err, null, 'error should exist');
assert.notStrictEqual(err, null, 'error should exist');
assert.strictEqual(err.code, 'ENOENT');
assert.strictEqual(err.path, doesNotExist);
}));
Expand All @@ -85,7 +85,7 @@ fs.access(readOnlyFile, fs.W_OK, common.mustCall((err) => {
if (hasWriteAccessForReadonlyFile) {
assert.ifError(err);
} else {
assert.notEqual(err, null, 'error should exist');
assert.notStrictEqual(err, null, 'error should exist');
assert.strictEqual(err.path, readOnlyFile);
}
}));
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-https-agent-disable-session-reuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ const server = https.createServer(options, function(req, res) {
process.on('exit', function() {
assert.equal(serverRequests, TOTAL_REQS);
assert.equal(clientSessions.length, TOTAL_REQS);
assert.notEqual(clientSessions[0].toString('hex'),
clientSessions[1].toString('hex'));
assert.notStrictEqual(clientSessions[0].toString('hex'),
clientSessions[1].toString('hex'));
});
16 changes: 8 additions & 8 deletions test/parallel/test-https-agent-session-reuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ process.on('exit', function() {
assert.strictEqual(serverRequests, 6);
assert.strictEqual(clientSessions['first'].toString('hex'),
clientSessions['first-reuse'].toString('hex'));
assert.notEqual(clientSessions['first'].toString('hex'),
clientSessions['cipher-change'].toString('hex'));
assert.notEqual(clientSessions['first'].toString('hex'),
clientSessions['before-drop'].toString('hex'));
assert.notEqual(clientSessions['cipher-change'].toString('hex'),
clientSessions['before-drop'].toString('hex'));
assert.notEqual(clientSessions['before-drop'].toString('hex'),
clientSessions['after-drop'].toString('hex'));
assert.notStrictEqual(clientSessions['first'].toString('hex'),
clientSessions['cipher-change'].toString('hex'));
assert.notStrictEqual(clientSessions['first'].toString('hex'),
clientSessions['before-drop'].toString('hex'));
assert.notStrictEqual(clientSessions['cipher-change'].toString('hex'),
clientSessions['before-drop'].toString('hex'));
assert.notStrictEqual(clientSessions['before-drop'].toString('hex'),
clientSessions['after-drop'].toString('hex'));
assert.strictEqual(clientSessions['after-drop'].toString('hex'),
clientSessions['after-drop-reuse'].toString('hex'));
});
4 changes: 2 additions & 2 deletions test/parallel/test-module-loading-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ try {
try {
require();
} catch (e) {
assert.notEqual(e.toString().indexOf('missing path'), -1);
assert.ok(e.toString().includes('missing path'));
}

try {
require({});
} catch (e) {
assert.notEqual(e.toString().indexOf('path must be a string'), -1);
assert.ok(e.toString().includes('path must be a string'));
}
2 changes: 1 addition & 1 deletion test/parallel/test-net-keepalive.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var echoServer = net.createServer(function(connection) {
echoServer.close();
}, 1), common.platformTimeout(100));
connection.setTimeout(0);
assert.notEqual(connection.setKeepAlive, undefined);
assert.notStrictEqual(connection.setKeepAlive, undefined);
// send a keepalive packet after 50 ms
connection.setKeepAlive(true, common.platformTimeout(50));
connection.on('end', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-net-listen-exclusive-random-ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (cluster.isMaster) {

worker2.on('message', function(port2) {
assert.equal(port2, port2 | 0, 'second worker could not listen');
assert.notEqual(port1, port2, 'ports should not be equal');
assert.notStrictEqual(port1, port2, 'ports should not be equal');
worker1.kill();
worker2.kill();
});
Expand Down
26 changes: 13 additions & 13 deletions test/parallel/test-net-remote-address-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ var remoteFamilyCandidates = ['IPv4'];
if (common.hasIPv6) remoteFamilyCandidates.push('IPv6');

var server = net.createServer(common.mustCall(function(socket) {
assert.notEqual(-1, remoteAddrCandidates.indexOf(socket.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(socket.remoteFamily));
assert.ok(remoteAddrCandidates.includes(socket.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(socket.remoteFamily));
assert.ok(socket.remotePort);
assert.notEqual(socket.remotePort, this.address().port);
assert.notStrictEqual(socket.remotePort, this.address().port);
socket.on('end', function() {
if (++conns_closed === 2) server.close();
});
socket.on('close', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(socket.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(socket.remoteFamily));
assert.ok(remoteAddrCandidates.includes(socket.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(socket.remoteFamily));
});
socket.resume();
}, 2));
Expand All @@ -31,23 +31,23 @@ server.listen(0, 'localhost', function() {
var client = net.createConnection(this.address().port, 'localhost');
var client2 = net.createConnection(this.address().port);
client.on('connect', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(client.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(client.remoteFamily));
assert.ok(remoteAddrCandidates.includes(client.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(client.remoteFamily));
assert.strictEqual(client.remotePort, server.address().port);
client.end();
});
client.on('close', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(client.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(client.remoteFamily));
assert.ok(remoteAddrCandidates.includes(client.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(client.remoteFamily));
});
client2.on('connect', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(client2.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(client2.remoteFamily));
assert.ok(remoteAddrCandidates.includes(client2.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(client2.remoteFamily));
assert.strictEqual(client2.remotePort, server.address().port);
client2.end();
});
client2.on('close', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(client2.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(client2.remoteFamily));
assert.ok(remoteAddrCandidates.includes(client2.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(client2.remoteFamily));
});
});
2 changes: 1 addition & 1 deletion test/parallel/test-process-cpuUsage.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ assert.throws(function() {

// Ensure that the return value is the expected shape.
function validateResult(result) {
assert.notEqual(result, null);
assert.notStrictEqual(result, null);

assert(Number.isFinite(result.user));
assert(Number.isFinite(result.system));
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-regress-GH-7511.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ const vm = require('vm');
assert.doesNotThrow(function() {
var context = vm.createContext({ process: process });
var result = vm.runInContext('process.env["PATH"]', context);
assert.notEqual(undefined, result);
assert.notStrictEqual(undefined, result);
});
2 changes: 1 addition & 1 deletion test/parallel/test-regress-GH-node-9326.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ var cp = child_process.spawn(process.execPath, [
]);

cp.on('exit', function(code) {
assert.notEqual(code, 0);
assert.notStrictEqual(code, 0);
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ const assert = require('assert');
const content = require(common.fixturesDir +
'/json-with-directory-name-module/module-stub/one-trailing-slash/two/three.js');

assert.notEqual(content.rocko, 'artischocko');
assert.notStrictEqual(content.rocko, 'artischocko');
assert.equal(content, 'hello from module-stub!');
2 changes: 1 addition & 1 deletion test/parallel/test-socket-write-after-fin-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ server.listen(0, function() {
assert(gotServerEnd);
assert(gotServerError);
assert.equal(gotServerError.code, 'EPIPE');
assert.notEqual(gotServerError.message, 'write after end');
assert.notStrictEqual(gotServerError.message, 'write after end');
console.log('ok');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ timers.enroll(foo, 1);
timers._unrefActive(foo);

setTimeout(function() {
assert.notEqual(nbTimersFired, 2);
assert.notStrictEqual(nbTimersFired, 2);
}, 20);
2 changes: 1 addition & 1 deletion test/parallel/test-tls-handshake-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var server = tls.createServer({
});

c.on('error', common.mustCall(function(err) {
assert.notEqual(err.code, 'ECONNRESET');
assert.notStrictEqual(err.code, 'ECONNRESET');
}));

c.on('close', common.mustCall(function(err) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-tls-set-ciphers.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const reply = 'I AM THE WALRUS'; // something recognizable
let response = '';

process.on('exit', function() {
assert.notEqual(response.indexOf(reply), -1);
assert.ok(response.includes(reply));
});

const server = tls.createServer(options, common.mustCall(function(conn) {
Expand Down
10 changes: 5 additions & 5 deletions test/parallel/test-whatwg-url-searchparams-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ assert.throws(() => {
});
}, TypeError);
params = new URLSearchParams('');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
// eslint-disable-next-line no-proto
assert.strictEqual(params.__proto__, URLSearchParams.prototype,
'expected URLSearchParams.prototype as prototype.');
Expand All @@ -40,19 +40,19 @@ assert.strictEqual(params + '', '%5Bobject%20Object%5D=');

// URLSearchParams constructor, string.
params = new URLSearchParams('a=b');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(true, params.has('a'),
'Search params object has name "a"');
assert.strictEqual(false, params.has('b'),
'Search params object has not got name "b"');
params = new URLSearchParams('a=b&c');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(true, params.has('a'),
'Search params object has name "a"');
assert.strictEqual(true, params.has('c'),
'Search params object has name "c"');
params = new URLSearchParams('&a&&& &&&&&a+b=& c&m%c3%b8%c3%b8');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(true, params.has('a'), 'Search params object has name "a"');
assert.strictEqual(true, params.has('a b'),
'Search params object has name "a b"');
Expand All @@ -68,7 +68,7 @@ assert.strictEqual(true, params.has('møø'),
// URLSearchParams constructor, object.
const seed = new URLSearchParams('a=b&c=d');
params = new URLSearchParams(seed);
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(params.get('a'), 'b');
assert.strictEqual(params.get('c'), 'd');
assert.strictEqual(false, params.has('d'));
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-whatwg-url-searchparams-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ assert.strictEqual(params.get('a'), '');

// More get() basics
params = new URLSearchParams('first=second&third&&');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(true, params.has('first'),
'Search params object has name "first"');
assert.strictEqual(params.get('first'), 'second',
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-zlib-sync-no-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ const unzipper = new zlib.Gunzip();
unzipper.on('close', shouldNotBeCalled);

const unzipped = unzipper._processChunk(zipped, zlib.constants.Z_FINISH);
assert.notEqual(zipped.toString(), message);
assert.notStrictEqual(zipped.toString(), message);
assert.strictEqual(unzipped.toString(), message);