Skip to content

Commit 5013022

Browse files
cjihrigItalo A. Casas
authored andcommitted
test: s/assert.notEqual()/assert.notStrictEqual()/
PR-URL: #10541 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
1 parent 44174a5 commit 5013022

29 files changed

+64
-64
lines changed

test/addons/load-long-path/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ fs.writeFileSync(addonDestinationPath, contents);
3333

3434
// Attempt to load at long path destination
3535
const addon = require(addonDestinationPath);
36-
assert.notEqual(addon, null);
36+
assert.notStrictEqual(addon, null);
3737
assert.strictEqual(addon.hello(), 'world');

test/disabled/test-setuidgid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ const assert = require('assert');
66
var oldgid = process.getgid();
77
process.setgid('nobody');
88
var newgid = process.getgid();
9-
assert.notEqual(newgid, oldgid, 'gids expected to be different');
9+
assert.notStrictEqual(newgid, oldgid, 'gids expected to be different');
1010

1111
var olduid = process.getuid();
1212
process.setuid('nobody');
1313
var newuid = process.getuid();
14-
assert.notEqual(newuid, olduid, 'uids expected to be different');
14+
assert.notStrictEqual(newuid, olduid, 'uids expected to be different');
1515

1616
try {
1717
process.setuid('nobody1234');

test/doctool/test-doctool-html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ testData.forEach((item) => {
9696
const actual = output.replace(/\s/g, '');
9797
// Assert that the input stripped of all whitespace contains the
9898
// expected list
99-
assert.notEqual(actual.indexOf(expected), -1);
99+
assert.notStrictEqual(actual.indexOf(expected), -1);
100100
}));
101101
}));
102102
}));

test/fixtures/not-main-module.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const assert = require('assert');
2-
assert.notEqual(module, require.main, 'require.main should not == module');
3-
assert.notEqual(module, process.mainModule,
4-
'process.mainModule should not === module');
2+
assert.notStrictEqual(module, require.main, 'require.main should not == module');
3+
assert.notStrictEqual(module, process.mainModule,
4+
'process.mainModule should not === module');

test/parallel/test-child-process-spawn-shell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const cp = require('child_process');
66
// Verify that a shell is, in fact, executed
77
const doesNotExist = cp.spawn('does-not-exist', {shell: true});
88

9-
assert.notEqual(doesNotExist.spawnfile, 'does-not-exist');
9+
assert.notStrictEqual(doesNotExist.spawnfile, 'does-not-exist');
1010
doesNotExist.on('error', common.fail);
1111
doesNotExist.on('exit', common.mustCall((code, signal) => {
1212
assert.strictEqual(signal, null);

test/parallel/test-child-process-spawnsync-shell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const cp = require('child_process');
66
// Verify that a shell is, in fact, executed
77
const doesNotExist = cp.spawnSync('does-not-exist', {shell: true});
88

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

test/parallel/test-console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
115115
strings.shift());
116116
assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
117117
strings.shift());
118-
assert.notEqual(-1, strings.shift().indexOf('foo: [Object]'));
118+
assert.ok(strings.shift().includes('foo: [Object]'));
119119
assert.strictEqual(-1, strings.shift().indexOf('baz'));
120120
assert.ok(/^label: \d+\.\d{3}ms$/.test(strings.shift().trim()));
121121
assert.ok(/^__proto__: \d+\.\d{3}ms$/.test(strings.shift().trim()));

test/parallel/test-crypto-fips.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ function testHelper(stream, args, expectedOutput, cmd, env) {
4747

4848
function responseHandler(buffer, expectedOutput) {
4949
const response = buffer.toString();
50-
assert.notEqual(0, response.length);
50+
assert.notStrictEqual(response.length, 0);
5151
if (FIPS_ENABLED !== expectedOutput && FIPS_DISABLED !== expectedOutput) {
5252
// In the case of expected errors just look for a substring.
53-
assert.notEqual(-1, response.indexOf(expectedOutput));
53+
assert.ok(response.includes(expectedOutput));
5454
} else {
5555
// Normal path where we expect either FIPS enabled or disabled.
5656
assert.strictEqual(expectedOutput, Number(response));

test/parallel/test-crypto-hash.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ assert.deepStrictEqual(
6767
// stream interface should produce the same result.
6868
assert.deepStrictEqual(a5, a3, 'stream interface is consistent');
6969
assert.deepStrictEqual(a6, a3, 'stream interface is consistent');
70-
assert.notEqual(a7, undefined, 'no data should return data');
71-
assert.notEqual(a8, undefined, 'empty string should generate data');
70+
assert.notStrictEqual(a7, undefined, 'no data should return data');
71+
assert.notStrictEqual(a8, undefined, 'empty string should generate data');
7272

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

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

test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ function runTestWithAbortOnUncaughtException() {
7272
child_process.exec(createTestCmdLine({
7373
withAbortOnUncaughtException: true
7474
}), function onTestDone(err, stdout, stderr) {
75-
assert.notEqual(err.code, RAN_UNCAUGHT_EXCEPTION_HANDLER_EXIT_CODE,
76-
'child process should not have run its uncaughtException ' +
77-
'event handler');
75+
assert.notStrictEqual(err.code, RAN_UNCAUGHT_EXCEPTION_HANDLER_EXIT_CODE,
76+
'child process should not have run its ' +
77+
'uncaughtException event handler');
7878
assert(common.nodeProcessAborted(err.code, err.signal),
7979
'process should have aborted, but did not');
8080
});

0 commit comments

Comments
 (0)