diff --git a/test/disabled/test-fs-largefile.js b/test/disabled/test-fs-largefile.js index b78378548413b7..365cdec188d5c7 100644 --- a/test/disabled/test-fs-largefile.js +++ b/test/disabled/test-fs-largefile.js @@ -9,14 +9,14 @@ const path = require('path'), message = 'Large File'; fs.truncateSync(fd, offset); -assert.equal(fs.statSync(filepath).size, offset); +assert.strictEqual(fs.statSync(filepath).size, offset); var writeBuf = Buffer.from(message); fs.writeSync(fd, writeBuf, 0, writeBuf.length, offset); var readBuf = Buffer.allocUnsafe(writeBuf.length); fs.readSync(fd, readBuf, 0, readBuf.length, offset); -assert.equal(readBuf.toString(), message); +assert.strictEqual(readBuf.toString(), message); fs.readSync(fd, readBuf, 0, 1, 0); -assert.equal(readBuf[0], 0); +assert.strictEqual(readBuf[0], 0); var exceptionRaised = false; try { @@ -24,7 +24,7 @@ try { } catch (err) { console.log(err); exceptionRaised = true; - assert.equal(err.message, 'Not an integer'); + assert.strictEqual(err.message, 'Not an integer'); } assert.ok(exceptionRaised); fs.close(fd); diff --git a/test/disabled/test-http-abort-stream-end.js b/test/disabled/test-http-abort-stream-end.js index 3e8bff21248ca2..5dc51d9eee911f 100644 --- a/test/disabled/test-http-abort-stream-end.js +++ b/test/disabled/test-http-abort-stream-end.js @@ -36,6 +36,6 @@ s.listen(common.PORT, function() { process.on('exit', function() { assert(aborted); - assert.equal(size, maxSize); + assert.strictEqual(size, maxSize); console.log('ok'); }); diff --git a/test/disabled/test-readline.js b/test/disabled/test-readline.js index 7896833b93d186..4273f1013415e4 100644 --- a/test/disabled/test-readline.js +++ b/test/disabled/test-readline.js @@ -49,12 +49,12 @@ var rl = readlineFakeStream(); var written_bytes_length, refreshed; rl.write('foo'); -assert.equal(3, rl.cursor); +assert.strictEqual(3, rl.cursor); [key.xterm, key.rxvt, key.gnome, key.putty].forEach(function(key) { rl.write.apply(rl, key.home); - assert.equal(0, rl.cursor); + assert.strictEqual(0, rl.cursor); rl.write.apply(rl, key.end); - assert.equal(3, rl.cursor); + assert.strictEqual(3, rl.cursor); }); rl = readlineFakeStream(); @@ -76,9 +76,9 @@ rl.write.apply(rl, key.xterm.home); ].forEach(function(action) { written_bytes_length = rl.written_bytes.length; rl.write.apply(rl, action.key); - assert.equal(action.cursor, rl.cursor); + assert.strictEqual(action.cursor, rl.cursor); refreshed = written_bytes_length !== rl.written_bytes.length; - assert.equal(true, refreshed); + assert.strictEqual(true, refreshed); }); rl = readlineFakeStream(); @@ -93,7 +93,7 @@ rl.write.apply(rl, key.xterm.home); '' ].forEach(function(expectedLine) { rl.write.apply(rl, key.xterm.metad); - assert.equal(0, rl.cursor); - assert.equal(expectedLine, rl.line); + assert.strictEqual(0, rl.cursor); + assert.strictEqual(expectedLine, rl.line); }); rl.close(); diff --git a/test/disabled/test-sendfd.js b/test/disabled/test-sendfd.js index 969e8b5850dfe2..9f1159e30a401c 100644 --- a/test/disabled/test-sendfd.js +++ b/test/disabled/test-sendfd.js @@ -63,7 +63,7 @@ var logChild = function(d) { // validate any data sent back by the child. We send the write end of the // pipe to the child and close it off in our process. var pipeFDs = netBinding.pipe(); -assert.equal(pipeFDs.length, 2); +assert.strictEqual(pipeFDs.length, 2); var seenOrdinals = []; @@ -72,8 +72,8 @@ pipeReadStream.on('data', function(data) { data.toString('utf8').trim().split('\n').forEach(function(d) { var rd = JSON.parse(d); - assert.equal(rd.pid, cpp); - assert.equal(seenOrdinals.indexOf(rd.ord), -1); + assert.strictEqual(rd.pid, cpp); + assert.strictEqual(seenOrdinals.indexOf(rd.ord), -1); seenOrdinals.unshift(rd.ord); }); @@ -119,8 +119,8 @@ cp.on('exit', function(code, signal) { srv.close(); // fs.unlinkSync(SOCK_PATH); - assert.equal(code, 0); - assert.equal(seenOrdinals.length, 2); + assert.strictEqual(code, 0); + assert.strictEqual(seenOrdinals.length, 2); }); // vim:ts=2 sw=2 et diff --git a/test/disabled/test-setuidgid.js b/test/disabled/test-setuidgid.js index 3603e9bb421a26..14a480fd958923 100644 --- a/test/disabled/test-setuidgid.js +++ b/test/disabled/test-setuidgid.js @@ -16,7 +16,7 @@ assert.notStrictEqual(newuid, olduid, 'uids expected to be different'); try { process.setuid('nobody1234'); } catch (e) { - assert.equal(e.message, + assert.strictEqual(e.message, 'failed to resolve group', 'unexpected error message' ); diff --git a/test/fixtures/GH-892-request.js b/test/fixtures/GH-892-request.js index eccbafcf4399c2..d0db3e29ff5023 100644 --- a/test/fixtures/GH-892-request.js +++ b/test/fixtures/GH-892-request.js @@ -16,7 +16,7 @@ var options = { }; var req = https.request(options, function(res) { - assert.equal(200, res.statusCode); + assert.strictEqual(200, res.statusCode); gotResponse = true; console.error('DONE'); res.resume(); diff --git a/test/fixtures/b/c.js b/test/fixtures/b/c.js index a27baeb658ae50..2305e5b28635bc 100644 --- a/test/fixtures/b/c.js +++ b/test/fixtures/b/c.js @@ -4,7 +4,7 @@ const assert = require('assert'); const package = require('./package'); -assert.equal('world', package.hello); +assert.strictEqual('world', package.hello); console.error('load fixtures/b/c.js'); diff --git a/test/fixtures/node_modules/baz/index.js b/test/fixtures/node_modules/baz/index.js index 59fc9fe79bcb61..939f0351699195 100644 --- a/test/fixtures/node_modules/baz/index.js +++ b/test/fixtures/node_modules/baz/index.js @@ -2,9 +2,9 @@ console.error(__filename); console.error(module.paths.join('\n') + '\n'); // this should work, and get the one that doesn't throw const assert = require('assert'); -assert.equal(require('bar'), require('../bar.js')); +assert.strictEqual(require('bar'), require('../bar.js')); // this should work, and get the one in ./node_modules/asdf.js -assert.equal(require('asdf'), require('./node_modules/asdf.js')); +assert.strictEqual(require('asdf'), require('./node_modules/asdf.js')); module.exports = 'eye catcher'; diff --git a/test/fixtures/node_modules/foo.js b/test/fixtures/node_modules/foo.js index 56a98f76a86ddf..4d4cc9fe12fbc8 100644 --- a/test/fixtures/node_modules/foo.js +++ b/test/fixtures/node_modules/foo.js @@ -1,4 +1,4 @@ console.error(__filename); console.error(module.paths.join('\n') + '\n'); const assert = require('assert'); -assert.equal(require('baz'), require('./baz/index.js')); +assert.strictEqual(require('baz'), require('./baz/index.js')); diff --git a/test/internet/test-dns-txt-sigsegv.js b/test/internet/test-dns-txt-sigsegv.js index 3c85d546cfcddd..54cc4648510ed7 100644 --- a/test/internet/test-dns-txt-sigsegv.js +++ b/test/internet/test-dns-txt-sigsegv.js @@ -4,6 +4,6 @@ const assert = require('assert'); const dns = require('dns'); dns.resolveTxt('www.microsoft.com', function(err, records) { - assert.equal(err, null); - assert.equal(records.length, 0); + assert.strictEqual(err, null); + assert.strictEqual(records.length, 0); }); diff --git a/test/message/error_exit.js b/test/message/error_exit.js index 7235801514dd45..1cb785a1b543a6 100644 --- a/test/message/error_exit.js +++ b/test/message/error_exit.js @@ -6,4 +6,4 @@ process.on('exit', function(code) { console.error('Exiting with code=%d', code); }); -assert.equal(1, 2); +assert.strictEqual(1, 2); diff --git a/test/message/error_exit.out b/test/message/error_exit.out index e25af05861b5ce..e2a29ab42dbbd2 100644 --- a/test/message/error_exit.out +++ b/test/message/error_exit.out @@ -3,7 +3,7 @@ Exiting with code=1 assert.js:* throw new assert.AssertionError({ ^ -AssertionError: 1 == 2 +AssertionError: 1 === 2 at Object. (*test*message*error_exit.js:*:*) at Module._compile (module.js:*:*) at Object.Module._extensions..js (module.js:*:*) diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 346776ef5ed483..8cba5ed517aa16 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -353,9 +353,9 @@ try { threw = true; assert.ok(e instanceof TypeError, 'type'); } -assert.equal(true, threw, - 'a.throws with an explicit error is eating extra errors', - a.AssertionError); +assert.strictEqual(true, threw, + 'a.throws with an explicit error is eating extra errors', + a.AssertionError); threw = false; // doesNotThrow should pass through all errors @@ -365,8 +365,8 @@ try { threw = true; assert.ok(e instanceof TypeError); } -assert.equal(true, threw, - 'a.doesNotThrow with an explicit error is eating extra errors'); +assert.strictEqual(true, threw, 'a.doesNotThrow with an explicit error is ' + + 'eating extra errors'); // key difference is that throwing our correct error makes an assertion error try { @@ -375,8 +375,8 @@ try { threw = true; assert.ok(e instanceof a.AssertionError); } -assert.equal(true, threw, - 'a.doesNotThrow is not catching type matching errors'); +assert.strictEqual(true, threw, + 'a.doesNotThrow is not catching type matching errors'); assert.throws(function() { assert.ifError(new Error('test error')); }); assert.doesNotThrow(function() { assert.ifError(null); }); @@ -481,10 +481,10 @@ circular.x = circular; function testAssertionMessage(actual, expected) { try { - assert.equal(actual, ''); + assert.strictEqual(actual, ''); } catch (e) { - assert.equal(e.toString(), - ['AssertionError:', expected, '==', '\'\''].join(' ')); + assert.strictEqual(e.toString(), + ['AssertionError:', expected, '===', '\'\''].join(' ')); assert.ok(e.generatedMessage, 'Message not marked as generated'); } } @@ -519,24 +519,24 @@ try { }); } catch (e) { threw = true; - assert.equal(e.message, 'Missing expected exception..'); + assert.strictEqual(e.message, 'Missing expected exception..'); } assert.ok(threw); // #5292 try { - assert.equal(1, 2); + assert.strictEqual(1, 2); } catch (e) { - assert.equal(e.toString().split('\n')[0], 'AssertionError: 1 == 2'); + assert.strictEqual(e.toString().split('\n')[0], 'AssertionError: 1 === 2'); assert.ok(e.generatedMessage, 'Message not marked as generated'); } try { - assert.equal(1, 2, 'oh no'); + assert.strictEqual(1, 2, 'oh no'); } catch (e) { - assert.equal(e.toString().split('\n')[0], 'AssertionError: oh no'); - assert.equal(e.generatedMessage, false, - 'Message incorrectly marked as generated'); + assert.strictEqual(e.toString().split('\n')[0], 'AssertionError: oh no'); + assert.strictEqual(e.generatedMessage, false, + 'Message incorrectly marked as generated'); } // Verify that throws() and doesNotThrow() throw on non-function block @@ -547,8 +547,8 @@ function testBlockTypeError(method, block) { method(block); threw = false; } catch (e) { - assert.equal(e.toString(), - 'TypeError: "block" argument must be a function'); + assert.strictEqual(e.toString(), + 'TypeError: "block" argument must be a function'); } assert.ok(threw); diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js index 503add948826ab..8efd318762684c 100644 --- a/test/parallel/test-buffer-indexof.js +++ b/test/parallel/test-buffer-indexof.js @@ -71,12 +71,12 @@ assert.strictEqual(b.indexOf('f', 5), 5); assert.strictEqual(b.indexOf('f', -1), 5); assert.strictEqual(b.indexOf('f', 6), -1); -assert.equal(b.indexOf(Buffer.from('d'), 2), 3); -assert.equal(b.indexOf(Buffer.from('f'), 5), 5); -assert.equal(b.indexOf(Buffer.from('f'), -1), 5); -assert.equal(b.indexOf(Buffer.from('f'), 6), -1); +assert.strictEqual(b.indexOf(Buffer.from('d'), 2), 3); +assert.strictEqual(b.indexOf(Buffer.from('f'), 5), 5); +assert.strictEqual(b.indexOf(Buffer.from('f'), -1), 5); +assert.strictEqual(b.indexOf(Buffer.from('f'), 6), -1); -assert.equal(Buffer.from('ff').indexOf(Buffer.from('f'), 1, 'ucs2'), -1); +assert.strictEqual(Buffer.from('ff').indexOf(Buffer.from('f'), 1, 'ucs2'), -1); // test invalid and uppercase encoding assert.strictEqual(b.indexOf('b', 'utf8'), 1); @@ -176,62 +176,67 @@ assert.strictEqual( // test optional offset with passed encoding -assert.equal(Buffer.from('aaaa0').indexOf('30', 'hex'), 4); -assert.equal(Buffer.from('aaaa00a').indexOf('3030', 'hex'), 4); +assert.strictEqual(Buffer.from('aaaa0').indexOf('30', 'hex'), 4); +assert.strictEqual(Buffer.from('aaaa00a').indexOf('3030', 'hex'), 4); { // test usc2 encoding const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); - assert.equal(8, twoByteString.indexOf('\u0395', 4, 'ucs2')); - assert.equal(6, twoByteString.indexOf('\u03a3', -4, 'ucs2')); - assert.equal(4, twoByteString.indexOf('\u03a3', -6, 'ucs2')); - assert.equal(4, twoByteString.indexOf( + assert.strictEqual(8, twoByteString.indexOf('\u0395', 4, 'ucs2')); + assert.strictEqual(6, twoByteString.indexOf('\u03a3', -4, 'ucs2')); + assert.strictEqual(4, twoByteString.indexOf('\u03a3', -6, 'ucs2')); + assert.strictEqual(4, twoByteString.indexOf( Buffer.from('\u03a3', 'ucs2'), -6, 'ucs2')); - assert.equal(-1, twoByteString.indexOf('\u03a3', -2, 'ucs2')); + assert.strictEqual(-1, twoByteString.indexOf('\u03a3', -2, 'ucs2')); } const mixedByteStringUcs2 = Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395', 'ucs2'); -assert.equal(6, mixedByteStringUcs2.indexOf('bc', 0, 'ucs2')); -assert.equal(10, mixedByteStringUcs2.indexOf('\u03a3', 0, 'ucs2')); -assert.equal(-1, mixedByteStringUcs2.indexOf('\u0396', 0, 'ucs2')); +assert.strictEqual(6, mixedByteStringUcs2.indexOf('bc', 0, 'ucs2')); +assert.strictEqual(10, mixedByteStringUcs2.indexOf('\u03a3', 0, 'ucs2')); +assert.strictEqual(-1, mixedByteStringUcs2.indexOf('\u0396', 0, 'ucs2')); -assert.equal( +assert.strictEqual( 6, mixedByteStringUcs2.indexOf(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); -assert.equal( +assert.strictEqual( 10, mixedByteStringUcs2.indexOf(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); -assert.equal( +assert.strictEqual( -1, mixedByteStringUcs2.indexOf(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); { const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); // Test single char pattern - assert.equal(0, twoByteString.indexOf('\u039a', 0, 'ucs2')); - assert.equal(2, twoByteString.indexOf('\u0391', 0, 'ucs2'), 'Alpha'); - assert.equal(4, twoByteString.indexOf('\u03a3', 0, 'ucs2'), 'First Sigma'); - assert.equal(6, twoByteString.indexOf('\u03a3', 6, 'ucs2'), 'Second Sigma'); - assert.equal(8, twoByteString.indexOf('\u0395', 0, 'ucs2'), 'Epsilon'); - assert.equal(-1, twoByteString.indexOf('\u0392', 0, 'ucs2'), 'Not beta'); + assert.strictEqual(0, twoByteString.indexOf('\u039a', 0, 'ucs2')); + assert.strictEqual(2, twoByteString.indexOf('\u0391', 0, 'ucs2'), + 'Alpha'); + assert.strictEqual(4, twoByteString.indexOf('\u03a3', 0, 'ucs2'), + 'First Sigma'); + assert.strictEqual(6, twoByteString.indexOf('\u03a3', 6, 'ucs2'), + 'Second Sigma'); + assert.strictEqual(8, twoByteString.indexOf('\u0395', 0, 'ucs2'), + 'Epsilon'); + assert.strictEqual(-1, twoByteString.indexOf('\u0392', 0, 'ucs2'), + 'Not beta'); // Test multi-char pattern - assert.equal( + assert.strictEqual( 0, twoByteString.indexOf('\u039a\u0391', 0, 'ucs2'), 'Lambda Alpha'); - assert.equal( + assert.strictEqual( 2, twoByteString.indexOf('\u0391\u03a3', 0, 'ucs2'), 'Alpha Sigma'); - assert.equal( + assert.strictEqual( 4, twoByteString.indexOf('\u03a3\u03a3', 0, 'ucs2'), 'Sigma Sigma'); - assert.equal( + assert.strictEqual( 6, twoByteString.indexOf('\u03a3\u0395', 0, 'ucs2'), 'Sigma Epsilon'); } const mixedByteStringUtf8 = Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395'); -assert.equal(5, mixedByteStringUtf8.indexOf('bc')); -assert.equal(5, mixedByteStringUtf8.indexOf('bc', 5)); -assert.equal(5, mixedByteStringUtf8.indexOf('bc', -8)); -assert.equal(7, mixedByteStringUtf8.indexOf('\u03a3')); -assert.equal(-1, mixedByteStringUtf8.indexOf('\u0396')); +assert.strictEqual(5, mixedByteStringUtf8.indexOf('bc')); +assert.strictEqual(5, mixedByteStringUtf8.indexOf('bc', 5)); +assert.strictEqual(5, mixedByteStringUtf8.indexOf('bc', -8)); +assert.strictEqual(7, mixedByteStringUtf8.indexOf('\u03a3')); +assert.strictEqual(-1, mixedByteStringUtf8.indexOf('\u0396')); // Test complex string indexOf algorithms. Only trigger for long strings. @@ -247,23 +252,25 @@ const longBufferString = Buffer.from(longString); let pattern = 'ABACABADABACABA'; for (let i = 0; i < longBufferString.length - pattern.length; i += 7) { const index = longBufferString.indexOf(pattern, i); - assert.equal((i + 15) & ~0xf, index, 'Long ABACABA...-string at index ' + i); + assert.strictEqual((i + 15) & ~0xf, index, + 'Long ABACABA...-string at index ' + i); } -assert.equal(510, longBufferString.indexOf('AJABACA'), 'Long AJABACA, First J'); -assert.equal( +assert.strictEqual(510, longBufferString.indexOf('AJABACA'), + 'Long AJABACA, First J'); +assert.strictEqual( 1534, longBufferString.indexOf('AJABACA', 511), 'Long AJABACA, Second J'); pattern = 'JABACABADABACABA'; -assert.equal( +assert.strictEqual( 511, longBufferString.indexOf(pattern), 'Long JABACABA..., First J'); -assert.equal( +assert.strictEqual( 1535, longBufferString.indexOf(pattern, 512), 'Long JABACABA..., Second J'); // Search for a non-ASCII string in a pure ASCII string. const asciiString = Buffer.from( 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); -assert.equal(-1, asciiString.indexOf('\x2061')); -assert.equal(3, asciiString.indexOf('leb', 0)); +assert.strictEqual(-1, asciiString.indexOf('\x2061')); +assert.strictEqual(3, asciiString.indexOf('leb', 0)); // Search in string containing many non-ASCII chars. const allCodePoints = []; @@ -274,8 +281,8 @@ const allCharsBufferUcs2 = Buffer.from(allCharsString, 'ucs2'); // Search for string long enough to trigger complex search with ASCII pattern // and UC16 subject. -assert.equal(-1, allCharsBufferUtf8.indexOf('notfound')); -assert.equal(-1, allCharsBufferUcs2.indexOf('notfound')); +assert.strictEqual(-1, allCharsBufferUtf8.indexOf('notfound')); +assert.strictEqual(-1, allCharsBufferUcs2.indexOf('notfound')); // Needle is longer than haystack, but only because it's encoded as UTF-16 assert.strictEqual(Buffer.from('aaaa').indexOf('a'.repeat(4), 'ucs2'), -1); @@ -308,10 +315,10 @@ assert.strictEqual(Buffer.from('aaaaa').indexOf('b', 'ucs2'), -1); } const patternBufferUtf8 = allCharsBufferUtf8.slice(index, index + length); - assert.equal(index, allCharsBufferUtf8.indexOf(patternBufferUtf8)); + assert.strictEqual(index, allCharsBufferUtf8.indexOf(patternBufferUtf8)); const patternStringUtf8 = patternBufferUtf8.toString(); - assert.equal(index, allCharsBufferUtf8.indexOf(patternStringUtf8)); + assert.strictEqual(index, allCharsBufferUtf8.indexOf(patternStringUtf8)); } } } @@ -327,11 +334,11 @@ assert.strictEqual(Buffer.from('aaaaa').indexOf('b', 'ucs2'), -1); const patternBufferUcs2 = allCharsBufferUcs2.slice(index, index + length); - assert.equal( + assert.strictEqual( index, allCharsBufferUcs2.indexOf(patternBufferUcs2, 0, 'ucs2')); const patternStringUcs2 = patternBufferUcs2.toString('ucs2'); - assert.equal( + assert.strictEqual( index, allCharsBufferUcs2.indexOf(patternStringUcs2, 0, 'ucs2')); } } @@ -357,62 +364,62 @@ assert.throws(() => { // Test lastIndexOf basic functionality; Buffer b contains 'abcdef'. // lastIndexOf string: -assert.equal(b.lastIndexOf('a'), 0); -assert.equal(b.lastIndexOf('a', 1), 0); -assert.equal(b.lastIndexOf('b', 1), 1); -assert.equal(b.lastIndexOf('c', 1), -1); -assert.equal(b.lastIndexOf('a', -1), 0); -assert.equal(b.lastIndexOf('a', -4), 0); -assert.equal(b.lastIndexOf('a', -b.length), 0); -assert.equal(b.lastIndexOf('a', -b.length - 1), -1); -assert.equal(b.lastIndexOf('a', NaN), 0); -assert.equal(b.lastIndexOf('a', -Infinity), -1); -assert.equal(b.lastIndexOf('a', Infinity), 0); +assert.strictEqual(b.lastIndexOf('a'), 0); +assert.strictEqual(b.lastIndexOf('a', 1), 0); +assert.strictEqual(b.lastIndexOf('b', 1), 1); +assert.strictEqual(b.lastIndexOf('c', 1), -1); +assert.strictEqual(b.lastIndexOf('a', -1), 0); +assert.strictEqual(b.lastIndexOf('a', -4), 0); +assert.strictEqual(b.lastIndexOf('a', -b.length), 0); +assert.strictEqual(b.lastIndexOf('a', -b.length - 1), -1); +assert.strictEqual(b.lastIndexOf('a', NaN), 0); +assert.strictEqual(b.lastIndexOf('a', -Infinity), -1); +assert.strictEqual(b.lastIndexOf('a', Infinity), 0); // lastIndexOf Buffer: -assert.equal(b.lastIndexOf(buf_a), 0); -assert.equal(b.lastIndexOf(buf_a, 1), 0); -assert.equal(b.lastIndexOf(buf_a, -1), 0); -assert.equal(b.lastIndexOf(buf_a, -4), 0); -assert.equal(b.lastIndexOf(buf_a, -b.length), 0); -assert.equal(b.lastIndexOf(buf_a, -b.length - 1), -1); -assert.equal(b.lastIndexOf(buf_a, NaN), 0); -assert.equal(b.lastIndexOf(buf_a, -Infinity), -1); -assert.equal(b.lastIndexOf(buf_a, Infinity), 0); -assert.equal(b.lastIndexOf(buf_bc), 1); -assert.equal(b.lastIndexOf(buf_bc, 2), 1); -assert.equal(b.lastIndexOf(buf_bc, -1), 1); -assert.equal(b.lastIndexOf(buf_bc, -3), 1); -assert.equal(b.lastIndexOf(buf_bc, -5), 1); -assert.equal(b.lastIndexOf(buf_bc, -6), -1); -assert.equal(b.lastIndexOf(buf_bc, NaN), 1); -assert.equal(b.lastIndexOf(buf_bc, -Infinity), -1); -assert.equal(b.lastIndexOf(buf_bc, Infinity), 1); -assert.equal(b.lastIndexOf(buf_f), b.length - 1); -assert.equal(b.lastIndexOf(buf_z), -1); -assert.equal(b.lastIndexOf(buf_empty), -1); -assert.equal(b.lastIndexOf(buf_empty, 1), -1); -assert.equal(b.lastIndexOf(buf_empty, b.length + 1), -1); -assert.equal(b.lastIndexOf(buf_empty, Infinity), -1); +assert.strictEqual(b.lastIndexOf(buf_a), 0); +assert.strictEqual(b.lastIndexOf(buf_a, 1), 0); +assert.strictEqual(b.lastIndexOf(buf_a, -1), 0); +assert.strictEqual(b.lastIndexOf(buf_a, -4), 0); +assert.strictEqual(b.lastIndexOf(buf_a, -b.length), 0); +assert.strictEqual(b.lastIndexOf(buf_a, -b.length - 1), -1); +assert.strictEqual(b.lastIndexOf(buf_a, NaN), 0); +assert.strictEqual(b.lastIndexOf(buf_a, -Infinity), -1); +assert.strictEqual(b.lastIndexOf(buf_a, Infinity), 0); +assert.strictEqual(b.lastIndexOf(buf_bc), 1); +assert.strictEqual(b.lastIndexOf(buf_bc, 2), 1); +assert.strictEqual(b.lastIndexOf(buf_bc, -1), 1); +assert.strictEqual(b.lastIndexOf(buf_bc, -3), 1); +assert.strictEqual(b.lastIndexOf(buf_bc, -5), 1); +assert.strictEqual(b.lastIndexOf(buf_bc, -6), -1); +assert.strictEqual(b.lastIndexOf(buf_bc, NaN), 1); +assert.strictEqual(b.lastIndexOf(buf_bc, -Infinity), -1); +assert.strictEqual(b.lastIndexOf(buf_bc, Infinity), 1); +assert.strictEqual(b.lastIndexOf(buf_f), b.length - 1); +assert.strictEqual(b.lastIndexOf(buf_z), -1); +assert.strictEqual(b.lastIndexOf(buf_empty), -1); +assert.strictEqual(b.lastIndexOf(buf_empty, 1), -1); +assert.strictEqual(b.lastIndexOf(buf_empty, b.length + 1), -1); +assert.strictEqual(b.lastIndexOf(buf_empty, Infinity), -1); // lastIndexOf number: -assert.equal(b.lastIndexOf(0x61), 0); -assert.equal(b.lastIndexOf(0x61, 1), 0); -assert.equal(b.lastIndexOf(0x61, -1), 0); -assert.equal(b.lastIndexOf(0x61, -4), 0); -assert.equal(b.lastIndexOf(0x61, -b.length), 0); -assert.equal(b.lastIndexOf(0x61, -b.length - 1), -1); -assert.equal(b.lastIndexOf(0x61, NaN), 0); -assert.equal(b.lastIndexOf(0x61, -Infinity), -1); -assert.equal(b.lastIndexOf(0x61, Infinity), 0); -assert.equal(b.lastIndexOf(0x0), -1); +assert.strictEqual(b.lastIndexOf(0x61), 0); +assert.strictEqual(b.lastIndexOf(0x61, 1), 0); +assert.strictEqual(b.lastIndexOf(0x61, -1), 0); +assert.strictEqual(b.lastIndexOf(0x61, -4), 0); +assert.strictEqual(b.lastIndexOf(0x61, -b.length), 0); +assert.strictEqual(b.lastIndexOf(0x61, -b.length - 1), -1); +assert.strictEqual(b.lastIndexOf(0x61, NaN), 0); +assert.strictEqual(b.lastIndexOf(0x61, -Infinity), -1); +assert.strictEqual(b.lastIndexOf(0x61, Infinity), 0); +assert.strictEqual(b.lastIndexOf(0x0), -1); // Test weird offset arguments. // Behaviour should match String.lastIndexOf: -assert.equal(b.lastIndexOf('b', 0), -1); -assert.equal(b.lastIndexOf('b', undefined), 1); -assert.equal(b.lastIndexOf('b', null), -1); -assert.equal(b.lastIndexOf('b', {}), 1); -assert.equal(b.lastIndexOf('b', []), -1); -assert.equal(b.lastIndexOf('b', [2]), 1); +assert.strictEqual(b.lastIndexOf('b', 0), -1); +assert.strictEqual(b.lastIndexOf('b', undefined), 1); +assert.strictEqual(b.lastIndexOf('b', null), -1); +assert.strictEqual(b.lastIndexOf('b', {}), 1); +assert.strictEqual(b.lastIndexOf('b', []), -1); +assert.strictEqual(b.lastIndexOf('b', [2]), 1); // Test needles longer than the haystack. assert.strictEqual(b.lastIndexOf('aaaaaaaaaaaaaaa', 'ucs2'), -1); @@ -440,20 +447,21 @@ assert.strictEqual(buf_bc.lastIndexOf(Buffer.from('你好'), 7), -1); // Test lastIndexOf on a longer buffer: const bufferString = new Buffer('a man a plan a canal panama'); -assert.equal(15, bufferString.lastIndexOf('canal')); -assert.equal(21, bufferString.lastIndexOf('panama')); -assert.equal(0, bufferString.lastIndexOf('a man a plan a canal panama')); -assert.equal(-1, bufferString.lastIndexOf('a man a plan a canal mexico')); -assert.equal(-1, bufferString.lastIndexOf('a man a plan a canal mexico city')); -assert.equal(-1, bufferString.lastIndexOf(Buffer.from('a'.repeat(1000)))); -assert.equal(0, bufferString.lastIndexOf('a man a plan', 4)); -assert.equal(13, bufferString.lastIndexOf('a ')); -assert.equal(13, bufferString.lastIndexOf('a ', 13)); -assert.equal(6, bufferString.lastIndexOf('a ', 12)); -assert.equal(0, bufferString.lastIndexOf('a ', 5)); -assert.equal(13, bufferString.lastIndexOf('a ', -1)); -assert.equal(0, bufferString.lastIndexOf('a ', -27)); -assert.equal(-1, bufferString.lastIndexOf('a ', -28)); +assert.strictEqual(15, bufferString.lastIndexOf('canal')); +assert.strictEqual(21, bufferString.lastIndexOf('panama')); +assert.strictEqual(0, bufferString.lastIndexOf('a man a plan a canal panama')); +assert.strictEqual(-1, bufferString.lastIndexOf('a man a plan a canal mexico')); +assert.strictEqual(-1, bufferString + .lastIndexOf('a man a plan a canal mexico city')); +assert.strictEqual(-1, bufferString.lastIndexOf(Buffer.from('a'.repeat(1000)))); +assert.strictEqual(0, bufferString.lastIndexOf('a man a plan', 4)); +assert.strictEqual(13, bufferString.lastIndexOf('a ')); +assert.strictEqual(13, bufferString.lastIndexOf('a ', 13)); +assert.strictEqual(6, bufferString.lastIndexOf('a ', 12)); +assert.strictEqual(0, bufferString.lastIndexOf('a ', 5)); +assert.strictEqual(13, bufferString.lastIndexOf('a ', -1)); +assert.strictEqual(0, bufferString.lastIndexOf('a ', -27)); +assert.strictEqual(-1, bufferString.lastIndexOf('a ', -28)); // Test lastIndexOf for the case that the first character can be found, // but in a part of the buffer that does not make search to search @@ -477,9 +485,9 @@ assert.strictEqual(0, Buffer.from('abc').lastIndexOf('ab', 3)); // Now, we test the BOYER-MOORE-HORSPOOL strategy. // Test lastIndexOf on a long buffer w multiple matches: pattern = 'JABACABADABACABA'; -assert.equal(1535, longBufferString.lastIndexOf(pattern)); -assert.equal(1535, longBufferString.lastIndexOf(pattern, 1535)); -assert.equal(511, longBufferString.lastIndexOf(pattern, 1534)); +assert.strictEqual(1535, longBufferString.lastIndexOf(pattern)); +assert.strictEqual(1535, longBufferString.lastIndexOf(pattern, 1535)); +assert.strictEqual(511, longBufferString.lastIndexOf(pattern, 1534)); // Finally, give it a really long input to trigger fallback from BMH to // regular BOYER-MOORE (which has better worst-case complexity). @@ -501,19 +509,19 @@ for (let i = 0; i < 1000000; i++) { parts.push((countBits(i) % 2 === 0) ? 'yolo' : 'swag'); } const reallyLong = new Buffer(parts.join(' ')); -assert.equal('yolo swag swag yolo', reallyLong.slice(0, 19).toString()); +assert.strictEqual('yolo swag swag yolo', reallyLong.slice(0, 19).toString()); // Expensive reverse searches. Stress test lastIndexOf: pattern = reallyLong.slice(0, 100000); // First 1/50th of the pattern. -assert.equal(4751360, reallyLong.lastIndexOf(pattern)); -assert.equal(3932160, reallyLong.lastIndexOf(pattern, 4000000)); -assert.equal(2949120, reallyLong.lastIndexOf(pattern, 3000000)); +assert.strictEqual(4751360, reallyLong.lastIndexOf(pattern)); +assert.strictEqual(3932160, reallyLong.lastIndexOf(pattern, 4000000)); +assert.strictEqual(2949120, reallyLong.lastIndexOf(pattern, 3000000)); pattern = reallyLong.slice(100000, 200000); // Second 1/50th. -assert.equal(4728480, reallyLong.lastIndexOf(pattern)); +assert.strictEqual(4728480, reallyLong.lastIndexOf(pattern)); pattern = reallyLong.slice(0, 1000000); // First 1/5th. -assert.equal(3932160, reallyLong.lastIndexOf(pattern)); +assert.strictEqual(3932160, reallyLong.lastIndexOf(pattern)); pattern = reallyLong.slice(0, 2000000); // first 2/5ths. -assert.equal(0, reallyLong.lastIndexOf(pattern)); +assert.strictEqual(0, reallyLong.lastIndexOf(pattern)); // test truncation of Number arguments to uint8 { diff --git a/test/parallel/test-child-process-fork-net.js b/test/parallel/test-child-process-fork-net.js index c66b808ec0addf..157704a9ccf9c9 100644 --- a/test/parallel/test-child-process-fork-net.js +++ b/test/parallel/test-child-process-fork-net.js @@ -153,7 +153,7 @@ if (process.argv[2] === 'child') { }); connect.on('close', function() { console.log('CLIENT: closed'); - assert.equal(store, 'echo'); + assert.strictEqual(store, 'echo'); server.close(); }); }); diff --git a/test/parallel/test-child-process-fork-net2.js b/test/parallel/test-child-process-fork-net2.js index 6d20f419049c7b..ef8575385a42fd 100644 --- a/test/parallel/test-child-process-fork-net2.js +++ b/test/parallel/test-child-process-fork-net2.js @@ -135,7 +135,7 @@ if (process.argv[2] === 'child') { }; process.on('exit', function() { - assert.equal(disconnected, count); - assert.equal(connected, count); + assert.strictEqual(disconnected, count); + assert.strictEqual(connected, count); }); } diff --git a/test/parallel/test-child-process-fork-ref.js b/test/parallel/test-child-process-fork-ref.js index 1f8816c0cfaf1c..a7ff8c04cbab25 100644 --- a/test/parallel/test-child-process-fork-ref.js +++ b/test/parallel/test-child-process-fork-ref.js @@ -33,6 +33,6 @@ if (process.argv[2] === 'child') { child.once('exit', function() { assert.deepStrictEqual(ipc, ['1', '2']); - assert.equal(stdout, '3'); + assert.strictEqual(stdout, '3'); }); } diff --git a/test/parallel/test-child-process-ipc.js b/test/parallel/test-child-process-ipc.js index cbaa270f5e8440..da952e6c9bf1ae 100644 --- a/test/parallel/test-child-process-ipc.js +++ b/test/parallel/test-child-process-ipc.js @@ -30,7 +30,7 @@ child.stdout.on('data', function(data) { child.stdin.write('echo me\r\n'); } else { console.error('testing for echo me'); - assert.equal('echo me\r\n', data); + assert.strictEqual('echo me\r\n', data); gotEcho = true; child.stdin.end(); } diff --git a/test/parallel/test-child-process-set-blocking.js b/test/parallel/test-child-process-set-blocking.js index 54037aea69feb2..d6a044619b6479 100644 --- a/test/parallel/test-child-process-set-blocking.js +++ b/test/parallel/test-child-process-set-blocking.js @@ -10,5 +10,5 @@ const cp = ch.spawn('python', ['-c', 'print ' + SIZE + ' * "C"'], { }); cp.on('exit', common.mustCall(function(code) { - assert.equal(0, code); + assert.strictEqual(0, code); })); diff --git a/test/parallel/test-child-process-spawnsync-env.js b/test/parallel/test-child-process-spawnsync-env.js index 6f5ea3dc83d107..b5a1c723660faa 100644 --- a/test/parallel/test-child-process-spawnsync-env.js +++ b/test/parallel/test-child-process-spawnsync-env.js @@ -11,5 +11,5 @@ if (process.argv[2] === 'child') { env: Object.assign(process.env, { foo: expected }) }); - assert.equal(child.stdout.toString().trim(), expected); + assert.strictEqual(child.stdout.toString().trim(), expected); } diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 2a06fc6e7b86d6..b76e188bc6f0d6 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -19,9 +19,9 @@ let key2 = dh2.generateKeys('hex'); let secret1 = dh1.computeSecret(key2, 'hex', 'base64'); let secret2 = dh2.computeSecret(key1, 'latin1', 'buffer'); -assert.equal(secret1, secret2.toString('base64')); -assert.equal(dh1.verifyError, 0); -assert.equal(dh2.verifyError, 0); +assert.strictEqual(secret1, secret2.toString('base64')); +assert.strictEqual(dh1.verifyError, 0); +assert.strictEqual(dh2.verifyError, 0); assert.throws(function() { crypto.createDiffieHellman([0x1, 0x2]); @@ -50,11 +50,11 @@ assert.deepStrictEqual(dh1.getPrime(), dh3.getPrime()); assert.deepStrictEqual(dh1.getGenerator(), dh3.getGenerator()); assert.deepStrictEqual(dh1.getPublicKey(), dh3.getPublicKey()); assert.deepStrictEqual(dh1.getPrivateKey(), dh3.getPrivateKey()); -assert.equal(dh3.verifyError, 0); +assert.strictEqual(dh3.verifyError, 0); const secret3 = dh3.computeSecret(key2, 'hex', 'base64'); -assert.equal(secret1, secret3); +assert.strictEqual(secret1, secret3); // Run this one twice to make sure that the dh3 clears its error properly { @@ -78,9 +78,9 @@ alice.generateKeys(); bob.generateKeys(); const aSecret = alice.computeSecret(bob.getPublicKey()).toString('hex'); const bSecret = bob.computeSecret(alice.getPublicKey()).toString('hex'); -assert.equal(aSecret, bSecret); -assert.equal(alice.verifyError, DH_NOT_SUITABLE_GENERATOR); -assert.equal(bob.verifyError, DH_NOT_SUITABLE_GENERATOR); +assert.strictEqual(aSecret, bSecret); +assert.strictEqual(alice.verifyError, DH_NOT_SUITABLE_GENERATOR); +assert.strictEqual(bob.verifyError, DH_NOT_SUITABLE_GENERATOR); /* Ensure specific generator (buffer) works as expected. * The values below (modp2/modp2buf) are for a 1024 bits long prime from @@ -107,9 +107,9 @@ exmodp2.generateKeys(); let modp2Secret = modp2.computeSecret(exmodp2.getPublicKey()).toString('hex'); const exmodp2Secret = exmodp2.computeSecret(modp2.getPublicKey()) .toString('hex'); -assert.equal(modp2Secret, exmodp2Secret); -assert.equal(modp2.verifyError, DH_NOT_SUITABLE_GENERATOR); -assert.equal(exmodp2.verifyError, DH_NOT_SUITABLE_GENERATOR); +assert.strictEqual(modp2Secret, exmodp2Secret); +assert.strictEqual(modp2.verifyError, DH_NOT_SUITABLE_GENERATOR); +assert.strictEqual(exmodp2.verifyError, DH_NOT_SUITABLE_GENERATOR); // Ensure specific generator (string with encoding) works as expected. @@ -118,8 +118,8 @@ exmodp2_2.generateKeys(); modp2Secret = modp2.computeSecret(exmodp2_2.getPublicKey()).toString('hex'); const exmodp2_2Secret = exmodp2_2.computeSecret(modp2.getPublicKey()) .toString('hex'); -assert.equal(modp2Secret, exmodp2_2Secret); -assert.equal(exmodp2_2.verifyError, DH_NOT_SUITABLE_GENERATOR); +assert.strictEqual(modp2Secret, exmodp2_2Secret); +assert.strictEqual(exmodp2_2.verifyError, DH_NOT_SUITABLE_GENERATOR); // Ensure specific generator (string without encoding) works as expected. @@ -128,8 +128,8 @@ exmodp2_3.generateKeys(); modp2Secret = modp2.computeSecret(exmodp2_3.getPublicKey()).toString('hex'); const exmodp2_3Secret = exmodp2_3.computeSecret(modp2.getPublicKey()) .toString('hex'); -assert.equal(modp2Secret, exmodp2_3Secret); -assert.equal(exmodp2_3.verifyError, DH_NOT_SUITABLE_GENERATOR); +assert.strictEqual(modp2Secret, exmodp2_3Secret); +assert.strictEqual(exmodp2_3.verifyError, DH_NOT_SUITABLE_GENERATOR); // Ensure specific generator (numeric) works as expected. @@ -138,8 +138,8 @@ exmodp2_4.generateKeys(); modp2Secret = modp2.computeSecret(exmodp2_4.getPublicKey()).toString('hex'); const exmodp2_4Secret = exmodp2_4.computeSecret(modp2.getPublicKey()) .toString('hex'); -assert.equal(modp2Secret, exmodp2_4Secret); -assert.equal(exmodp2_4.verifyError, DH_NOT_SUITABLE_GENERATOR); +assert.strictEqual(modp2Secret, exmodp2_4Secret); +assert.strictEqual(exmodp2_4.verifyError, DH_NOT_SUITABLE_GENERATOR); const p = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' + @@ -147,7 +147,7 @@ const p = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' + '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF'; const bad_dh = crypto.createDiffieHellman(p, 'hex'); -assert.equal(bad_dh.verifyError, DH_NOT_SUITABLE_GENERATOR); +assert.strictEqual(bad_dh.verifyError, DH_NOT_SUITABLE_GENERATOR); // Test ECDH @@ -158,7 +158,7 @@ key2 = ecdh2.generateKeys('hex'); secret1 = ecdh1.computeSecret(key2, 'hex', 'base64'); secret2 = ecdh2.computeSecret(key1, 'latin1', 'buffer'); -assert.equal(secret1, secret2.toString('base64')); +assert.strictEqual(secret1, secret2.toString('base64')); // Oakley curves do not clean up ERR stack, it was causing unexpected failure // when accessing other OpenSSL APIs afterwards. @@ -166,7 +166,7 @@ crypto.createECDH('Oakley-EC2N-3'); crypto.createHash('sha256'); // Point formats -assert.equal(ecdh1.getPublicKey('buffer', 'uncompressed')[0], 4); +assert.strictEqual(ecdh1.getPublicKey('buffer', 'uncompressed')[0], 4); let firstByte = ecdh1.getPublicKey('buffer', 'compressed')[0]; assert(firstByte === 2 || firstByte === 3); firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0]; @@ -210,9 +210,9 @@ const cafebabePubPtUnComp = '04672a31bfc59d3f04548ec9b7daeeba2f61814e8ccc40448045007f5479f693a3' + '2e02c7f93d13dc2732b760ca377a5897b9dd41a1c1b29dc0442fdce6d0a04d1d'; ecdh5.setPrivateKey(cafebabeKey, 'hex'); -assert.equal(ecdh5.getPrivateKey('hex'), cafebabeKey); +assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey); // Show that the public point (key) is generated while setting the private key. -assert.equal(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp); +assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp); // Compressed and uncompressed public points/keys for other party's private key // 0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF @@ -225,24 +225,26 @@ const peerPubPtUnComp = const sharedSecret = '1da220b5329bbe8bfd19ceef5a5898593f411a6f12ea40f2a8eead9a5cf59970'; -assert.equal(ecdh5.computeSecret(peerPubPtComp, 'hex', 'hex'), sharedSecret); -assert.equal(ecdh5.computeSecret(peerPubPtUnComp, 'hex', 'hex'), sharedSecret); +assert.strictEqual(ecdh5.computeSecret(peerPubPtComp, 'hex', 'hex'), + sharedSecret); +assert.strictEqual(ecdh5.computeSecret(peerPubPtUnComp, 'hex', 'hex'), + sharedSecret); // Verify that we still have the same key pair as before the computation. -assert.equal(ecdh5.getPrivateKey('hex'), cafebabeKey); -assert.equal(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp); +assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey); +assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp); // Verify setting and getting compressed and non-compressed serializations. ecdh5.setPublicKey(cafebabePubPtComp, 'hex'); -assert.equal(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp); -assert.equal(ecdh5.getPublicKey('hex', 'compressed'), cafebabePubPtComp); +assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp); +assert.strictEqual(ecdh5.getPublicKey('hex', 'compressed'), cafebabePubPtComp); ecdh5.setPublicKey(cafebabePubPtUnComp, 'hex'); -assert.equal(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp); -assert.equal(ecdh5.getPublicKey('hex', 'compressed'), cafebabePubPtComp); +assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp); +assert.strictEqual(ecdh5.getPublicKey('hex', 'compressed'), cafebabePubPtComp); // Show why allowing the public key to be set on this type does not make sense. ecdh5.setPublicKey(peerPubPtComp, 'hex'); -assert.equal(ecdh5.getPublicKey('hex'), peerPubPtUnComp); +assert.strictEqual(ecdh5.getPublicKey('hex'), peerPubPtUnComp); assert.throws(function() { // Error because the public key does not match the private key anymore. ecdh5.computeSecret(peerPubPtComp, 'hex', 'hex'); @@ -261,5 +263,5 @@ ecdh5.setPrivateKey(cafebabeKey, 'hex'); ecdh5.setPrivateKey(element, 'hex'); }, /Private key is not valid for specified curve/); // Verify object state did not change. - assert.equal(ecdh5.getPrivateKey('hex'), cafebabeKey); + assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey); }); diff --git a/test/parallel/test-crypto-domains.js b/test/parallel/test-crypto-domains.js index 2749382fa5c780..d0dcf7f2107f77 100644 --- a/test/parallel/test-crypto-domains.js +++ b/test/parallel/test-crypto-domains.js @@ -12,7 +12,7 @@ if (!common.hasCrypto) { const crypto = require('crypto'); d.on('error', common.mustCall(function(e) { - assert.equal(e.message, expect.shift()); + assert.strictEqual(e.message, expect.shift()); }, 3)); d.run(function() { diff --git a/test/parallel/test-dh-padding.js b/test/parallel/test-dh-padding.js index 1d9d47ec0e10a3..4744d204739a5d 100644 --- a/test/parallel/test-dh-padding.js +++ b/test/parallel/test-dh-padding.js @@ -85,7 +85,7 @@ const p = crypto.createDiffieHellman( p.setPublicKey(apub, 'hex'); p.setPrivateKey(apriv, 'hex'); -assert.equal( +assert.strictEqual( p.computeSecret(bpub, 'hex', 'hex').toString('hex'), secret ); diff --git a/test/parallel/test-domain-nested.js b/test/parallel/test-domain-nested.js index d0618b5bad724b..6d673adc7e6387 100644 --- a/test/parallel/test-domain-nested.js +++ b/test/parallel/test-domain-nested.js @@ -6,7 +6,7 @@ const assert = require('assert'); const domain = require('domain'); process.on('exit', function(c) { - assert.equal(domain._stack.length, 0); + assert.strictEqual(domain._stack.length, 0); }); domain.create().run(function() { diff --git a/test/parallel/test-event-emitter-prepend.js b/test/parallel/test-event-emitter-prepend.js index 5a3b66b0cb3250..b511af9ae3691d 100644 --- a/test/parallel/test-event-emitter-prepend.js +++ b/test/parallel/test-event-emitter-prepend.js @@ -7,13 +7,14 @@ const assert = require('assert'); const myEE = new EventEmitter(); let m = 0; // This one comes last. -myEE.on('foo', common.mustCall(() => assert.equal(m, 2))); +myEE.on('foo', common.mustCall(() => assert.strictEqual(m, 2))); // This one comes second. -myEE.prependListener('foo', common.mustCall(() => assert.equal(m++, 1))); +myEE.prependListener('foo', common.mustCall(() => assert.strictEqual(m++, 1))); // This one comes first. -myEE.prependOnceListener('foo', common.mustCall(() => assert.equal(m++, 0))); +myEE.prependOnceListener('foo', + common.mustCall(() => assert.strictEqual(m++, 0))); myEE.emit('foo'); diff --git a/test/parallel/test-event-emitter-subclass.js b/test/parallel/test-event-emitter-subclass.js index d35802b413136b..eb2018e78e4b85 100644 --- a/test/parallel/test-event-emitter-subclass.js +++ b/test/parallel/test-event-emitter-subclass.js @@ -43,4 +43,4 @@ const ee2 = new MyEE2(); ee1.on('x', function() {}); -assert.equal(ee2.listenerCount('x'), 0); +assert.strictEqual(ee2.listenerCount('x'), 0); diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js index 1a05ef80a44a5c..f2ea85531bf463 100644 --- a/test/parallel/test-fs-error-messages.js +++ b/test/parallel/test-fs-error-messages.js @@ -12,7 +12,7 @@ const existingDir2 = path.join(common.fixturesDir, 'keys'); // ASYNC_CALL fs.stat(fn, function(err) { - assert.equal(fn, err.path); + assert.strictEqual(fn, err.path); assert.ok(0 <= err.message.indexOf(fn)); }); @@ -204,7 +204,7 @@ try { } process.on('exit', function() { - assert.equal(expected, errors.length, - 'Test fs sync exceptions raised, got ' + errors.length + + assert.strictEqual(expected, errors.length, + 'Test fs sync exceptions raised, got ' + errors.length + ' expected ' + expected); }); diff --git a/test/parallel/test-fs-mkdir-rmdir.js b/test/parallel/test-fs-mkdir-rmdir.js index 0bddf673ecb107..bac18fc027931d 100644 --- a/test/parallel/test-fs-mkdir-rmdir.js +++ b/test/parallel/test-fs-mkdir-rmdir.js @@ -29,8 +29,8 @@ fs.mkdir(d, 0o666, function(err) { fs.mkdir(d, 0o666, function(err) { assert.ok(err.message.match(/^EEXIST/), 'got EEXIST message'); - assert.equal(err.code, 'EEXIST', 'got EEXIST code'); - assert.equal(err.path, d, 'got proper path for EEXIST'); + assert.strictEqual(err.code, 'EEXIST', 'got EEXIST code'); + assert.strictEqual(err.path, d, 'got proper path for EEXIST'); fs.rmdir(d, assert.ifError); }); diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index 620231102273e3..73fc899ce57597 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -33,8 +33,8 @@ common.refreshTmpDir(); unlink(pathname); fs.mkdir(pathname, 0o777, common.mustCall(function(err) { - assert.equal(err, null); - assert.equal(common.fileExists(pathname), true); + assert.strictEqual(err, null); + assert.strictEqual(common.fileExists(pathname), true); })); process.on('exit', function() { diff --git a/test/parallel/test-fs-mkdtemp.js b/test/parallel/test-fs-mkdtemp.js index c387090989c882..d4773aa37b7bf5 100644 --- a/test/parallel/test-fs-mkdtemp.js +++ b/test/parallel/test-fs-mkdtemp.js @@ -14,8 +14,8 @@ assert.strictEqual(path.basename(tmpFolder).length, 'foo.XXXXXX'.length); assert(common.fileExists(tmpFolder)); const utf8 = fs.mkdtempSync(path.join(common.tmpDir, '\u0222abc.')); -assert.equal(Buffer.byteLength(path.basename(utf8)), - Buffer.byteLength('\u0222abc.XXXXXX')); +assert.strictEqual(Buffer.byteLength(path.basename(utf8)), + Buffer.byteLength('\u0222abc.XXXXXX')); assert(common.fileExists(utf8)); function handler(err, folder) { diff --git a/test/parallel/test-fs-open-flags.js b/test/parallel/test-fs-open-flags.js index c8d6dd5eee4783..878726580b6f6a 100644 --- a/test/parallel/test-fs-open-flags.js +++ b/test/parallel/test-fs-open-flags.js @@ -15,21 +15,21 @@ const O_WRONLY = fs.constants.O_WRONLY || 0; const { stringToFlags } = require('internal/fs'); -assert.equal(stringToFlags('r'), O_RDONLY); -assert.equal(stringToFlags('r+'), O_RDWR); -assert.equal(stringToFlags('w'), O_TRUNC | O_CREAT | O_WRONLY); -assert.equal(stringToFlags('w+'), O_TRUNC | O_CREAT | O_RDWR); -assert.equal(stringToFlags('a'), O_APPEND | O_CREAT | O_WRONLY); -assert.equal(stringToFlags('a+'), O_APPEND | O_CREAT | O_RDWR); - -assert.equal(stringToFlags('wx'), O_TRUNC | O_CREAT | O_WRONLY | O_EXCL); -assert.equal(stringToFlags('xw'), O_TRUNC | O_CREAT | O_WRONLY | O_EXCL); -assert.equal(stringToFlags('wx+'), O_TRUNC | O_CREAT | O_RDWR | O_EXCL); -assert.equal(stringToFlags('xw+'), O_TRUNC | O_CREAT | O_RDWR | O_EXCL); -assert.equal(stringToFlags('ax'), O_APPEND | O_CREAT | O_WRONLY | O_EXCL); -assert.equal(stringToFlags('xa'), O_APPEND | O_CREAT | O_WRONLY | O_EXCL); -assert.equal(stringToFlags('ax+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL); -assert.equal(stringToFlags('xa+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL); +assert.strictEqual(stringToFlags('r'), O_RDONLY); +assert.strictEqual(stringToFlags('r+'), O_RDWR); +assert.strictEqual(stringToFlags('w'), O_TRUNC | O_CREAT | O_WRONLY); +assert.strictEqual(stringToFlags('w+'), O_TRUNC | O_CREAT | O_RDWR); +assert.strictEqual(stringToFlags('a'), O_APPEND | O_CREAT | O_WRONLY); +assert.strictEqual(stringToFlags('a+'), O_APPEND | O_CREAT | O_RDWR); + +assert.strictEqual(stringToFlags('wx'), O_TRUNC | O_CREAT | O_WRONLY | O_EXCL); +assert.strictEqual(stringToFlags('xw'), O_TRUNC | O_CREAT | O_WRONLY | O_EXCL); +assert.strictEqual(stringToFlags('wx+'), O_TRUNC | O_CREAT | O_RDWR | O_EXCL); +assert.strictEqual(stringToFlags('xw+'), O_TRUNC | O_CREAT | O_RDWR | O_EXCL); +assert.strictEqual(stringToFlags('ax'), O_APPEND | O_CREAT | O_WRONLY | O_EXCL); +assert.strictEqual(stringToFlags('xa'), O_APPEND | O_CREAT | O_WRONLY | O_EXCL); +assert.strictEqual(stringToFlags('ax+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL); +assert.strictEqual(stringToFlags('xa+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL); ('+ +a +r +w rw wa war raw r++ a++ w++ x +x x+ rx rx+ wxx wax xwx xxx') .split(' ') diff --git a/test/parallel/test-fs-read-buffer-zero-length.js b/test/parallel/test-fs-read-buffer-zero-length.js index 35b1f7b566f685..4c7dd73f60ebb1 100644 --- a/test/parallel/test-fs-read-buffer-zero-length.js +++ b/test/parallel/test-fs-read-buffer-zero-length.js @@ -10,10 +10,10 @@ const bufferAsync = Buffer.alloc(0); const bufferSync = Buffer.alloc(0); fs.read(fd, bufferAsync, 0, 0, 0, common.mustCall(function(err, bytesRead) { - assert.equal(bytesRead, 0); + assert.strictEqual(bytesRead, 0); assert.deepStrictEqual(bufferAsync, Buffer.alloc(0)); })); const r = fs.readSync(fd, bufferSync, 0, 0, 0); assert.deepStrictEqual(bufferSync, Buffer.alloc(0)); -assert.equal(r, 0); +assert.strictEqual(r, 0); diff --git a/test/parallel/test-fs-read-stream.js b/test/parallel/test-fs-read-stream.js index d4fad6e6f79c07..d17703fabe6a27 100644 --- a/test/parallel/test-fs-read-stream.js +++ b/test/parallel/test-fs-read-stream.js @@ -61,7 +61,7 @@ file.on('close', function() { assert.strictEqual(file.bytesRead, fileSize); callbacks.close++; - //assert.equal(fs.readFileSync(fn), fileContent); + //assert.strictEqual(fs.readFileSync(fn), fileContent); }); const file3 = fs.createReadStream(fn, {encoding: 'utf8'}); diff --git a/test/parallel/test-fs-read-zero-length.js b/test/parallel/test-fs-read-zero-length.js index 9c4cde52362ccc..42e260360e79e2 100644 --- a/test/parallel/test-fs-read-zero-length.js +++ b/test/parallel/test-fs-read-zero-length.js @@ -9,10 +9,10 @@ const expected = ''; fs.read(fd, 0, 0, 'utf-8', common.mustCall(function(err, str, bytesRead) { assert.ok(!err); - assert.equal(str, expected); - assert.equal(bytesRead, 0); + assert.strictEqual(str, expected); + assert.strictEqual(bytesRead, 0); })); const r = fs.readSync(fd, 0, 0, 'utf-8'); -assert.equal(r[0], expected); -assert.equal(r[1], 0); +assert.strictEqual(r[0], expected); +assert.strictEqual(r[1], 0); diff --git a/test/parallel/test-fs-readdir-ucs2.js b/test/parallel/test-fs-readdir-ucs2.js index 53b16de4b9bea0..4d5f53abd8ead9 100644 --- a/test/parallel/test-fs-readdir-ucs2.js +++ b/test/parallel/test-fs-readdir-ucs2.js @@ -20,7 +20,7 @@ fs.closeSync(fs.openSync(fullpath, 'w+')); fs.readdir(common.tmpDir, 'ucs2', (err, list) => { assert.ifError(err); - assert.equal(1, list.length); + assert.strictEqual(1, list.length); const fn = list[0]; assert.deepStrictEqual(filebuff, Buffer.from(fn, 'ucs2')); assert.strictEqual(fn, filename); diff --git a/test/parallel/test-fs-readdir.js b/test/parallel/test-fs-readdir.js index f38ae49c90a18f..57612f3e26b183 100644 --- a/test/parallel/test-fs-readdir.js +++ b/test/parallel/test-fs-readdir.js @@ -31,5 +31,5 @@ assert.throws(function() { }, /Error: ENOTDIR: not a directory/); fs.readdir(__filename, common.mustCall(function(e) { - assert.equal(e.code, 'ENOTDIR'); + assert.strictEqual(e.code, 'ENOTDIR'); })); diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index a444bf49846b1e..aeb48e1edb9d75 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -508,6 +508,6 @@ function runTest() { process.on('exit', function() { - assert.equal(numtests, testsRun); - assert.equal(async_completed, async_expected); + assert.strictEqual(numtests, testsRun); + assert.strictEqual(async_completed, async_expected); }); diff --git a/test/parallel/test-fs-stat.js b/test/parallel/test-fs-stat.js index 32ba47c2fe0c1e..00fcc1df21c586 100644 --- a/test/parallel/test-fs-stat.js +++ b/test/parallel/test-fs-stat.js @@ -57,25 +57,25 @@ fs.stat(__filename, common.mustCall(function(err, s) { console.dir(s); console.log('isDirectory: ' + JSON.stringify(s.isDirectory())); - assert.equal(false, s.isDirectory()); + assert.strictEqual(false, s.isDirectory()); console.log('isFile: ' + JSON.stringify(s.isFile())); - assert.equal(true, s.isFile()); + assert.strictEqual(true, s.isFile()); console.log('isSocket: ' + JSON.stringify(s.isSocket())); - assert.equal(false, s.isSocket()); + assert.strictEqual(false, s.isSocket()); console.log('isBlockDevice: ' + JSON.stringify(s.isBlockDevice())); - assert.equal(false, s.isBlockDevice()); + assert.strictEqual(false, s.isBlockDevice()); console.log('isCharacterDevice: ' + JSON.stringify(s.isCharacterDevice())); - assert.equal(false, s.isCharacterDevice()); + assert.strictEqual(false, s.isCharacterDevice()); console.log('isFIFO: ' + JSON.stringify(s.isFIFO())); - assert.equal(false, s.isFIFO()); + assert.strictEqual(false, s.isFIFO()); console.log('isSymbolicLink: ' + JSON.stringify(s.isSymbolicLink())); - assert.equal(false, s.isSymbolicLink()); + assert.strictEqual(false, s.isSymbolicLink()); assert.ok(s.mtime instanceof Date); })); diff --git a/test/parallel/test-fs-sync-fd-leak.js b/test/parallel/test-fs-sync-fd-leak.js index 353519593e2c4e..75125d6c679784 100644 --- a/test/parallel/test-fs-sync-fd-leak.js +++ b/test/parallel/test-fs-sync-fd-leak.js @@ -8,7 +8,7 @@ fs.openSync = function() { return 42; }; fs.closeSync = function(fd) { - assert.equal(fd, 42); + assert.strictEqual(fd, 42); close_called++; }; fs.readSync = function() { @@ -40,10 +40,10 @@ function ensureThrows(cb) { try { cb(); } catch (e) { - assert.equal(e.message, 'BAM'); + assert.strictEqual(e.message, 'BAM'); got_exception = true; } - assert.equal(close_called, 1); - assert.equal(got_exception, true); + assert.strictEqual(close_called, 1); + assert.strictEqual(got_exception, true); } diff --git a/test/parallel/test-fs-watch-enoent.js b/test/parallel/test-fs-watch-enoent.js index f9aa58c3d522cc..38f10e1430a360 100644 --- a/test/parallel/test-fs-watch-enoent.js +++ b/test/parallel/test-fs-watch-enoent.js @@ -8,7 +8,7 @@ assert.throws(function() { }, function(err) { assert(err); assert(/non-existent-file/.test(err)); - assert.equal(err.filename, 'non-existent-file'); + assert.strictEqual(err.filename, 'non-existent-file'); return true; }); @@ -16,6 +16,6 @@ const watcher = fs.watch(__filename); watcher.on('error', common.mustCall(function(err) { assert(err); assert(/non-existent-file/.test(err)); - assert.equal(err.filename, 'non-existent-file'); + assert.strictEqual(err.filename, 'non-existent-file'); })); watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file'); diff --git a/test/parallel/test-fs-watch-stop-async.js b/test/parallel/test-fs-watch-stop-async.js index 5cbfd58418024a..56350430bc7912 100644 --- a/test/parallel/test-fs-watch-stop-async.js +++ b/test/parallel/test-fs-watch-stop-async.js @@ -12,8 +12,8 @@ const listener = common.mustCall(() => { triggered = false; watch.once('stop', listener); // Should trigger. watch.stop(); -assert.equal(triggered, false); +assert.strictEqual(triggered, false); setImmediate(() => { - assert.equal(triggered, true); + assert.strictEqual(triggered, true); watch.removeListener('stop', listener); }); diff --git a/test/parallel/test-fs-write-stream-change-open.js b/test/parallel/test-fs-write-stream-change-open.js index f68cc0a6d386e2..146b507a48ac61 100644 --- a/test/parallel/test-fs-write-stream-change-open.js +++ b/test/parallel/test-fs-write-stream-change-open.js @@ -29,5 +29,5 @@ stream.write('foo'); stream.end(); process.on('exit', function() { - assert.equal(fs.open, _fs_open); + assert.strictEqual(fs.open, _fs_open); }); diff --git a/test/parallel/test-fs-write-stream-err.js b/test/parallel/test-fs-write-stream-err.js index d50fd07103222e..4a2b3cd130b4c4 100644 --- a/test/parallel/test-fs-write-stream-err.js +++ b/test/parallel/test-fs-write-stream-err.js @@ -33,14 +33,14 @@ fs.write = function() { fs.close = common.mustCall(function(fd_, cb) { console.error('fs.close', fd_, stream.fd); - assert.equal(fd_, stream.fd); + assert.strictEqual(fd_, stream.fd); process.nextTick(cb); }); stream.on('error', common.mustCall(function(err_) { console.error('error handler'); - assert.equal(stream.fd, null); - assert.equal(err_, err); + assert.strictEqual(stream.fd, null); + assert.strictEqual(err_, err); })); @@ -48,6 +48,6 @@ stream.write(Buffer.allocUnsafe(256), function() { console.error('first cb'); stream.write(Buffer.allocUnsafe(256), common.mustCall(function(err_) { console.error('second cb'); - assert.equal(err_, err); + assert.strictEqual(err_, err); })); }); diff --git a/test/parallel/test-fs-write-string-coerce.js b/test/parallel/test-fs-write-string-coerce.js index 2694312b863571..8251a45766f918 100644 --- a/test/parallel/test-fs-write-string-coerce.js +++ b/test/parallel/test-fs-write-string-coerce.js @@ -17,7 +17,7 @@ fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) { fs.write(fd, data, 0, 'utf8', common.mustCall(function(err, written) { console.log('write done'); assert.ifError(err); - assert.equal(Buffer.byteLength(expected), written); + assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); const found = fs.readFileSync(fn, 'utf8'); console.log('expected: "%s"', expected); diff --git a/test/parallel/test-http-abort-queued.js b/test/parallel/test-http-abort-queued.js index 8e8339aa82d3dd..60dde248df542c 100644 --- a/test/parallel/test-http-abort-queued.js +++ b/test/parallel/test-http-abort-queued.js @@ -8,7 +8,7 @@ let complete; const server = http.createServer(function(req, res) { // We should not see the queued /thatotherone request within the server // as it should be aborted before it is sent. - assert.equal(req.url, '/'); + assert.strictEqual(req.url, '/'); res.writeHead(200); res.write('foo'); @@ -23,7 +23,7 @@ server.listen(0, function() { console.log('listen', server.address().port); const agent = new http.Agent({maxSockets: 1}); - assert.equal(Object.keys(agent.sockets).length, 0); + assert.strictEqual(Object.keys(agent.sockets).length, 0); const options = { hostname: 'localhost', @@ -35,8 +35,8 @@ server.listen(0, function() { const req1 = http.request(options); req1.on('response', function(res1) { - assert.equal(Object.keys(agent.sockets).length, 1); - assert.equal(Object.keys(agent.requests).length, 0); + assert.strictEqual(Object.keys(agent.sockets).length, 1); + assert.strictEqual(Object.keys(agent.requests).length, 0); const req2 = http.request({ method: 'GET', @@ -45,19 +45,19 @@ server.listen(0, function() { path: '/thatotherone', agent: agent }); - assert.equal(Object.keys(agent.sockets).length, 1); - assert.equal(Object.keys(agent.requests).length, 1); + assert.strictEqual(Object.keys(agent.sockets).length, 1); + assert.strictEqual(Object.keys(agent.requests).length, 1); req2.on('error', function(err) { // This is expected in response to our explicit abort call - assert.equal(err.code, 'ECONNRESET'); + assert.strictEqual(err.code, 'ECONNRESET'); }); req2.end(); req2.abort(); - assert.equal(Object.keys(agent.sockets).length, 1); - assert.equal(Object.keys(agent.requests).length, 1); + assert.strictEqual(Object.keys(agent.sockets).length, 1); + assert.strictEqual(Object.keys(agent.requests).length, 1); console.log('Got res: ' + res1.statusCode); console.dir(res1.headers); @@ -72,8 +72,8 @@ server.listen(0, function() { console.log('Response ended.'); setTimeout(function() { - assert.equal(Object.keys(agent.sockets).length, 0); - assert.equal(Object.keys(agent.requests).length, 0); + assert.strictEqual(Object.keys(agent.sockets).length, 0); + assert.strictEqual(Object.keys(agent.requests).length, 0); server.close(); }, 100); diff --git a/test/parallel/test-http-agent-error-on-idle.js b/test/parallel/test-http-agent-error-on-idle.js index b2bf6334dcbc1b..23fa4dddfab57c 100644 --- a/test/parallel/test-http-agent-error-on-idle.js +++ b/test/parallel/test-http-agent-error-on-idle.js @@ -23,13 +23,13 @@ server.listen(0, function() { const socketKey = agent.getName(requestParams); get(function(res) { - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); res.resume(); res.on('end', function() { process.nextTick(function() { const freeSockets = agent.freeSockets[socketKey]; - assert.equal(freeSockets.length, 1, - 'expect a free socket on ' + socketKey); + assert.strictEqual(freeSockets.length, 1, + 'expect a free socket on ' + socketKey); //generate a random error on the free socket const freeSocket = freeSockets[0]; @@ -45,8 +45,8 @@ server.listen(0, function() { } function done() { - assert.equal(Object.keys(agent.freeSockets).length, 0, - 'expect the freeSockets pool to be empty'); + assert.strictEqual(Object.keys(agent.freeSockets).length, 0, + 'expect the freeSockets pool to be empty'); agent.destroy(); server.close(); diff --git a/test/parallel/test-http-agent-keepalive.js b/test/parallel/test-http-agent-keepalive.js index a78f97edec1fdc..9ea3fd7677aebe 100644 --- a/test/parallel/test-http-agent-keepalive.js +++ b/test/parallel/test-http-agent-keepalive.js @@ -37,22 +37,22 @@ function get(path, callback) { } function checkDataAndSockets(body) { - assert.equal(body.toString(), 'hello world'); - assert.equal(agent.sockets[name].length, 1); - assert.equal(agent.freeSockets[name], undefined); + assert.strictEqual(body.toString(), 'hello world'); + assert.strictEqual(agent.sockets[name].length, 1); + assert.strictEqual(agent.freeSockets[name], undefined); } function second() { // request second, use the same socket get('/second', function(res) { - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); res.on('data', checkDataAndSockets); res.on('end', function() { - assert.equal(agent.sockets[name].length, 1); - assert.equal(agent.freeSockets[name], undefined); + assert.strictEqual(agent.sockets[name].length, 1); + assert.strictEqual(agent.freeSockets[name], undefined); process.nextTick(function() { - assert.equal(agent.sockets[name], undefined); - assert.equal(agent.freeSockets[name].length, 1); + assert.strictEqual(agent.sockets[name], undefined); + assert.strictEqual(agent.freeSockets[name].length, 1); remoteClose(); }); }); @@ -65,16 +65,16 @@ function remoteClose() { assert.deepStrictEqual(res.statusCode, 200); res.on('data', checkDataAndSockets); res.on('end', function() { - assert.equal(agent.sockets[name].length, 1); - assert.equal(agent.freeSockets[name], undefined); + assert.strictEqual(agent.sockets[name].length, 1); + assert.strictEqual(agent.freeSockets[name], undefined); process.nextTick(function() { - assert.equal(agent.sockets[name], undefined); - assert.equal(agent.freeSockets[name].length, 1); + assert.strictEqual(agent.sockets[name], undefined); + assert.strictEqual(agent.freeSockets[name].length, 1); // waitting remote server close the socket setTimeout(function() { - assert.equal(agent.sockets[name], undefined); - assert.equal(agent.freeSockets[name], undefined, - 'freeSockets is not empty'); + assert.strictEqual(agent.sockets[name], undefined); + assert.strictEqual(agent.freeSockets[name], undefined, + 'freeSockets is not empty'); remoteError(); }, common.platformTimeout(200)); }); @@ -89,13 +89,13 @@ function remoteError() { }); req.on('error', function(err) { assert.ok(err); - assert.equal(err.message, 'socket hang up'); - assert.equal(agent.sockets[name].length, 1); - assert.equal(agent.freeSockets[name], undefined); + assert.strictEqual(err.message, 'socket hang up'); + assert.strictEqual(agent.sockets[name].length, 1); + assert.strictEqual(agent.freeSockets[name], undefined); // Wait socket 'close' event emit setTimeout(function() { - assert.equal(agent.sockets[name], undefined); - assert.equal(agent.freeSockets[name], undefined); + assert.strictEqual(agent.sockets[name], undefined); + assert.strictEqual(agent.freeSockets[name], undefined); done(); }, common.platformTimeout(1)); }); @@ -110,14 +110,14 @@ server.listen(0, function() { name = `localhost:${server.address().port}:`; // request first, and keep alive get('/first', function(res) { - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); res.on('data', checkDataAndSockets); res.on('end', function() { - assert.equal(agent.sockets[name].length, 1); - assert.equal(agent.freeSockets[name], undefined); + assert.strictEqual(agent.sockets[name].length, 1); + assert.strictEqual(agent.freeSockets[name], undefined); process.nextTick(function() { - assert.equal(agent.sockets[name], undefined); - assert.equal(agent.freeSockets[name].length, 1); + assert.strictEqual(agent.sockets[name], undefined); + assert.strictEqual(agent.freeSockets[name].length, 1); second(); }); }); diff --git a/test/parallel/test-http-agent-maxsockets.js b/test/parallel/test-http-agent-maxsockets.js index 6814aca3e76fbc..fc7618c5c02fe7 100644 --- a/test/parallel/test-http-agent-maxsockets.js +++ b/test/parallel/test-http-agent-maxsockets.js @@ -29,15 +29,15 @@ function done() { return; } const freepool = agent.freeSockets[Object.keys(agent.freeSockets)[0]]; - assert.equal(freepool.length, 2, - 'expect keep 2 free sockets, but got ' + freepool.length); + assert.strictEqual(freepool.length, 2, + 'expect keep 2 free sockets, but got ' + freepool.length); agent.destroy(); server.close(); } server.listen(0, function() { get('/1', function(res) { - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); res.resume(); res.on('end', function() { process.nextTick(done); @@ -45,7 +45,7 @@ server.listen(0, function() { }); get('/2', function(res) { - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); res.resume(); res.on('end', function() { process.nextTick(done); diff --git a/test/parallel/test-http-agent.js b/test/parallel/test-http-agent.js index 85975979cb3265..cfb37539ede878 100644 --- a/test/parallel/test-http-agent.js +++ b/test/parallel/test-http-agent.js @@ -35,5 +35,5 @@ server.listen(0, function() { process.on('exit', function() { - assert.equal(N * M, responses); + assert.strictEqual(N * M, responses); }); diff --git a/test/parallel/test-http-automatic-headers.js b/test/parallel/test-http-automatic-headers.js index 5fc8d780af9396..37a5c43901c33d 100644 --- a/test/parallel/test-http-automatic-headers.js +++ b/test/parallel/test-http-automatic-headers.js @@ -18,13 +18,13 @@ server.on('listening', function() { path: '/hello', agent: agent }, function(res) { - assert.equal(res.statusCode, 200); - assert.equal(res.headers['x-date'], 'foo'); - assert.equal(res.headers['x-connection'], 'bar'); - assert.equal(res.headers['x-content-length'], 'baz'); + assert.strictEqual(res.statusCode, 200); + assert.strictEqual(res.headers['x-date'], 'foo'); + assert.strictEqual(res.headers['x-connection'], 'bar'); + assert.strictEqual(res.headers['x-content-length'], 'baz'); assert(res.headers['date']); - assert.equal(res.headers['connection'], 'keep-alive'); - assert.equal(res.headers['content-length'], '0'); + assert.strictEqual(res.headers['connection'], 'keep-alive'); + assert.strictEqual(res.headers['content-length'], '0'); server.close(); agent.destroy(); }); diff --git a/test/parallel/test-http-blank-header.js b/test/parallel/test-http-blank-header.js index 2a6bf482077166..edd8923fa8e2f7 100644 --- a/test/parallel/test-http-blank-header.js +++ b/test/parallel/test-http-blank-header.js @@ -5,8 +5,8 @@ const http = require('http'); const net = require('net'); const server = http.createServer(common.mustCall(function(req, res) { - assert.equal('GET', req.method); - assert.equal('/blah', req.url); + assert.strictEqual('GET', req.method); + assert.strictEqual('/blah', req.url); assert.deepStrictEqual({ host: 'mapdevel.trolologames.ru:443', origin: 'http://mapdevel.trolologames.ru', diff --git a/test/parallel/test-http-buffer-sanity.js b/test/parallel/test-http-buffer-sanity.js index c240cd13b1825c..4226f1c65237fa 100644 --- a/test/parallel/test-http-buffer-sanity.js +++ b/test/parallel/test-http-buffer-sanity.js @@ -23,7 +23,7 @@ const web = http.Server(function(req, res) { process.stdout.write(','); measuredSize += d.length; for (let j = 0; j < d.length; j++) { - assert.equal(buffer[i], d[j]); + assert.strictEqual(buffer[i], d[j]); i++; } }); @@ -54,7 +54,7 @@ web.listen(0, common.mustCall(function() { console.log('Got response'); res.setEncoding('utf8'); res.on('data', common.mustCall(function(string) { - assert.equal('thanks', string); + assert.strictEqual('thanks', string); })); })); req.end(buffer); @@ -62,5 +62,5 @@ web.listen(0, common.mustCall(function() { process.on('exit', function() { - assert.equal(bufferSize, measuredSize); + assert.strictEqual(bufferSize, measuredSize); }); diff --git a/test/parallel/test-http-catch-uncaughtexception.js b/test/parallel/test-http-catch-uncaughtexception.js index 06d9b9a6e5d4e0..1366b6e26ea37f 100644 --- a/test/parallel/test-http-catch-uncaughtexception.js +++ b/test/parallel/test-http-catch-uncaughtexception.js @@ -5,7 +5,7 @@ const assert = require('assert'); const http = require('http'); const uncaughtCallback = common.mustCall(function(er) { - assert.equal(er.message, 'get did fail'); + assert.strictEqual(er.message, 'get did fail'); }); process.on('uncaughtException', uncaughtCallback); diff --git a/test/parallel/test-http-chunk-problem.js b/test/parallel/test-http-chunk-problem.js index 82e8534af9e334..0ffd71813e7108 100644 --- a/test/parallel/test-http-chunk-problem.js +++ b/test/parallel/test-http-chunk-problem.js @@ -52,8 +52,8 @@ function executeRequest(cb) { 'shasum' ].join(' '), (err, stdout, stderr) => { assert.ifError(err); - assert.equal('8c206a1a87599f532ce68675536f0b1546900d7a', - stdout.slice(0, 40)); + assert.strictEqual('8c206a1a87599f532ce68675536f0b1546900d7a', + stdout.slice(0, 40)); cb(); } ); diff --git a/test/parallel/test-http-chunked.js b/test/parallel/test-http-chunked.js index 516523221133ec..b70a704bb7fce4 100644 --- a/test/parallel/test-http-chunked.js +++ b/test/parallel/test-http-chunked.js @@ -30,9 +30,9 @@ server.listen(0, function() { throw e; }); x.on('end', function() { - assert.equal('string', typeof data); + assert.strictEqual('string', typeof data); console.log('here is the response:'); - assert.equal(UTF8_STRING, data); + assert.strictEqual(UTF8_STRING, data); console.log(data); server.close(); }); diff --git a/test/parallel/test-http-client-abort.js b/test/parallel/test-http-client-abort.js index 738c620815a21a..5c5b319bfa4f5f 100644 --- a/test/parallel/test-http-client-abort.js +++ b/test/parallel/test-http-client-abort.js @@ -51,5 +51,5 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(N, clientAborts); + assert.strictEqual(N, clientAborts); }); diff --git a/test/parallel/test-http-client-agent.js b/test/parallel/test-http-client-agent.js index 3c2b9c89727467..277c7a33ae586a 100644 --- a/test/parallel/test-http-client-agent.js +++ b/test/parallel/test-http-client-agent.js @@ -34,7 +34,7 @@ function request(i) { socket.on('close', function() { ++count; if (count < max) { - assert.equal(http.globalAgent.sockets[name].indexOf(socket), -1); + assert.strictEqual(http.globalAgent.sockets[name].indexOf(socket), -1); } else { assert(!http.globalAgent.sockets.hasOwnProperty(name)); assert(!http.globalAgent.requests.hasOwnProperty(name)); @@ -46,5 +46,5 @@ function request(i) { } process.on('exit', function() { - assert.equal(count, max); + assert.strictEqual(count, max); }); diff --git a/test/parallel/test-http-client-get-url.js b/test/parallel/test-http-client-get-url.js index 9311110bdc041c..aa37055050c952 100644 --- a/test/parallel/test-http-client-get-url.js +++ b/test/parallel/test-http-client-get-url.js @@ -6,8 +6,8 @@ const url = require('url'); const URL = url.URL; const server = http.createServer(common.mustCall(function(req, res) { - assert.equal('GET', req.method); - assert.equal('/foo?bar', req.url); + assert.strictEqual('GET', req.method); + assert.strictEqual('/foo?bar', req.url); res.writeHead(200, {'Content-Type': 'text/plain'}); res.write('hello\n'); res.end(); diff --git a/test/parallel/test-http-client-parse-error.js b/test/parallel/test-http-client-parse-error.js index 0d8f577a78566c..e649f983a51626 100644 --- a/test/parallel/test-http-client-parse-error.js +++ b/test/parallel/test-http-client-parse-error.js @@ -27,13 +27,13 @@ net.createServer(function(c) { }).on('error', function(e) { console.log('got error from client'); assert.ok(e.message.indexOf('Parse Error') >= 0); - assert.equal(e.code, 'HPE_INVALID_CONSTANT'); + assert.strictEqual(e.code, 'HPE_INVALID_CONSTANT'); parseErrors++; }).end(); } }); process.on('exit', function() { - assert.equal(connects, 2); - assert.equal(parseErrors, 2); + assert.strictEqual(connects, 2); + assert.strictEqual(parseErrors, 2); }); diff --git a/test/parallel/test-http-client-race-2.js b/test/parallel/test-http-client-race-2.js index d9e89b85eca1ed..24475059c55688 100644 --- a/test/parallel/test-http-client-race-2.js +++ b/test/parallel/test-http-client-race-2.js @@ -83,7 +83,7 @@ server.on('listening', function() { }); process.on('exit', function() { - assert.equal(body1_s, body1); - assert.equal(body2_s, body2); - assert.equal(body3_s, body3); + assert.strictEqual(body1_s, body1); + assert.strictEqual(body2_s, body2); + assert.strictEqual(body3_s, body3); }); diff --git a/test/parallel/test-http-client-race.js b/test/parallel/test-http-client-race.js index 14e3300f20a436..f7610507378921 100644 --- a/test/parallel/test-http-client-race.js +++ b/test/parallel/test-http-client-race.js @@ -41,6 +41,6 @@ server.on('listening', function() { }); process.on('exit', function() { - assert.equal(body1_s, body1); - assert.equal(body2_s, body2); + assert.strictEqual(body1_s, body1); + assert.strictEqual(body2_s, body2); }); diff --git a/test/parallel/test-http-client-reject-chunked-with-content-length.js b/test/parallel/test-http-client-reject-chunked-with-content-length.js index daa0591cd75506..3d99f6ef406b1b 100644 --- a/test/parallel/test-http-client-reject-chunked-with-content-length.js +++ b/test/parallel/test-http-client-reject-chunked-with-content-length.js @@ -22,7 +22,7 @@ server.listen(0, () => { }); req.on('error', common.mustCall((err) => { assert(/^Parse Error/.test(err.message)); - assert.equal(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); + assert.strictEqual(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); server.close(); })); }); diff --git a/test/parallel/test-http-client-reject-cr-no-lf.js b/test/parallel/test-http-client-reject-cr-no-lf.js index 4cabfa0107bbc8..23530cbc7ae74c 100644 --- a/test/parallel/test-http-client-reject-cr-no-lf.js +++ b/test/parallel/test-http-client-reject-cr-no-lf.js @@ -21,7 +21,7 @@ server.listen(0, () => { }); req.on('error', common.mustCall((err) => { assert(/^Parse Error/.test(err.message)); - assert.equal(err.code, 'HPE_LF_EXPECTED'); + assert.strictEqual(err.code, 'HPE_LF_EXPECTED'); server.close(); })); }); diff --git a/test/parallel/test-http-client-response-domain.js b/test/parallel/test-http-client-response-domain.js index eb8b226acef169..20babf51a9178a 100644 --- a/test/parallel/test-http-client-response-domain.js +++ b/test/parallel/test-http-client-response-domain.js @@ -23,7 +23,7 @@ server.listen(common.PIPE, function() { function test() { d.on('error', common.mustCall(function(err) { - assert.equal('should be caught by domain', err.message); + assert.strictEqual('should be caught by domain', err.message); })); const req = http.get({ diff --git a/test/parallel/test-http-client-upload-buf.js b/test/parallel/test-http-client-upload-buf.js index 338aab9cc59ba0..208de06e8ebcd5 100644 --- a/test/parallel/test-http-client-upload-buf.js +++ b/test/parallel/test-http-client-upload-buf.js @@ -6,7 +6,7 @@ const http = require('http'); const N = 1024; const server = http.createServer(common.mustCall(function(req, res) { - assert.equal('POST', req.method); + assert.strictEqual('POST', req.method); let bytesReceived = 0; diff --git a/test/parallel/test-http-client-upload.js b/test/parallel/test-http-client-upload.js index ba60681776ba49..474dc333d142cd 100644 --- a/test/parallel/test-http-client-upload.js +++ b/test/parallel/test-http-client-upload.js @@ -4,7 +4,7 @@ const assert = require('assert'); const http = require('http'); const server = http.createServer(common.mustCall(function(req, res) { - assert.equal('POST', req.method); + assert.strictEqual('POST', req.method); req.setEncoding('utf8'); let sent_body = ''; diff --git a/test/parallel/test-http-conn-reset.js b/test/parallel/test-http-conn-reset.js index f7f08a6bf42c81..ae04c41aff5181 100644 --- a/test/parallel/test-http-conn-reset.js +++ b/test/parallel/test-http-conn-reset.js @@ -23,7 +23,7 @@ function onListen() { assert.ok(false, 'this should never run'); }); req.on('error', common.mustCall(function(err) { - assert.equal(err.code, 'ECONNRESET'); + assert.strictEqual(err.code, 'ECONNRESET'); })); req.end(); } diff --git a/test/parallel/test-http-connect-req-res.js b/test/parallel/test-http-connect-req-res.js index 0b1ca4630a562e..45881f0d7d7395 100644 --- a/test/parallel/test-http-connect-req-res.js +++ b/test/parallel/test-http-connect-req-res.js @@ -5,8 +5,8 @@ const http = require('http'); const server = http.createServer(common.fail); server.on('connect', common.mustCall(function(req, socket, firstBodyChunk) { - assert.equal(req.method, 'CONNECT'); - assert.equal(req.url, 'example.com:443'); + assert.strictEqual(req.method, 'CONNECT'); + assert.strictEqual(req.url, 'example.com:443'); console.error('Server got CONNECT request'); // It is legal for the server to send some data intended for the client @@ -46,19 +46,19 @@ server.listen(0, common.mustCall(function() { // Make sure this socket has detached. assert(!socket.ondata); assert(!socket.onend); - assert.equal(socket.listeners('connect').length, 0); - assert.equal(socket.listeners('data').length, 0); + assert.strictEqual(socket.listeners('connect').length, 0); + assert.strictEqual(socket.listeners('data').length, 0); let data = firstBodyChunk.toString(); // test that the firstBodyChunk was not parsed as HTTP - assert.equal(data, 'Head'); + assert.strictEqual(data, 'Head'); socket.on('data', function(buf) { data += buf.toString(); }); socket.on('end', function() { - assert.equal(data, 'HeadRequestEnd'); + assert.strictEqual(data, 'HeadRequestEnd'); server.close(); }); socket.end('End'); diff --git a/test/parallel/test-http-createConnection.js b/test/parallel/test-http-createConnection.js index 69592eb09ff487..279d7022795318 100644 --- a/test/parallel/test-http-createConnection.js +++ b/test/parallel/test-http-createConnection.js @@ -23,7 +23,7 @@ const server = http.createServer(common.mustCall(function(req, res) { http.get({ createConnection: fn }, function(res) { common.fail('Unexpected response callback'); }).on('error', common.mustCall(function(err) { - assert.equal(err.message, 'Could not create socket'); + assert.strictEqual(err.message, 'Could not create socket'); server.close(); })); }); diff --git a/test/parallel/test-http-default-encoding.js b/test/parallel/test-http-default-encoding.js index 46327085184069..2c41328749f027 100644 --- a/test/parallel/test-http-default-encoding.js +++ b/test/parallel/test-http-default-encoding.js @@ -33,5 +33,5 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(expected, result); + assert.strictEqual(expected, result); }); diff --git a/test/parallel/test-http-default-port.js b/test/parallel/test-http-default-port.js index d26150f4a824ed..146e5846c107b6 100644 --- a/test/parallel/test-http-default-port.js +++ b/test/parallel/test-http-default-port.js @@ -29,8 +29,8 @@ process.on('exit', function() { }); http.createServer(function(req, res) { - assert.equal(req.headers.host, hostExpect); - assert.equal(req.headers['x-port'], this.address().port); + assert.strictEqual(req.headers.host, hostExpect); + assert.strictEqual(req.headers['x-port'], this.address().port.toString()); res.writeHead(200); res.end('ok'); this.close(); @@ -49,8 +49,8 @@ http.createServer(function(req, res) { if (common.hasCrypto) { https.createServer(options, function(req, res) { - assert.equal(req.headers.host, hostExpect); - assert.equal(req.headers['x-port'], this.address().port); + assert.strictEqual(req.headers.host, hostExpect); + assert.strictEqual(req.headers['x-port'], this.address().port.toString()); res.writeHead(200); res.end('ok'); this.close(); diff --git a/test/parallel/test-http-destroyed-socket-write2.js b/test/parallel/test-http-destroyed-socket-write2.js index 01023a088576ef..59e0eeecfc8a7a 100644 --- a/test/parallel/test-http-destroyed-socket-write2.js +++ b/test/parallel/test-http-destroyed-socket-write2.js @@ -47,8 +47,8 @@ server.listen(0, function() { break; } - assert.equal(req.output.length, 0); - assert.equal(req.outputEncodings.length, 0); + assert.strictEqual(req.output.length, 0); + assert.strictEqual(req.outputEncodings.length, 0); server.close(); })); diff --git a/test/parallel/test-http-double-content-length.js b/test/parallel/test-http-double-content-length.js index f6c13becfd83dd..fdc79fb74ec5c2 100644 --- a/test/parallel/test-http-double-content-length.js +++ b/test/parallel/test-http-double-content-length.js @@ -13,7 +13,7 @@ const server = http.createServer((req, res) => { }); server.on('clientError', common.mustCall((err, socket) => { assert(/^Parse Error/.test(err.message)); - assert.equal(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); + assert.strictEqual(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); socket.destroy(); })); diff --git a/test/parallel/test-http-expect-continue.js b/test/parallel/test-http-expect-continue.js index 0cf90e3b115e60..01f285d29e54fb 100644 --- a/test/parallel/test-http-expect-continue.js +++ b/test/parallel/test-http-expect-continue.js @@ -10,7 +10,8 @@ let sent_continue = false; let got_continue = false; function handler(req, res) { - assert.equal(sent_continue, true, 'Full response sent before 100 Continue'); + assert.strictEqual(sent_continue, true, 'Full response sent before ' + + '100 Continue'); console.error('Server sending full response...'); res.writeHead(200, { 'Content-Type': 'text/plain', @@ -47,15 +48,15 @@ server.on('listening', function() { req.end(test_req_body); }); req.on('response', function(res) { - assert.equal(got_continue, true, - 'Full response received before 100 Continue'); - assert.equal(200, res.statusCode, - 'Final status code was ' + res.statusCode + ', not 200.'); + assert.strictEqual(got_continue, true, + 'Full response received before 100 Continue'); + assert.strictEqual(200, res.statusCode, 'Final status code was ' + + res.statusCode + ', not 200.'); res.setEncoding('utf8'); res.on('data', function(chunk) { body += chunk; }); res.on('end', function() { console.error('Got full response.'); - assert.equal(body, test_res_body, 'Response body doesn\'t match.'); + assert.strictEqual(body, test_res_body, 'Response body doesn\'t match.'); assert.ok('abcd' in res.headers, 'Response headers missing.'); outstanding_reqs--; if (outstanding_reqs === 0) { diff --git a/test/parallel/test-http-expect-handling.js b/test/parallel/test-http-expect-handling.js index f1f12847315a22..fed715bc2ace7d 100644 --- a/test/parallel/test-http-expect-handling.js +++ b/test/parallel/test-http-expect-handling.js @@ -37,8 +37,8 @@ function nextTest() { http.get(options, function(response) { console.log('client: expected status: ' + test); console.log('client: statusCode: ' + response.statusCode); - assert.equal(response.statusCode, test); - assert.equal(response.statusMessage, 'Expectation Failed'); + assert.strictEqual(response.statusCode, test); + assert.strictEqual(response.statusMessage, 'Expectation Failed'); response.on('end', function() { testsComplete++; @@ -51,5 +51,5 @@ function nextTest() { process.on('exit', function() { - assert.equal(2, testsComplete); + assert.strictEqual(2, testsComplete); }); diff --git a/test/parallel/test-http-extra-response.js b/test/parallel/test-http-extra-response.js index 6ebecaad1300de..5e994134c2e2ad 100644 --- a/test/parallel/test-http-extra-response.js +++ b/test/parallel/test-http-extra-response.js @@ -36,7 +36,7 @@ const server = net.createServer(function(socket) { }); socket.on('error', function(err) { - assert.equal(err.code, 'ECONNRESET'); + assert.strictEqual(err.code, 'ECONNRESET'); }); }); @@ -53,7 +53,7 @@ server.listen(0, common.mustCall(function() { res.on('end', common.mustCall(function() { console.log('Response ended, read ' + buffer.length + ' bytes'); - assert.equal(body, buffer); + assert.strictEqual(body, buffer); server.close(); })); })); diff --git a/test/parallel/test-http-flush-headers.js b/test/parallel/test-http-flush-headers.js index c2b382188a14c1..8ca5e92e5e02bc 100644 --- a/test/parallel/test-http-flush-headers.js +++ b/test/parallel/test-http-flush-headers.js @@ -5,7 +5,7 @@ const http = require('http'); const server = http.createServer(); server.on('request', function(req, res) { - assert.equal(req.headers['foo'], 'bar'); + assert.strictEqual(req.headers['foo'], 'bar'); res.end('ok'); server.close(); }); diff --git a/test/parallel/test-http-flush-response-headers.js b/test/parallel/test-http-flush-response-headers.js index ea7d2d97b4dc7a..bfc43a602b7018 100644 --- a/test/parallel/test-http-flush-response-headers.js +++ b/test/parallel/test-http-flush-response-headers.js @@ -20,7 +20,7 @@ server.listen(0, common.localhostIPv4, function() { req.end(); function onResponse(res) { - assert.equal(res.headers['foo'], 'bar'); + assert.strictEqual(res.headers['foo'], 'bar'); res.destroy(); server.close(); } diff --git a/test/parallel/test-http-full-response.js b/test/parallel/test-http-full-response.js index c834c6e6545320..881734ceb1af6f 100644 --- a/test/parallel/test-http-full-response.js +++ b/test/parallel/test-http-full-response.js @@ -38,8 +38,8 @@ function runAb(opts, callback) { m = /HTML transferred:\s*(\d+) bytes/mi.exec(stdout); const htmlTransfered = parseInt(m[1]); - assert.equal(bodyLength, documentLength); - assert.equal(completeRequests * documentLength, htmlTransfered); + assert.strictEqual(bodyLength, documentLength); + assert.strictEqual(completeRequests * documentLength, htmlTransfered); if (callback) callback(); }); diff --git a/test/parallel/test-http-get-pipeline-problem.js b/test/parallel/test-http-get-pipeline-problem.js index 15c96a9a4e12ea..56bfb33456dff7 100644 --- a/test/parallel/test-http-get-pipeline-problem.js +++ b/test/parallel/test-http-get-pipeline-problem.js @@ -74,8 +74,8 @@ function checkFiles() { const fn = i + '.jpg'; assert.ok(files.indexOf(fn) >= 0, "couldn't find '" + fn + "'"); const stat = fs.statSync(common.tmpDir + '/' + fn); - assert.equal(image.length, stat.size, - "size doesn't match on '" + fn + + assert.strictEqual(image.length, stat.size, + "size doesn't match on '" + fn + "'. Got " + stat.size + ' bytes'); } @@ -84,7 +84,7 @@ function checkFiles() { process.on('exit', function() { - assert.equal(total, requests); - assert.equal(total, responses); + assert.strictEqual(total, requests); + assert.strictEqual(total, responses); assert.ok(checkedFiles); }); diff --git a/test/parallel/test-http-header-read.js b/test/parallel/test-http-header-read.js index 3d9e756d505238..5465fd30f272be 100644 --- a/test/parallel/test-http-header-read.js +++ b/test/parallel/test-http-header-read.js @@ -18,7 +18,7 @@ const s = http.createServer(function(req, res) { // and does not throw an exception (Issue 752) assert.doesNotThrow( function() { - assert.equal(plain, res.getHeader(contentType)); + assert.strictEqual(plain, res.getHeader(contentType)); } ); }); diff --git a/test/parallel/test-http-host-headers.js b/test/parallel/test-http-host-headers.js index 0f6233190ce875..c127b3375b224c 100644 --- a/test/parallel/test-http-host-headers.js +++ b/test/parallel/test-http-host-headers.js @@ -7,10 +7,10 @@ const httpServer = http.createServer(reqHandler); function reqHandler(req, res) { console.log('Got request: ' + req.headers.host + ' ' + req.url); if (req.url === '/setHostFalse5') { - assert.equal(req.headers.host, undefined); + assert.strictEqual(req.headers.host, undefined); } else { - assert.equal(req.headers.host, `localhost:${this.address().port}`, - 'Wrong host header for req[' + req.url + ']: ' + + assert.strictEqual(req.headers.host, `localhost:${this.address().port}`, + 'Wrong host header for req[' + req.url + ']: ' + req.headers.host); } res.writeHead(200, {}); diff --git a/test/parallel/test-http-keep-alive-close-on-header.js b/test/parallel/test-http-keep-alive-close-on-header.js index 15d5d62d429658..b36fb2e8db9a5a 100644 --- a/test/parallel/test-http-keep-alive-close-on-header.js +++ b/test/parallel/test-http-keep-alive-close-on-header.js @@ -25,7 +25,7 @@ server.listen(0, function() { port: this.address().port, agent: agent }, function(res) { - assert.equal(1, agent.sockets[name].length); + assert.strictEqual(1, agent.sockets[name].length); res.resume(); }); request.on('socket', function(s) { @@ -42,7 +42,7 @@ server.listen(0, function() { port: this.address().port, agent: agent }, function(res) { - assert.equal(1, agent.sockets[name].length); + assert.strictEqual(1, agent.sockets[name].length); res.resume(); }); request.on('socket', function(s) { @@ -59,7 +59,7 @@ server.listen(0, function() { agent: agent }, function(response) { response.on('end', function() { - assert.equal(1, agent.sockets[name].length); + assert.strictEqual(1, agent.sockets[name].length); server.close(); }); response.resume(); @@ -73,5 +73,5 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(3, connectCount); + assert.strictEqual(3, connectCount); }); diff --git a/test/parallel/test-http-keepalive-client.js b/test/parallel/test-http-keepalive-client.js index c9cf7bba96a7db..eaefa3887c395d 100644 --- a/test/parallel/test-http-keepalive-client.js +++ b/test/parallel/test-http-keepalive-client.js @@ -9,7 +9,7 @@ let serverSocket = null; const server = http.createServer(function(req, res) { // They should all come in on the same server socket. if (serverSocket) { - assert.equal(req.socket, serverSocket); + assert.strictEqual(req.socket, serverSocket); } else { serverSocket = req.socket; } @@ -45,7 +45,7 @@ function makeRequest(n) { req.on('socket', function(sock) { if (clientSocket) { - assert.equal(sock, clientSocket); + assert.strictEqual(sock, clientSocket); } else { clientSocket = sock; } @@ -58,7 +58,7 @@ function makeRequest(n) { data += c; }); res.on('end', function() { - assert.equal(data, '/' + n); + assert.strictEqual(data, '/' + n); setTimeout(function() { actualRequests++; makeRequest(n - 1); @@ -68,6 +68,6 @@ function makeRequest(n) { } process.on('exit', function() { - assert.equal(actualRequests, expectRequests); + assert.strictEqual(actualRequests, expectRequests); console.log('ok'); }); diff --git a/test/parallel/test-http-keepalive-maxsockets.js b/test/parallel/test-http-keepalive-maxsockets.js index 14e9e88ef7fd09..0d684a43f778f9 100644 --- a/test/parallel/test-http-keepalive-maxsockets.js +++ b/test/parallel/test-http-keepalive-maxsockets.js @@ -22,17 +22,17 @@ server.listen(0, function() { let closed = false; makeReqs(10, function(er) { assert.ifError(er); - assert.equal(count(agent.freeSockets), 2); - assert.equal(count(agent.sockets), 0); - assert.equal(serverSockets.length, 5); + assert.strictEqual(count(agent.freeSockets), 2); + assert.strictEqual(count(agent.sockets), 0); + assert.strictEqual(serverSockets.length, 5); // now make 10 more reqs. // should use the 2 free reqs from the pool first. makeReqs(10, function(er) { assert.ifError(er); - assert.equal(count(agent.freeSockets), 2); - assert.equal(count(agent.sockets), 0); - assert.equal(serverSockets.length, 8); + assert.strictEqual(count(agent.freeSockets), 2); + assert.strictEqual(count(agent.sockets), 0); + assert.strictEqual(serverSockets.length, 8); agent.destroy(); server.close(function() { @@ -72,7 +72,7 @@ server.listen(0, function() { data += c; }); res.on('end', function() { - assert.equal(data, '/' + i); + assert.strictEqual(data, '/' + i); cb(); }); }).end(); diff --git a/test/parallel/test-http-keepalive-request.js b/test/parallel/test-http-keepalive-request.js index dc9bdefb333d13..5f53f6d999f38d 100644 --- a/test/parallel/test-http-keepalive-request.js +++ b/test/parallel/test-http-keepalive-request.js @@ -9,7 +9,7 @@ let serverSocket = null; const server = http.createServer(function(req, res) { // They should all come in on the same server socket. if (serverSocket) { - assert.equal(req.socket, serverSocket); + assert.strictEqual(req.socket, serverSocket); } else { serverSocket = req.socket; } @@ -45,7 +45,7 @@ function makeRequest(n) { req.on('socket', function(sock) { if (clientSocket) { - assert.equal(sock, clientSocket); + assert.strictEqual(sock, clientSocket); } else { clientSocket = sock; } @@ -58,7 +58,7 @@ function makeRequest(n) { data += c; }); res.on('end', function() { - assert.equal(data, '/' + n); + assert.strictEqual(data, '/' + n); setTimeout(function() { actualRequests++; makeRequest(n - 1); @@ -68,6 +68,6 @@ function makeRequest(n) { } process.on('exit', function() { - assert.equal(actualRequests, expectRequests); + assert.strictEqual(actualRequests, expectRequests); console.log('ok'); }); diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js index e8df6888866f9c..d48a4ec8f5b0ee 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -10,7 +10,7 @@ if (!common.hasMultiLocalhost()) { const server = http.createServer(function(req, res) { console.log('Connect from: ' + req.connection.remoteAddress); - assert.equal('127.0.0.2', req.connection.remoteAddress); + assert.strictEqual('127.0.0.2', req.connection.remoteAddress); req.on('end', function() { res.writeHead(200, { 'Content-Type': 'text/plain' }); diff --git a/test/parallel/test-http-malformed-request.js b/test/parallel/test-http-malformed-request.js index a36c9fdbe29451..93aff802c7afbd 100644 --- a/test/parallel/test-http-malformed-request.js +++ b/test/parallel/test-http-malformed-request.js @@ -31,5 +31,5 @@ server.on('listening', function() { }); process.on('exit', function() { - assert.equal(nrequests_expected, nrequests_completed); + assert.strictEqual(nrequests_expected, nrequests_completed); }); diff --git a/test/parallel/test-http-max-headers-count.js b/test/parallel/test-http-max-headers-count.js index 018ed33c1b9e49..fd92637f7ac10b 100644 --- a/test/parallel/test-http-max-headers-count.js +++ b/test/parallel/test-http-max-headers-count.js @@ -21,7 +21,7 @@ let max = maxAndExpected[requests][0]; let expected = maxAndExpected[requests][1]; const server = http.createServer(function(req, res) { - assert.equal(Object.keys(req.headers).length, expected); + assert.strictEqual(Object.keys(req.headers).length, expected); if (++requests < maxAndExpected.length) { max = maxAndExpected[requests][0]; expected = maxAndExpected[requests][1]; @@ -47,7 +47,7 @@ server.listen(0, function() { port: server.address().port, headers: headers }, function(res) { - assert.equal(Object.keys(res.headers).length, expected); + assert.strictEqual(Object.keys(res.headers).length, expected); res.on('end', function() { if (++responses < maxAndExpected.length) { doRequest(); @@ -63,6 +63,6 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(requests, maxAndExpected.length); - assert.equal(responses, maxAndExpected.length); + assert.strictEqual(requests, maxAndExpected.length); + assert.strictEqual(responses, maxAndExpected.length); }); diff --git a/test/parallel/test-http-multi-line-headers.js b/test/parallel/test-http-multi-line-headers.js index 2096f533a196d1..f7998c254870d5 100644 --- a/test/parallel/test-http-multi-line-headers.js +++ b/test/parallel/test-http-multi-line-headers.js @@ -27,8 +27,8 @@ server.listen(0, common.mustCall(function() { host: '127.0.0.1', port: this.address().port }, common.mustCall(function(res) { - assert.equal(res.headers['content-type'], - 'text/plain; x-unix-mode=0600; name="hello.txt"'); + assert.strictEqual(res.headers['content-type'], + 'text/plain; x-unix-mode=0600; name="hello.txt"'); res.destroy(); })); })); diff --git a/test/parallel/test-http-parser-bad-ref.js b/test/parallel/test-http-parser-bad-ref.js index 69682128fadbdf..97b4685e18382b 100644 --- a/test/parallel/test-http-parser-bad-ref.js +++ b/test/parallel/test-http-parser-bad-ref.js @@ -83,7 +83,7 @@ demoBug('POST /1/22 HTTP/1.1\r\n' + /* eslint-enable align-function-arguments */ process.on('exit', function() { - assert.equal(2, headersComplete); - assert.equal(2, messagesComplete); + assert.strictEqual(2, headersComplete); + assert.strictEqual(2, messagesComplete); console.log('done!'); }); diff --git a/test/parallel/test-http-parser-free.js b/test/parallel/test-http-parser-free.js index 80cc3cc64ee5b3..aff0fa6198ef44 100644 --- a/test/parallel/test-http-parser-free.js +++ b/test/parallel/test-http-parser-free.js @@ -31,5 +31,5 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(responses, N); + assert.strictEqual(responses, N); }); diff --git a/test/parallel/test-http-parser.js b/test/parallel/test-http-parser.js index e1215fbd13ae40..de7302e60d91ba 100644 --- a/test/parallel/test-http-parser.js +++ b/test/parallel/test-http-parser.js @@ -51,7 +51,7 @@ function mustCall(f, times) { process.setMaxListeners(256); process.on('exit', function() { - assert.equal(actual, times || 1); + assert.strictEqual(actual, times || 1); }); return function() { @@ -64,7 +64,7 @@ function mustCall(f, times) { function expectBody(expected) { return mustCall(function(buf, start, len) { const body = '' + buf.slice(start, start + len); - assert.equal(body, expected); + assert.strictEqual(body, expected); }); } @@ -535,10 +535,10 @@ function expectBody(expected) { const onHeadersComplete1 = function(versionMajor, versionMinor, headers, method, url, statusCode, statusMessage, upgrade, shouldKeepAlive) { - assert.equal(method, methods.indexOf('PUT')); - assert.equal(url, '/this'); - assert.equal(versionMajor, 1); - assert.equal(versionMinor, 1); + assert.strictEqual(method, methods.indexOf('PUT')); + assert.strictEqual(url, '/this'); + assert.strictEqual(versionMajor, 1); + assert.strictEqual(versionMinor, 1); assert.deepStrictEqual( headers, ['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']); diff --git a/test/parallel/test-http-pause.js b/test/parallel/test-http-pause.js index 8bb8dd4b5da25c..440cab413c50a5 100644 --- a/test/parallel/test-http-pause.js +++ b/test/parallel/test-http-pause.js @@ -50,6 +50,6 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(expectedServer, resultServer); - assert.equal(expectedClient, resultClient); + assert.strictEqual(expectedServer, resultServer); + assert.strictEqual(expectedClient, resultClient); }); diff --git a/test/parallel/test-http-pipeline-regr-2639.js b/test/parallel/test-http-pipeline-regr-2639.js index 7933e419d324f7..133e4126683d9b 100644 --- a/test/parallel/test-http-pipeline-regr-2639.js +++ b/test/parallel/test-http-pipeline-regr-2639.js @@ -29,5 +29,5 @@ const server = http.createServer(function(req, res) { }); process.on('exit', function() { - assert.equal(received, COUNT); + assert.strictEqual(received, COUNT); }); diff --git a/test/parallel/test-http-pipeline-regr-3332.js b/test/parallel/test-http-pipeline-regr-3332.js index 3ab9e6104c9848..b34ad499850b70 100644 --- a/test/parallel/test-http-pipeline-regr-3332.js +++ b/test/parallel/test-http-pipeline-regr-3332.js @@ -36,5 +36,5 @@ process.on('exit', function() { // The server should pause connection on pipeline flood, but it shoul still // resume it and finish processing the requests, when its output queue will // be empty again. - assert.equal(received, COUNT); + assert.strictEqual(received, COUNT); }); diff --git a/test/parallel/test-http-proxy.js b/test/parallel/test-http-proxy.js index 8e7fd55a0ed6ea..91dce932dc576b 100644 --- a/test/parallel/test-http-proxy.js +++ b/test/parallel/test-http-proxy.js @@ -29,8 +29,8 @@ const proxy = http.createServer(function(req, res) { console.error('proxy res headers: ' + JSON.stringify(proxy_res.headers)); - assert.equal('world', proxy_res.headers['hello']); - assert.equal('text/plain', proxy_res.headers['content-type']); + assert.strictEqual('world', proxy_res.headers['hello']); + assert.strictEqual('text/plain', proxy_res.headers['content-type']); assert.deepStrictEqual(cookies, proxy_res.headers['set-cookie']); res.writeHead(proxy_res.statusCode, proxy_res.headers); @@ -58,10 +58,10 @@ function startReq() { path: '/test' }, function(res) { console.error('got res'); - assert.equal(200, res.statusCode); + assert.strictEqual(200, res.statusCode); - assert.equal('world', res.headers['hello']); - assert.equal('text/plain', res.headers['content-type']); + assert.strictEqual('world', res.headers['hello']); + assert.strictEqual('text/plain', res.headers['content-type']); assert.deepStrictEqual(cookies, res.headers['set-cookie']); res.setEncoding('utf8'); @@ -82,5 +82,5 @@ console.error('listen backend'); backend.listen(0, startReq); process.on('exit', function() { - assert.equal(body, 'hello world\n'); + assert.strictEqual(body, 'hello world\n'); }); diff --git a/test/parallel/test-http-remove-header-stays-removed.js b/test/parallel/test-http-remove-header-stays-removed.js index 077ff0f5b33f40..c38a042283dbb9 100644 --- a/test/parallel/test-http-remove-header-stays-removed.js +++ b/test/parallel/test-http-remove-header-stays-removed.js @@ -23,13 +23,13 @@ const server = http.createServer(function(request, response) { let response = ''; process.on('exit', function() { - assert.equal('beep boop\n', response); + assert.strictEqual('beep boop\n', response); console.log('ok'); }); server.listen(0, function() { http.get({ port: this.address().port }, function(res) { - assert.equal(200, res.statusCode); + assert.strictEqual(200, res.statusCode); assert.deepStrictEqual(res.headers, { date: 'coffee o clock' }); res.setEncoding('ascii'); diff --git a/test/parallel/test-http-request-dont-override-options.js b/test/parallel/test-http-request-dont-override-options.js index 04235fd0e42b4e..33ed2ed6c0070d 100644 --- a/test/parallel/test-http-request-dont-override-options.js +++ b/test/parallel/test-http-request-dont-override-options.js @@ -33,7 +33,7 @@ http.createServer(function(req, res) { }).end(); process.on('exit', function() { - assert.equal(requests, 1); + assert.strictEqual(requests, 1); assert.strictEqual(options.host, undefined); assert.strictEqual(options.hostname, common.localhostIPv4); diff --git a/test/parallel/test-http-res-write-after-end.js b/test/parallel/test-http-res-write-after-end.js index 2ee0e4e29d95e4..45db9fe13f7655 100644 --- a/test/parallel/test-http-res-write-after-end.js +++ b/test/parallel/test-http-res-write-after-end.js @@ -12,7 +12,7 @@ const server = http.Server(common.mustCall(function(req, res) { res.end(); const r = res.write('This should raise an error.'); - assert.equal(r, true, 'write after end should return true'); + assert.strictEqual(r, true, 'write after end should return true'); })); server.listen(0, function() { diff --git a/test/parallel/test-http-response-multi-content-length.js b/test/parallel/test-http-response-multi-content-length.js index 7cd802a74aa80c..f3dce208756f74 100644 --- a/test/parallel/test-http-response-multi-content-length.js +++ b/test/parallel/test-http-response-multi-content-length.js @@ -39,7 +39,7 @@ server.listen(0, common.mustCall(() => { } ).on('error', common.mustCall((err) => { assert(/^Parse Error/.test(err.message)); - assert.equal(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); + assert.strictEqual(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); count++; if (count === MAX_COUNT) server.close(); @@ -48,5 +48,5 @@ server.listen(0, common.mustCall(() => { })); process.on('exit', () => { - assert.equal(count, MAX_COUNT); + assert.strictEqual(count, MAX_COUNT); }); diff --git a/test/parallel/test-http-response-multiheaders.js b/test/parallel/test-http-response-multiheaders.js index 8f48dc2377f3c3..5739dac31d690b 100644 --- a/test/parallel/test-http-response-multiheaders.js +++ b/test/parallel/test-http-response-multiheaders.js @@ -60,9 +60,9 @@ server.listen(0, common.mustCall(function() { common.mustCall(function(res) { if (++count === 2) server.close(); for (const name of norepeat) { - assert.equal(res.headers[name], 'A'); + assert.strictEqual(res.headers[name], 'A'); } - assert.equal(res.headers['x-a'], 'A, B'); + assert.strictEqual(res.headers['x-a'], 'A, B'); }) ); } diff --git a/test/parallel/test-http-response-no-headers.js b/test/parallel/test-http-response-no-headers.js index 3f44b4ef5fde0b..e10571af4ccf25 100644 --- a/test/parallel/test-http-response-no-headers.js +++ b/test/parallel/test-http-response-no-headers.js @@ -32,7 +32,7 @@ function test(httpVersion, callback) { }); res.on('end', common.mustCall(function() { - assert.equal(body, expected[httpVersion]); + assert.strictEqual(body, expected[httpVersion]); server.close(); if (callback) process.nextTick(callback); })); diff --git a/test/parallel/test-http-response-readable.js b/test/parallel/test-http-response-readable.js index 07c0a40e4bf1a8..a4906643d3d35b 100644 --- a/test/parallel/test-http-response-readable.js +++ b/test/parallel/test-http-response-readable.js @@ -10,9 +10,10 @@ const testServer = new http.Server(function(req, res) { testServer.listen(0, function() { http.get({ port: this.address().port }, function(res) { - assert.equal(res.readable, true, 'res.readable initially true'); + assert.strictEqual(res.readable, true, 'res.readable initially true'); res.on('end', function() { - assert.equal(res.readable, false, 'res.readable set to false after end'); + assert.strictEqual(res.readable, false, + 'res.readable set to false after end'); testServer.close(); }); res.resume(); diff --git a/test/parallel/test-http-response-status-message.js b/test/parallel/test-http-response-status-message.js index d17dfb24c6b4c8..95859634ac394a 100644 --- a/test/parallel/test-http-response-status-message.js +++ b/test/parallel/test-http-response-status-message.js @@ -47,7 +47,7 @@ const runTest = function(testCaseIndex) { }, function(response) { console.log('client: expected status message: ' + testCase.statusMessage); console.log('client: actual status message: ' + response.statusMessage); - assert.equal(testCase.statusMessage, response.statusMessage); + assert.strictEqual(testCase.statusMessage, response.statusMessage); response.on('end', function() { testsComplete++; @@ -66,5 +66,5 @@ const runTest = function(testCaseIndex) { server.listen(0, function() { runTest(0); }); process.on('exit', function() { - assert.equal(testCases.length, testsComplete); + assert.strictEqual(testCases.length, testsComplete); }); diff --git a/test/parallel/test-http-server-client-error.js b/test/parallel/test-http-server-client-error.js index 260963dc24daaa..88c224f8374145 100644 --- a/test/parallel/test-http-server-client-error.js +++ b/test/parallel/test-http-server-client-error.js @@ -26,13 +26,13 @@ server.listen(0, function() { chunks += chunk; }); client.once('end', function() { - assert.equal(chunks, 'HTTP/1.1 400 Bad Request\r\n\r\n'); + assert.strictEqual(chunks, 'HTTP/1.1 400 Bad Request\r\n\r\n'); }); } // Normal request http.get({ port: this.address().port, path: '/' }, function(res) { - assert.equal(res.statusCode, 200); + assert.strictEqual(res.statusCode, 200); res.resume(); res.once('end', next); }); diff --git a/test/parallel/test-http-server-multiheaders.js b/test/parallel/test-http-server-multiheaders.js index 189ab0657bacb0..a89d45fd6c6195 100644 --- a/test/parallel/test-http-server-multiheaders.js +++ b/test/parallel/test-http-server-multiheaders.js @@ -8,15 +8,16 @@ const assert = require('assert'); const http = require('http'); const srv = http.createServer(function(req, res) { - assert.equal(req.headers.accept, 'abc, def, ghijklmnopqrst'); - assert.equal(req.headers.host, 'foo'); - assert.equal(req.headers['www-authenticate'], 'foo, bar, baz'); - assert.equal(req.headers['proxy-authenticate'], 'foo, bar, baz'); - assert.equal(req.headers['x-foo'], 'bingo'); - assert.equal(req.headers['x-bar'], 'banjo, bango'); - assert.equal(req.headers['sec-websocket-protocol'], 'chat, share'); - assert.equal(req.headers['sec-websocket-extensions'], 'foo; 1, bar; 2, baz'); - assert.equal(req.headers['constructor'], 'foo, bar, baz'); + assert.strictEqual(req.headers.accept, 'abc, def, ghijklmnopqrst'); + assert.strictEqual(req.headers.host, 'foo'); + assert.strictEqual(req.headers['www-authenticate'], 'foo, bar, baz'); + assert.strictEqual(req.headers['proxy-authenticate'], 'foo, bar, baz'); + assert.strictEqual(req.headers['x-foo'], 'bingo'); + assert.strictEqual(req.headers['x-bar'], 'banjo, bango'); + assert.strictEqual(req.headers['sec-websocket-protocol'], 'chat, share'); + assert.strictEqual(req.headers['sec-websocket-extensions'], + 'foo; 1, bar; 2, baz'); + assert.strictEqual(req.headers['constructor'], 'foo, bar, baz'); res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('EOF'); diff --git a/test/parallel/test-http-server-multiheaders2.js b/test/parallel/test-http-server-multiheaders2.js index 82cc9960329a11..53e68e6f0d3e74 100644 --- a/test/parallel/test-http-server-multiheaders2.js +++ b/test/parallel/test-http-server-multiheaders2.js @@ -50,12 +50,12 @@ const multipleForbidden = [ const srv = http.createServer(function(req, res) { multipleForbidden.forEach(function(header) { - assert.equal(req.headers[header.toLowerCase()], - 'foo', 'header parsed incorrectly: ' + header); + assert.strictEqual(req.headers[header.toLowerCase()], + 'foo', 'header parsed incorrectly: ' + header); }); multipleAllowed.forEach(function(header) { - assert.equal(req.headers[header.toLowerCase()], - 'foo, bar', 'header parsed incorrectly: ' + header); + assert.strictEqual(req.headers[header.toLowerCase()], + 'foo, bar', 'header parsed incorrectly: ' + header); }); res.writeHead(200, {'Content-Type': 'text/plain'}); diff --git a/test/parallel/test-http-server-reject-chunked-with-content-length.js b/test/parallel/test-http-server-reject-chunked-with-content-length.js index d8697cd38cde72..b158fda75c5846 100644 --- a/test/parallel/test-http-server-reject-chunked-with-content-length.js +++ b/test/parallel/test-http-server-reject-chunked-with-content-length.js @@ -14,7 +14,7 @@ const server = http.createServer((req, res) => { }); server.on('clientError', common.mustCall((err) => { assert(/^Parse Error/.test(err.message)); - assert.equal(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); + assert.strictEqual(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); server.close(); })); server.listen(0, () => { diff --git a/test/parallel/test-http-server-reject-cr-no-lf.js b/test/parallel/test-http-server-reject-cr-no-lf.js index 81a7208d982334..73508cf08e9b7a 100644 --- a/test/parallel/test-http-server-reject-cr-no-lf.js +++ b/test/parallel/test-http-server-reject-cr-no-lf.js @@ -16,7 +16,7 @@ const server = http.createServer((req, res) => { }); server.on('clientError', common.mustCall((err) => { assert(/^Parse Error/.test(err.message)); - assert.equal(err.code, 'HPE_LF_EXPECTED'); + assert.strictEqual(err.code, 'HPE_LF_EXPECTED'); server.close(); })); server.listen(0, () => { diff --git a/test/parallel/test-http-server-unconsume.js b/test/parallel/test-http-server-unconsume.js index fca2691aacc25d..9f80e9ea82de48 100644 --- a/test/parallel/test-http-server-unconsume.js +++ b/test/parallel/test-http-server-unconsume.js @@ -26,5 +26,5 @@ const server = http.createServer(function(req, res) { }); process.on('exit', function() { - assert.equal(received, 'hello world'); + assert.strictEqual(received, 'hello world'); }); diff --git a/test/parallel/test-http-set-cookies.js b/test/parallel/test-http-set-cookies.js index cb06352b3ca85d..7be28b04034fb0 100644 --- a/test/parallel/test-http-set-cookies.js +++ b/test/parallel/test-http-set-cookies.js @@ -27,7 +27,7 @@ server.on('listening', function() { // set-cookie headers are always return in an array. // even if there is only one. assert.deepStrictEqual(['A'], res.headers['set-cookie']); - assert.equal('text/plain', res.headers['content-type']); + assert.strictEqual('text/plain', res.headers['content-type']); res.on('data', function(chunk) { console.log(chunk.toString()); @@ -44,7 +44,7 @@ server.on('listening', function() { http.get({ port: this.address().port, path: '/two' }, function(res) { assert.deepStrictEqual(['A', 'B'], res.headers['set-cookie']); - assert.equal('text/plain', res.headers['content-type']); + assert.strictEqual('text/plain', res.headers['content-type']); res.on('data', function(chunk) { console.log(chunk.toString()); @@ -60,5 +60,5 @@ server.on('listening', function() { }); process.on('exit', function() { - assert.equal(2, nresponses); + assert.strictEqual(2, nresponses); }); diff --git a/test/parallel/test-http-set-timeout-server.js b/test/parallel/test-http-set-timeout-server.js index 7a2447763e4cf9..097aeb260bdc5e 100644 --- a/test/parallel/test-http-set-timeout-server.js +++ b/test/parallel/test-http-set-timeout-server.js @@ -118,7 +118,7 @@ test(function serverRequestNotTimeoutAfterEnd(cb) { test(function serverResponseTimeoutWithPipeline(cb) { let caughtTimeout = ''; process.on('exit', function() { - assert.equal(caughtTimeout, '/2'); + assert.strictEqual(caughtTimeout, '/2'); }); const server = http.createServer(function(req, res) { const s = res.setTimeout(50, function() { diff --git a/test/parallel/test-http-should-keep-alive.js b/test/parallel/test-http-should-keep-alive.js index 77a3c3922a20f0..190c8c8d8843ad 100644 --- a/test/parallel/test-http-should-keep-alive.js +++ b/test/parallel/test-http-should-keep-alive.js @@ -30,8 +30,8 @@ const server = net.createServer(function(socket) { }).listen(0, function() { function makeRequest() { const req = http.get({port: server.address().port}, function(res) { - assert.equal(req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses], - SERVER_RESPONSES[responses] + ' should ' + + assert.strictEqual(req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses], + SERVER_RESPONSES[responses] + ' should ' + (SHOULD_KEEP_ALIVE[responses] ? '' : 'not ') + 'Keep-Alive'); ++responses; @@ -48,6 +48,6 @@ const server = net.createServer(function(socket) { }); process.on('exit', function() { - assert.equal(requests, SERVER_RESPONSES.length); - assert.equal(responses, SHOULD_KEEP_ALIVE.length); + assert.strictEqual(requests, SERVER_RESPONSES.length); + assert.strictEqual(responses, SHOULD_KEEP_ALIVE.length); }); diff --git a/test/parallel/test-http-status-code.js b/test/parallel/test-http-status-code.js index b5060109bf4985..111b5db16daecb 100644 --- a/test/parallel/test-http-status-code.js +++ b/test/parallel/test-http-status-code.js @@ -14,7 +14,7 @@ const s = http.createServer(function(req, res) { const t = tests[testIdx]; res.writeHead(t, {'Content-Type': 'text/plain'}); console.log('--\nserver: statusCode after writeHead: ' + res.statusCode); - assert.equal(res.statusCode, t); + assert.strictEqual(res.statusCode, t); res.end('hello world\n'); }); @@ -30,7 +30,7 @@ function nextTest() { http.get({ port: s.address().port }, function(response) { console.log('client: expected status: ' + test); console.log('client: statusCode: ' + response.statusCode); - assert.equal(response.statusCode, test); + assert.strictEqual(response.statusCode, test); response.on('end', function() { testsComplete++; testIdx += 1; @@ -42,5 +42,5 @@ function nextTest() { process.on('exit', function() { - assert.equal(5, testsComplete); + assert.strictEqual(5, testsComplete); }); diff --git a/test/parallel/test-http-status-message.js b/test/parallel/test-http-status-message.js index 668b02ee0780b4..54c683212b8ff1 100644 --- a/test/parallel/test-http-status-message.js +++ b/test/parallel/test-http-status-message.js @@ -23,7 +23,7 @@ function test() { }); client.on('end', function() { const head = Buffer.concat(bufs).toString('latin1').split('\r\n')[0]; - assert.equal('HTTP/1.1 200 Custom Message', head); + assert.strictEqual('HTTP/1.1 200 Custom Message', head); console.log('ok'); s.close(); }); diff --git a/test/parallel/test-http-timeout-overflow.js b/test/parallel/test-http-timeout-overflow.js index 39b4550d57e529..755859ddc9992d 100644 --- a/test/parallel/test-http-timeout-overflow.js +++ b/test/parallel/test-http-timeout-overflow.js @@ -37,6 +37,6 @@ server.listen(0, function() { }); process.once('exit', function() { - assert.equal(clientRequests, 1); - assert.equal(serverRequests, 1); + assert.strictEqual(clientRequests, 1); + assert.strictEqual(serverRequests, 1); }); diff --git a/test/parallel/test-http-upgrade-advertise.js b/test/parallel/test-http-upgrade-advertise.js index 3deb71fbea1b75..99a3e8fd353015 100644 --- a/test/parallel/test-http-upgrade-advertise.js +++ b/test/parallel/test-http-upgrade-advertise.js @@ -18,7 +18,7 @@ function fire() { const test = tests.shift(); const done = common.mustCall(function done(result) { - assert.equal(result, test.expected); + assert.strictEqual(result, test.expected); fire(); }); diff --git a/test/parallel/test-http-upgrade-agent.js b/test/parallel/test-http-upgrade-agent.js index a196ba904905a3..e0e1c6d1f3fb6d 100644 --- a/test/parallel/test-http-upgrade-agent.js +++ b/test/parallel/test-http-upgrade-agent.js @@ -47,7 +47,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() { }); socket.on('close', common.mustCall(function() { - assert.equal(recvData, 'nurtzo'); + assert.strictEqual(recvData.toString(), 'nurtzo'); })); console.log(res.headers); diff --git a/test/parallel/test-http-upgrade-server.js b/test/parallel/test-http-upgrade-server.js index 221263e98ce9cd..b7335b49e83c5f 100644 --- a/test/parallel/test-http-upgrade-server.js +++ b/test/parallel/test-http-upgrade-server.js @@ -76,20 +76,20 @@ function test_upgrade_with_listener() { conn.on('data', function(data) { state++; - assert.equal('string', typeof data); + assert.strictEqual('string', typeof data); if (state === 1) { - assert.equal('HTTP/1.1 101', data.substr(0, 12)); - assert.equal('WjN}|M(6', request_upgradeHead.toString('utf8')); + assert.strictEqual('HTTP/1.1 101', data.substr(0, 12)); + assert.strictEqual('WjN}|M(6', request_upgradeHead.toString('utf8')); conn.write('test', 'utf8'); } else if (state === 2) { - assert.equal('test', data); + assert.strictEqual('test', data); conn.write('kill', 'utf8'); } }); conn.on('end', function() { - assert.equal(2, state); + assert.strictEqual(2, state); conn.end(); server.removeAllListeners('upgrade'); test_upgrade_no_listener(); @@ -135,8 +135,8 @@ function test_standard_http() { }); conn.once('data', function(data) { - assert.equal('string', typeof data); - assert.equal('HTTP/1.1 200', data.substr(0, 12)); + assert.strictEqual('string', typeof data); + assert.strictEqual('HTTP/1.1 200', data.substr(0, 12)); conn.end(); }); @@ -158,7 +158,7 @@ server.listen(0, function() { Fin. -----------------------------------------------*/ process.on('exit', function() { - assert.equal(3, requests_recv); - assert.equal(3, requests_sent); + assert.strictEqual(3, requests_recv); + assert.strictEqual(3, requests_sent); assert.ok(test_upgrade_no_listener_ended); }); diff --git a/test/parallel/test-http-upgrade-server2.js b/test/parallel/test-http-upgrade-server2.js index c64b2e843637af..3ff33a9c794c25 100644 --- a/test/parallel/test-http-upgrade-server2.js +++ b/test/parallel/test-http-upgrade-server2.js @@ -15,7 +15,7 @@ server.on('upgrade', function(req, socket, upgradeHead) { }); process.on('uncaughtException', common.mustCall(function(e) { - assert.equal('upgrade error', e.message); + assert.strictEqual('upgrade error', e.message); process.exit(0); })); diff --git a/test/parallel/test-http-write-callbacks.js b/test/parallel/test-http-write-callbacks.js index 3783dc305e39a7..03250a0030ceff 100644 --- a/test/parallel/test-http-write-callbacks.js +++ b/test/parallel/test-http-write-callbacks.js @@ -14,9 +14,9 @@ const clientIncomingExpect = 'asdffoobar'; process.on('exit', function() { assert(serverEndCb); - assert.equal(serverIncoming, serverIncomingExpect); + assert.strictEqual(serverIncoming, serverIncomingExpect); assert(clientEndCb); - assert.equal(clientIncoming, clientIncomingExpect); + assert.strictEqual(clientIncoming, clientIncomingExpect); console.log('ok'); }); @@ -28,7 +28,7 @@ const server = http.createServer(function(req, res) { server.on('checkContinue', function(req, res) { server.close(); - assert.equal(req.method, 'PUT'); + assert.strictEqual(req.method, 'PUT'); res.writeContinue(function() { // continue has been written req.on('end', function() { diff --git a/test/parallel/test-http-write-empty-string.js b/test/parallel/test-http-write-empty-string.js index 69463fb3a50852..81ebc61eef2af4 100644 --- a/test/parallel/test-http-write-empty-string.js +++ b/test/parallel/test-http-write-empty-string.js @@ -21,7 +21,7 @@ server.listen(0, common.mustCall(function() { http.get({ port: this.address().port }, common.mustCall(function(res) { let response = ''; - assert.equal(200, res.statusCode); + assert.strictEqual(200, res.statusCode); res.setEncoding('ascii'); res.on('data', function(chunk) { response += chunk; diff --git a/test/parallel/test-http-write-head.js b/test/parallel/test-http-write-head.js index 12f5e00b0db493..a0e4a7fde3594f 100644 --- a/test/parallel/test-http-write-head.js +++ b/test/parallel/test-http-write-head.js @@ -25,7 +25,8 @@ const s = http.createServer(function(req, res) { res.setHeader('foo', undefined); } catch (e) { assert.ok(e instanceof Error); - assert.equal(e.message, '"value" required in setHeader("foo", value)'); + assert.strictEqual(e.message, + '"value" required in setHeader("foo", value)'); threw = true; } assert.ok(threw, 'Undefined value should throw'); @@ -39,7 +40,7 @@ s.listen(0, runTest); function runTest() { http.get({ port: this.address().port }, function(response) { response.on('end', function() { - assert.equal(response.headers['test'], '2'); + assert.strictEqual(response.headers['test'], '2'); assert.notStrictEqual(response.rawHeaders.indexOf('Test'), -1); s.close(); }); diff --git a/test/parallel/test-http-zero-length-write.js b/test/parallel/test-http-zero-length-write.js index 63446e460471e4..11db6b1aa17f45 100644 --- a/test/parallel/test-http-zero-length-write.js +++ b/test/parallel/test-http-zero-length-write.js @@ -47,7 +47,7 @@ const server = http.createServer(function(req, res) { actual += c; }); req.on('end', function() { - assert.equal(actual, expect); + assert.strictEqual(actual, expect); getSrc().pipe(res); }); server.close(); @@ -62,7 +62,7 @@ server.listen(0, function() { actual += c; }); res.on('end', function() { - assert.equal(actual, expect); + assert.strictEqual(actual, expect); }); }); getSrc().pipe(req); diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js index a80a2b8856558b..1178c745e1e12a 100644 --- a/test/parallel/test-http.js +++ b/test/parallel/test-http.js @@ -36,7 +36,7 @@ const server = http.Server(function(req, res) { }); req.resume(); - //assert.equal('127.0.0.1', res.connection.remoteAddress); + //assert.strictEqual('127.0.0.1', res.connection.remoteAddress); }); server.listen(0); diff --git a/test/parallel/test-https-agent-disable-session-reuse.js b/test/parallel/test-https-agent-disable-session-reuse.js index 8e694a61b72a03..7cca9c713ae011 100644 --- a/test/parallel/test-https-agent-disable-session-reuse.js +++ b/test/parallel/test-https-agent-disable-session-reuse.js @@ -52,8 +52,8 @@ const server = https.createServer(options, function(req, res) { }); process.on('exit', function() { - assert.equal(serverRequests, TOTAL_REQS); - assert.equal(clientSessions.length, TOTAL_REQS); + assert.strictEqual(serverRequests, TOTAL_REQS); + assert.strictEqual(clientSessions.length, TOTAL_REQS); assert.notStrictEqual(clientSessions[0].toString('hex'), clientSessions[1].toString('hex')); }); diff --git a/test/parallel/test-https-agent-sni.js b/test/parallel/test-https-agent-sni.js index ca15dc3db3a88d..9bfbe3d5c6525d 100644 --- a/test/parallel/test-https-agent-sni.js +++ b/test/parallel/test-https-agent-sni.js @@ -31,7 +31,7 @@ server.listen(0, function() { function expectResponse(id) { return common.mustCall(function(res) { res.resume(); - assert.equal(res.headers['x-sni'], 'sni.' + id); + assert.strictEqual(res.headers['x-sni'], 'sni.' + id); }); } diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js index 1f4f6ff748b410..caaa7522cef57b 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -21,8 +21,8 @@ const options = { }; const server = https.createServer(options, common.mustCall(function(req, res) { - assert.equal('GET', req.method); - assert.equal('/foo?bar', req.url); + assert.strictEqual('GET', req.method); + assert.strictEqual('/foo?bar', req.url); res.writeHead(200, {'Content-Type': 'text/plain'}); res.write('hello\n'); res.end(); diff --git a/test/parallel/test-https-drain.js b/test/parallel/test-https-drain.js index 0b18795078fd1f..8e85ca70b97c47 100644 --- a/test/parallel/test-https-drain.js +++ b/test/parallel/test-https-drain.js @@ -71,5 +71,5 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(sent, received); + assert.strictEqual(sent, received); }); diff --git a/test/parallel/test-https-eof-for-eom.js b/test/parallel/test-https-eof-for-eom.js index d5e896c7695cfd..cb48f71e51a226 100644 --- a/test/parallel/test-https-eof-for-eom.js +++ b/test/parallel/test-https-eof-for-eom.js @@ -57,7 +57,7 @@ server.listen(0, common.mustCall(function() { server.close(); console.log('3) Client got response headers.'); - assert.equal('gws', res.headers.server); + assert.strictEqual('gws', res.headers.server); res.setEncoding('utf8'); res.on('data', function(s) { diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js index f1b8d442e27893..5a9b8eb832cae3 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -66,7 +66,7 @@ server.listen(0, function() { client.stdout.on('data', function(data) { const message = data.toString(); const contents = message.split(CRLF + CRLF).pop(); - assert.equal(body, contents); + assert.strictEqual(body, contents); server.close(); }); diff --git a/test/parallel/test-https-host-headers.js b/test/parallel/test-https-host-headers.js index 190f15f29a8078..ce18522fc5b5f2 100644 --- a/test/parallel/test-https-host-headers.js +++ b/test/parallel/test-https-host-headers.js @@ -18,10 +18,10 @@ const httpsServer = https.createServer(options, reqHandler); function reqHandler(req, res) { console.log('Got request: ' + req.headers.host + ' ' + req.url); if (req.url === '/setHostFalse5') { - assert.equal(req.headers.host, undefined); + assert.strictEqual(req.headers.host, undefined); } else { - assert.equal(req.headers.host, `localhost:${this.address().port}`, - 'Wrong host header for req[' + req.url + ']: ' + + assert.strictEqual(req.headers.host, `localhost:${this.address().port}`, + 'Wrong host header for req[' + req.url + ']: ' + req.headers.host); } res.writeHead(200, {}); diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js index 78583b38ecf1cf..1c796f5843c63c 100644 --- a/test/parallel/test-https-localaddress.js +++ b/test/parallel/test-https-localaddress.js @@ -21,7 +21,7 @@ const options = { const server = https.createServer(options, function(req, res) { console.log('Connect from: ' + req.connection.remoteAddress); - assert.equal('127.0.0.2', req.connection.remoteAddress); + assert.strictEqual('127.0.0.2', req.connection.remoteAddress); req.on('end', function() { res.writeHead(200, { 'Content-Type': 'text/plain' }); diff --git a/test/parallel/test-https-pfx.js b/test/parallel/test-https-pfx.js index c30bbc0848d137..0e3a2ba3cd2663 100644 --- a/test/parallel/test-https-pfx.js +++ b/test/parallel/test-https-pfx.js @@ -22,8 +22,9 @@ const options = { }; const server = https.createServer(options, function(req, res) { - assert.equal(req.socket.authorized, false); // not a client cert - assert.equal(req.socket.authorizationError, 'DEPTH_ZERO_SELF_SIGNED_CERT'); + assert.strictEqual(req.socket.authorized, false); // not a client cert + assert.strictEqual(req.socket.authorizationError, + 'DEPTH_ZERO_SELF_SIGNED_CERT'); res.writeHead(200); res.end('OK'); }); diff --git a/test/parallel/test-https-set-timeout-server.js b/test/parallel/test-https-set-timeout-server.js index 4cf999667d7384..d6db87e61cc1d3 100644 --- a/test/parallel/test-https-set-timeout-server.js +++ b/test/parallel/test-https-set-timeout-server.js @@ -117,7 +117,7 @@ test(function serverRequestNotTimeoutAfterEnd(cb) { test(function serverResponseTimeoutWithPipeline(cb) { let caughtTimeout = ''; process.on('exit', function() { - assert.equal(caughtTimeout, '/2'); + assert.strictEqual(caughtTimeout, '/2'); }); const server = https.createServer(serverOptions, function(req, res) { res.setTimeout(50, function() { diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js index 0040b9dd054058..8616e6c710c463 100644 --- a/test/parallel/test-https-simple.js +++ b/test/parallel/test-https-simple.js @@ -52,7 +52,7 @@ server.listen(0, function() { }); res.on('end', function() { - assert.equal(responseBody, body); + assert.strictEqual(responseBody, body); testSucceeded(); }); }); @@ -82,11 +82,11 @@ server.listen(0, function() { checkCertReq.end(); checkCertReq.on('error', function(e) { - assert.equal(e.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'); + assert.strictEqual(e.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'); testSucceeded(); }); }); process.on('exit', function() { - assert.equal(successful, tests); + assert.strictEqual(successful, tests); }); diff --git a/test/parallel/test-internal-modules-expose.js b/test/parallel/test-internal-modules-expose.js index dd3a7f7a3cd0b7..02ddfd87c363fc 100644 --- a/test/parallel/test-internal-modules-expose.js +++ b/test/parallel/test-internal-modules-expose.js @@ -4,4 +4,4 @@ require('../common'); const assert = require('assert'); -assert.equal(typeof require('internal/freelist').FreeList, 'function'); +assert.strictEqual(typeof require('internal/freelist').FreeList, 'function'); diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index de1fbed7b56aff..98810a39335acc 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -50,8 +50,8 @@ test(function(parent, port) { // it's really annoying when tests leave orphans! parent.kill(); parent.on('exit', function() { - assert.equal(s, 'hello from worker\n'); - assert.equal(res.statusCode, 200); + assert.strictEqual(s, 'hello from worker\n'); + assert.strictEqual(res.statusCode, 200); console.log('ok'); ok = true; }); diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js index 2ac4d83dba6691..36e4df28897383 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -52,8 +52,8 @@ function test() { parent.kill(); } catch (e) {} - assert.equal(s, 'hello from child\n'); - assert.equal(res.statusCode, 200); + assert.strictEqual(s, 'hello from child\n'); + assert.strictEqual(res.statusCode, 200); }); }); } diff --git a/test/parallel/test-listen-fd-detached.js b/test/parallel/test-listen-fd-detached.js index 1194d001610fce..ec9d039e96e3f2 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -52,8 +52,8 @@ function test() { parent.kill(); } catch (e) {} - assert.equal(s, 'hello from child\n'); - assert.equal(res.statusCode, 200); + assert.strictEqual(s, 'hello from child\n'); + assert.strictEqual(res.statusCode, 200); }); }); } diff --git a/test/parallel/test-listen-fd-server.js b/test/parallel/test-listen-fd-server.js index 60aa8717a8c24e..5a1ffbb989cf8d 100644 --- a/test/parallel/test-listen-fd-server.js +++ b/test/parallel/test-listen-fd-server.js @@ -38,8 +38,8 @@ test(function(child, port) { res.on('end', function() { child.kill(); child.on('exit', function() { - assert.equal(s, 'hello from child\n'); - assert.equal(res.statusCode, 200); + assert.strictEqual(s, 'hello from child\n'); + assert.strictEqual(res.statusCode, 200); console.log('ok'); ok = true; }); diff --git a/test/parallel/test-memory-usage-emfile.js b/test/parallel/test-memory-usage-emfile.js index 09ab270b70fa21..c5345079a7f47b 100644 --- a/test/parallel/test-memory-usage-emfile.js +++ b/test/parallel/test-memory-usage-emfile.js @@ -10,4 +10,4 @@ while (files.length < 256) files.push(fs.openSync(__filename, 'r')); const r = process.memoryUsage(); -assert.equal(true, r['rss'] > 0); +assert.strictEqual(true, r['rss'] > 0); diff --git a/test/parallel/test-microtask-queue-integration-domain.js b/test/parallel/test-microtask-queue-integration-domain.js index 7110af7648ae8a..df90b6d3a372da 100644 --- a/test/parallel/test-microtask-queue-integration-domain.js +++ b/test/parallel/test-microtask-queue-integration-domain.js @@ -19,7 +19,7 @@ let expected = 0; let done = 0; process.on('exit', function() { - assert.equal(done, expected); + assert.strictEqual(done, expected); }); function test(scheduleMicrotask) { diff --git a/test/parallel/test-microtask-queue-integration.js b/test/parallel/test-microtask-queue-integration.js index d212bbae96b001..22704ab4a51d49 100644 --- a/test/parallel/test-microtask-queue-integration.js +++ b/test/parallel/test-microtask-queue-integration.js @@ -12,7 +12,7 @@ let expected = 0; let done = 0; process.on('exit', function() { - assert.equal(done, expected); + assert.strictEqual(done, expected); }); function test(scheduleMicrotask) { diff --git a/test/parallel/test-microtask-queue-run-domain.js b/test/parallel/test-microtask-queue-run-domain.js index 7d34ec829a003c..8ce2f6cd992648 100644 --- a/test/parallel/test-microtask-queue-run-domain.js +++ b/test/parallel/test-microtask-queue-run-domain.js @@ -16,7 +16,7 @@ function enqueueMicrotask(fn) { let done = 0; process.on('exit', function() { - assert.equal(done, 2); + assert.strictEqual(done, 2); }); // no nextTick, microtask diff --git a/test/parallel/test-microtask-queue-run-immediate-domain.js b/test/parallel/test-microtask-queue-run-immediate-domain.js index e09087f74e32a9..8c4d4d40d46d6b 100644 --- a/test/parallel/test-microtask-queue-run-immediate-domain.js +++ b/test/parallel/test-microtask-queue-run-immediate-domain.js @@ -16,7 +16,7 @@ function enqueueMicrotask(fn) { let done = 0; process.on('exit', function() { - assert.equal(done, 2); + assert.strictEqual(done, 2); }); // no nextTick, microtask diff --git a/test/parallel/test-microtask-queue-run-immediate.js b/test/parallel/test-microtask-queue-run-immediate.js index c5ed6c6dcbc1ae..9fee54b2d741cf 100644 --- a/test/parallel/test-microtask-queue-run-immediate.js +++ b/test/parallel/test-microtask-queue-run-immediate.js @@ -9,7 +9,7 @@ function enqueueMicrotask(fn) { let done = 0; process.on('exit', function() { - assert.equal(done, 2); + assert.strictEqual(done, 2); }); // no nextTick, microtask diff --git a/test/parallel/test-microtask-queue-run.js b/test/parallel/test-microtask-queue-run.js index 71e1fbedbaecbd..1a8f8e2ba32bc0 100644 --- a/test/parallel/test-microtask-queue-run.js +++ b/test/parallel/test-microtask-queue-run.js @@ -9,7 +9,7 @@ function enqueueMicrotask(fn) { let done = 0; process.on('exit', function() { - assert.equal(done, 2); + assert.strictEqual(done, 2); }); // no nextTick, microtask diff --git a/test/parallel/test-net-better-error-messages-path.js b/test/parallel/test-net-better-error-messages-path.js index 2f821ef5d703be..7cdc14b9bd4333 100644 --- a/test/parallel/test-net-better-error-messages-path.js +++ b/test/parallel/test-net-better-error-messages-path.js @@ -8,6 +8,6 @@ const c = net.connect(fp); c.on('connect', common.fail); c.on('error', common.mustCall(function(e) { - assert.equal(e.code, 'ENOENT'); - assert.equal(e.message, 'connect ENOENT ' + fp); + assert.strictEqual(e.code, 'ENOENT'); + assert.strictEqual(e.message, 'connect ENOENT ' + fp); })); diff --git a/test/parallel/test-net-binary.js b/test/parallel/test-net-binary.js index bcc554ac4024f6..0c5cac1c37290b 100644 --- a/test/parallel/test-net-binary.js +++ b/test/parallel/test-net-binary.js @@ -55,7 +55,7 @@ echoServer.on('listening', function() { }); process.on('exit', function() { - assert.equal(2 * 256, recv.length); + assert.strictEqual(2 * 256, recv.length); const a = recv.split(''); diff --git a/test/parallel/test-net-bind-twice.js b/test/parallel/test-net-bind-twice.js index 17fdc90cb3742b..c10b4019e4b95f 100644 --- a/test/parallel/test-net-bind-twice.js +++ b/test/parallel/test-net-bind-twice.js @@ -9,7 +9,7 @@ server1.listen(0, '127.0.0.1', common.mustCall(function() { server2.listen(this.address().port, '127.0.0.1', common.fail); server2.on('error', common.mustCall(function(e) { - assert.equal(e.code, 'EADDRINUSE'); + assert.strictEqual(e.code, 'EADDRINUSE'); server1.close(); })); })); diff --git a/test/parallel/test-net-bytes-read.js b/test/parallel/test-net-bytes-read.js index 52fb577b9e7830..aed14fe279eb5b 100644 --- a/test/parallel/test-net-bytes-read.js +++ b/test/parallel/test-net-bytes-read.js @@ -23,14 +23,14 @@ const server = net.createServer((socket) => { }); socket.on('end', common.mustCall(() => { - assert.equal(socket.bytesRead, prev); - assert.equal(big.length, prev); + assert.strictEqual(socket.bytesRead, prev); + assert.strictEqual(big.length, prev); })); socket.on('close', common.mustCall(() => { assert(!socket._handle); - assert.equal(socket.bytesRead, prev); - assert.equal(big.length, prev); + assert.strictEqual(socket.bytesRead, prev); + assert.strictEqual(big.length, prev); })); }); socket.end(); diff --git a/test/parallel/test-net-bytes-stats.js b/test/parallel/test-net-bytes-stats.js index 4cc6eee8373e86..33e089da50880a 100644 --- a/test/parallel/test-net-bytes-stats.js +++ b/test/parallel/test-net-bytes-stats.js @@ -52,6 +52,6 @@ tcp.listen(0, function doTest() { }); process.on('exit', function() { - assert.equal(bytesRead, 12); - assert.equal(bytesWritten, 12); + assert.strictEqual(bytesRead, 12); + assert.strictEqual(bytesWritten, 12); }); diff --git a/test/parallel/test-net-connect-buffer.js b/test/parallel/test-net-connect-buffer.js index c43ee1abd0e305..1e296675879130 100644 --- a/test/parallel/test-net-connect-buffer.js +++ b/test/parallel/test-net-connect-buffer.js @@ -18,7 +18,7 @@ const tcp = net.Server(function(s) { s.on('end', function() { console.error('SERVER: end', buf.toString()); - assert.equal(buf, "L'État, c'est moi"); + assert.strictEqual(buf, "L'État, c'est moi"); console.log('tcp socket disconnect'); s.end(); }); @@ -41,7 +41,7 @@ tcp.listen(0, function() { console.log('connecting = ' + socket.connecting); - assert.equal('opening', socket.readyState); + assert.strictEqual('opening', socket.readyState); // Make sure that anything besides a buffer or a string throws. [null, @@ -76,18 +76,18 @@ tcp.listen(0, function() { dataWritten = true; assert.ok(connectHappened); console.error('socket.bytesWritten', socket.bytesWritten); - //assert.equal(socket.bytesWritten, Buffer.from(a + b).length); + //assert.strictEqual(socket.bytesWritten, Buffer.from(a + b).length); console.error('data written'); }); console.error('socket.bytesWritten', socket.bytesWritten); console.error('write returned', r); - assert.equal(socket.bytesWritten, Buffer.from(a).length); + assert.strictEqual(socket.bytesWritten, Buffer.from(a).length); - assert.equal(false, r); + assert.strictEqual(false, r); socket.end(b); - assert.equal('opening', socket.readyState); + assert.strictEqual('opening', socket.readyState); }); process.on('exit', function() { diff --git a/test/parallel/test-net-connect-local-error.js b/test/parallel/test-net-connect-local-error.js index 8f1784565d38ee..23bfacde336f36 100644 --- a/test/parallel/test-net-connect-local-error.js +++ b/test/parallel/test-net-connect-local-error.js @@ -10,6 +10,6 @@ const client = net.connect({ }); client.on('error', common.mustCall(function onError(err) { - assert.equal(err.localPort, common.PORT); - assert.equal(err.localAddress, common.localhostIPv4); + assert.strictEqual(err.localPort, common.PORT); + assert.strictEqual(err.localAddress, common.localhostIPv4); })); diff --git a/test/parallel/test-net-create-connection.js b/test/parallel/test-net-create-connection.js index a5d8cd101d974d..dc5981ecd20221 100644 --- a/test/parallel/test-net-create-connection.js +++ b/test/parallel/test-net-create-connection.js @@ -102,5 +102,5 @@ server.on('close', function() { }); process.on('exit', function() { - assert.equal(clientConnected, expectedConnections); + assert.strictEqual(clientConnected, expectedConnections); }); diff --git a/test/parallel/test-net-dns-error.js b/test/parallel/test-net-dns-error.js index aa288c5fde1ffa..5ca02313686589 100644 --- a/test/parallel/test-net-dns-error.js +++ b/test/parallel/test-net-dns-error.js @@ -12,11 +12,11 @@ function do_not_call() { const socket = net.connect(42, host, do_not_call); socket.on('error', common.mustCall(function(err) { - assert.equal(err.code, 'ENOTFOUND'); + assert.strictEqual(err.code, 'ENOTFOUND'); })); socket.on('lookup', function(err, ip, type) { assert(err instanceof Error); - assert.equal(err.code, 'ENOTFOUND'); - assert.equal(ip, undefined); - assert.equal(type, undefined); + assert.strictEqual(err.code, 'ENOTFOUND'); + assert.strictEqual(ip, undefined); + assert.strictEqual(type, undefined); }); diff --git a/test/parallel/test-net-dns-lookup.js b/test/parallel/test-net-dns-lookup.js index 8d9930f4b7a366..166029f31c482f 100644 --- a/test/parallel/test-net-dns-lookup.js +++ b/test/parallel/test-net-dns-lookup.js @@ -11,9 +11,9 @@ const server = net.createServer(function(client) { server.listen(0, '127.0.0.1', common.mustCall(function() { net.connect(this.address().port, 'localhost') .on('lookup', common.mustCall(function(err, ip, type, host) { - assert.equal(err, null); - assert.equal(ip, '127.0.0.1'); - assert.equal(type, '4'); - assert.equal(host, 'localhost'); + assert.strictEqual(err, null); + assert.strictEqual(ip, '127.0.0.1'); + assert.strictEqual(type, 4); + assert.strictEqual(host, 'localhost'); })); })); diff --git a/test/parallel/test-net-eaddrinuse.js b/test/parallel/test-net-eaddrinuse.js index 3d7ceb8d5e38f7..cf4293e8230875 100644 --- a/test/parallel/test-net-eaddrinuse.js +++ b/test/parallel/test-net-eaddrinuse.js @@ -9,7 +9,7 @@ const server2 = net.createServer(function(socket) { }); server1.listen(0, function() { server2.on('error', function(error) { - assert.equal(true, error.message.indexOf('EADDRINUSE') >= 0); + assert.strictEqual(true, error.message.indexOf('EADDRINUSE') >= 0); server1.close(); }); server2.listen(this.address().port); diff --git a/test/parallel/test-net-error-twice.js b/test/parallel/test-net-error-twice.js index 98a2c337559b06..3c25d1c98ed346 100644 --- a/test/parallel/test-net-error-twice.js +++ b/test/parallel/test-net-error-twice.js @@ -38,5 +38,5 @@ const srv = net.createServer(function onConnection(conn) { process.on('exit', function() { console.log(errs); - assert.equal(errs.length, 1); + assert.strictEqual(errs.length, 1); }); diff --git a/test/parallel/test-net-isip.js b/test/parallel/test-net-isip.js index 65d88523fe930e..626f29488b67ea 100644 --- a/test/parallel/test-net-isip.js +++ b/test/parallel/test-net-isip.js @@ -3,68 +3,70 @@ require('../common'); const assert = require('assert'); const net = require('net'); -assert.equal(net.isIP('127.0.0.1'), 4); -assert.equal(net.isIP('x127.0.0.1'), 0); -assert.equal(net.isIP('example.com'), 0); -assert.equal(net.isIP('0000:0000:0000:0000:0000:0000:0000:0000'), 6); -assert.equal(net.isIP('0000:0000:0000:0000:0000:0000:0000:0000::0000'), 0); -assert.equal(net.isIP('1050:0:0:0:5:600:300c:326b'), 6); -assert.equal(net.isIP('2001:252:0:1::2008:6'), 6); -assert.equal(net.isIP('2001:dead:beef:1::2008:6'), 6); -assert.equal(net.isIP('2001::'), 6); -assert.equal(net.isIP('2001:dead::'), 6); -assert.equal(net.isIP('2001:dead:beef::'), 6); -assert.equal(net.isIP('2001:dead:beef:1::'), 6); -assert.equal(net.isIP('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'), 6); -assert.equal(net.isIP(':2001:252:0:1::2008:6:'), 0); -assert.equal(net.isIP(':2001:252:0:1::2008:6'), 0); -assert.equal(net.isIP('2001:252:0:1::2008:6:'), 0); -assert.equal(net.isIP('2001:252::1::2008:6'), 0); -assert.equal(net.isIP('::2001:252:1:2008:6'), 6); -assert.equal(net.isIP('::2001:252:1:1.1.1.1'), 6); -assert.equal(net.isIP('::2001:252:1:255.255.255.255'), 6); -assert.equal(net.isIP('::2001:252:1:255.255.255.255.76'), 0); -assert.equal(net.isIP('::anything'), 0); -assert.equal(net.isIP('::1'), 6); -assert.equal(net.isIP('::'), 6); -assert.equal(net.isIP('0000:0000:0000:0000:0000:0000:12345:0000'), 0); -assert.equal(net.isIP('0'), 0); -assert.equal(net.isIP(), 0); -assert.equal(net.isIP(''), 0); -assert.equal(net.isIP(null), 0); -assert.equal(net.isIP(123), 0); -assert.equal(net.isIP(true), 0); -assert.equal(net.isIP({}), 0); -assert.equal(net.isIP({ toString: () => '::2001:252:1:255.255.255.255' }), 6); -assert.equal(net.isIP({ toString: () => '127.0.0.1' }), 4); -assert.equal(net.isIP({ toString: () => 'bla' }), 0); +assert.strictEqual(net.isIP('127.0.0.1'), 4); +assert.strictEqual(net.isIP('x127.0.0.1'), 0); +assert.strictEqual(net.isIP('example.com'), 0); +assert.strictEqual(net.isIP('0000:0000:0000:0000:0000:0000:0000:0000'), 6); +assert.strictEqual(net.isIP('0000:0000:0000:0000:0000:0000:0000:0000::0000'), + 0); +assert.strictEqual(net.isIP('1050:0:0:0:5:600:300c:326b'), 6); +assert.strictEqual(net.isIP('2001:252:0:1::2008:6'), 6); +assert.strictEqual(net.isIP('2001:dead:beef:1::2008:6'), 6); +assert.strictEqual(net.isIP('2001::'), 6); +assert.strictEqual(net.isIP('2001:dead::'), 6); +assert.strictEqual(net.isIP('2001:dead:beef::'), 6); +assert.strictEqual(net.isIP('2001:dead:beef:1::'), 6); +assert.strictEqual(net.isIP('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'), 6); +assert.strictEqual(net.isIP(':2001:252:0:1::2008:6:'), 0); +assert.strictEqual(net.isIP(':2001:252:0:1::2008:6'), 0); +assert.strictEqual(net.isIP('2001:252:0:1::2008:6:'), 0); +assert.strictEqual(net.isIP('2001:252::1::2008:6'), 0); +assert.strictEqual(net.isIP('::2001:252:1:2008:6'), 6); +assert.strictEqual(net.isIP('::2001:252:1:1.1.1.1'), 6); +assert.strictEqual(net.isIP('::2001:252:1:255.255.255.255'), 6); +assert.strictEqual(net.isIP('::2001:252:1:255.255.255.255.76'), 0); +assert.strictEqual(net.isIP('::anything'), 0); +assert.strictEqual(net.isIP('::1'), 6); +assert.strictEqual(net.isIP('::'), 6); +assert.strictEqual(net.isIP('0000:0000:0000:0000:0000:0000:12345:0000'), 0); +assert.strictEqual(net.isIP('0'), 0); +assert.strictEqual(net.isIP(), 0); +assert.strictEqual(net.isIP(''), 0); +assert.strictEqual(net.isIP(null), 0); +assert.strictEqual(net.isIP(123), 0); +assert.strictEqual(net.isIP(true), 0); +assert.strictEqual(net.isIP({}), 0); +assert.strictEqual(net.isIP({ toString: () => '::2001:252:1:255.255.255.255' }), + 6); +assert.strictEqual(net.isIP({ toString: () => '127.0.0.1' }), 4); +assert.strictEqual(net.isIP({ toString: () => 'bla' }), 0); -assert.equal(net.isIPv4('127.0.0.1'), true); -assert.equal(net.isIPv4('example.com'), false); -assert.equal(net.isIPv4('2001:252:0:1::2008:6'), false); -assert.equal(net.isIPv4(), false); -assert.equal(net.isIPv4(''), false); -assert.equal(net.isIPv4(null), false); -assert.equal(net.isIPv4(123), false); -assert.equal(net.isIPv4(true), false); -assert.equal(net.isIPv4({}), false); -assert.equal(net.isIPv4({ +assert.strictEqual(net.isIPv4('127.0.0.1'), true); +assert.strictEqual(net.isIPv4('example.com'), false); +assert.strictEqual(net.isIPv4('2001:252:0:1::2008:6'), false); +assert.strictEqual(net.isIPv4(), false); +assert.strictEqual(net.isIPv4(''), false); +assert.strictEqual(net.isIPv4(null), false); +assert.strictEqual(net.isIPv4(123), false); +assert.strictEqual(net.isIPv4(true), false); +assert.strictEqual(net.isIPv4({}), false); +assert.strictEqual(net.isIPv4({ toString: () => '::2001:252:1:255.255.255.255' }), false); -assert.equal(net.isIPv4({ toString: () => '127.0.0.1' }), true); -assert.equal(net.isIPv4({ toString: () => 'bla' }), false); +assert.strictEqual(net.isIPv4({ toString: () => '127.0.0.1' }), true); +assert.strictEqual(net.isIPv4({ toString: () => 'bla' }), false); -assert.equal(net.isIPv6('127.0.0.1'), false); -assert.equal(net.isIPv6('example.com'), false); -assert.equal(net.isIPv6('2001:252:0:1::2008:6'), true); -assert.equal(net.isIPv6(), false); -assert.equal(net.isIPv6(''), false); -assert.equal(net.isIPv6(null), false); -assert.equal(net.isIPv6(123), false); -assert.equal(net.isIPv6(true), false); -assert.equal(net.isIPv6({}), false); -assert.equal(net.isIPv6({ +assert.strictEqual(net.isIPv6('127.0.0.1'), false); +assert.strictEqual(net.isIPv6('example.com'), false); +assert.strictEqual(net.isIPv6('2001:252:0:1::2008:6'), true); +assert.strictEqual(net.isIPv6(), false); +assert.strictEqual(net.isIPv6(''), false); +assert.strictEqual(net.isIPv6(null), false); +assert.strictEqual(net.isIPv6(123), false); +assert.strictEqual(net.isIPv6(true), false); +assert.strictEqual(net.isIPv6({}), false); +assert.strictEqual(net.isIPv6({ toString: () => '::2001:252:1:255.255.255.255' }), true); -assert.equal(net.isIPv6({ toString: () => '127.0.0.1' }), false); -assert.equal(net.isIPv6({ toString: () => 'bla' }), false); +assert.strictEqual(net.isIPv6({ toString: () => '127.0.0.1' }), false); +assert.strictEqual(net.isIPv6({ toString: () => 'bla' }), false); diff --git a/test/parallel/test-net-listen-exclusive-random-ports.js b/test/parallel/test-net-listen-exclusive-random-ports.js index cc1ab4d805994f..1909af067ce4d7 100644 --- a/test/parallel/test-net-listen-exclusive-random-ports.js +++ b/test/parallel/test-net-listen-exclusive-random-ports.js @@ -10,11 +10,11 @@ if (cluster.isMaster) { const worker1 = cluster.fork(); worker1.on('message', function(port1) { - assert.equal(port1, port1 | 0, 'first worker could not listen'); + assert.strictEqual(port1, port1 | 0, 'first worker could not listen'); const worker2 = cluster.fork(); worker2.on('message', function(port2) { - assert.equal(port2, port2 | 0, 'second worker could not listen'); + assert.strictEqual(port2, port2 | 0, 'second worker could not listen'); assert.notStrictEqual(port1, port2, 'ports should not be equal'); worker1.kill(); worker2.kill(); diff --git a/test/parallel/test-net-listen-shared-ports.js b/test/parallel/test-net-listen-shared-ports.js index ce344be4a6f492..e7bc036ff3986c 100644 --- a/test/parallel/test-net-listen-shared-ports.js +++ b/test/parallel/test-net-listen-shared-ports.js @@ -10,11 +10,11 @@ if (cluster.isMaster) { const worker1 = cluster.fork(); worker1.on('message', function(msg) { - assert.equal(msg, 'success'); + assert.strictEqual(msg, 'success'); const worker2 = cluster.fork(); worker2.on('message', function(msg) { - assert.equal(msg, 'server2:EADDRINUSE'); + assert.strictEqual(msg, 'server2:EADDRINUSE'); worker1.kill(); worker2.kill(); }); diff --git a/test/parallel/test-net-persistent-keepalive.js b/test/parallel/test-net-persistent-keepalive.js index 6338b5932de1fa..8756cd7d1b2960 100644 --- a/test/parallel/test-net-persistent-keepalive.js +++ b/test/parallel/test-net-persistent-keepalive.js @@ -9,14 +9,14 @@ const echoServer = net.createServer(function(connection) { serverConnection = connection; setTimeout(function() { // make sure both connections are still open - assert.equal(serverConnection.readyState, 'open'); - assert.equal(clientConnection.readyState, 'open'); + assert.strictEqual(serverConnection.readyState, 'open'); + assert.strictEqual(clientConnection.readyState, 'open'); serverConnection.end(); clientConnection.end(); echoServer.close(); }, 600); connection.setTimeout(0); - assert.equal(typeof connection.setKeepAlive, 'function'); + assert.strictEqual(typeof connection.setKeepAlive, 'function'); connection.on('end', function() { connection.end(); }); diff --git a/test/parallel/test-net-persistent-nodelay.js b/test/parallel/test-net-persistent-nodelay.js index 3f94424b0e1197..bb2a9dfd22e5cc 100644 --- a/test/parallel/test-net-persistent-nodelay.js +++ b/test/parallel/test-net-persistent-nodelay.js @@ -28,7 +28,7 @@ echoServer.on('listening', function() { assert.ok(s instanceof net.Socket); sock1.connect(this.address().port); sock1.on('end', function() { - assert.equal(callCount, 1); + assert.strictEqual(callCount, 1); echoServer.close(); }); }); diff --git a/test/parallel/test-net-persistent-ref-unref.js b/test/parallel/test-net-persistent-ref-unref.js index 1d3cbc6ffaef18..d8de7ba3f2877a 100644 --- a/test/parallel/test-net-persistent-ref-unref.js +++ b/test/parallel/test-net-persistent-ref-unref.js @@ -16,13 +16,13 @@ let refCount = 0; TCPWrap.prototype.ref = function() { ref.call(this); refCount++; - assert.equal(refCount, 0); + assert.strictEqual(refCount, 0); }; TCPWrap.prototype.unref = function() { unref.call(this); refCount--; - assert.equal(refCount, -1); + assert.strictEqual(refCount, -1); }; echoServer.listen(0); @@ -33,7 +33,7 @@ echoServer.on('listening', function() { sock.ref(); sock.connect(this.address().port); sock.on('end', function() { - assert.equal(refCount, 0); + assert.strictEqual(refCount, 0); echoServer.close(); }); }); diff --git a/test/parallel/test-net-reconnect.js b/test/parallel/test-net-reconnect.js index 47171093ca13f9..c970ad7fc5c135 100644 --- a/test/parallel/test-net-reconnect.js +++ b/test/parallel/test-net-reconnect.js @@ -23,7 +23,7 @@ const server = net.createServer(function(socket) { socket.on('close', function(had_error) { console.log('SERVER had_error: ' + JSON.stringify(had_error)); - assert.equal(false, had_error); + assert.strictEqual(false, had_error); }); }); @@ -40,7 +40,7 @@ server.listen(0, function() { client.on('data', function(chunk) { client_recv_count += 1; console.log('client_recv_count ' + client_recv_count); - assert.equal('hello\r\n', chunk); + assert.strictEqual('hello\r\n', chunk); console.error('CLIENT: calling end', client._writableState); client.end(); }); @@ -52,7 +52,7 @@ server.listen(0, function() { client.on('close', function(had_error) { console.log('CLIENT disconnect'); - assert.equal(false, had_error); + assert.strictEqual(false, had_error); if (disconnect_count++ < N) client.connect(server.address().port); // reconnect else @@ -61,7 +61,7 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(N + 1, disconnect_count); - assert.equal(N + 1, client_recv_count); - assert.equal(N + 1, client_end_count); + assert.strictEqual(N + 1, disconnect_count); + assert.strictEqual(N + 1, client_recv_count); + assert.strictEqual(N + 1, client_end_count); }); diff --git a/test/parallel/test-net-server-bind.js b/test/parallel/test-net-server-bind.js index e4dc64216441cf..0332b364df1ca2 100644 --- a/test/parallel/test-net-server-bind.js +++ b/test/parallel/test-net-server-bind.js @@ -70,7 +70,7 @@ server4.listen(common.PORT + 3, 127, function() { process.on('exit', function() { assert.ok(address0.port > 100); - assert.equal(common.PORT, address1.port); + assert.strictEqual(common.PORT, address1.port); let expectedConnectionKey1; @@ -79,8 +79,8 @@ process.on('exit', function() { else expectedConnectionKey1 = '4:0.0.0.0:' + address1.port; - assert.equal(connectionKey1, expectedConnectionKey1); - assert.equal(common.PORT + 1, address2.port); - assert.equal(common.PORT + 2, address3.port); - assert.equal(common.PORT + 3, address4.port); + assert.strictEqual(connectionKey1, expectedConnectionKey1); + assert.strictEqual(common.PORT + 1, address2.port); + assert.strictEqual(common.PORT + 2, address3.port); + assert.strictEqual(common.PORT + 3, address4.port); }); diff --git a/test/parallel/test-net-server-close.js b/test/parallel/test-net-server-close.js index d52cccaacfd8e6..e39f851c3906c4 100644 --- a/test/parallel/test-net-server-close.js +++ b/test/parallel/test-net-server-close.js @@ -7,12 +7,12 @@ const events = []; const sockets = []; process.on('exit', function() { - assert.equal(server.connections, 0); - assert.equal(events.length, 3); + assert.strictEqual(server.connections, 0); + assert.strictEqual(events.length, 3); // Expect to see one server event and two client events. The order of the // events is undefined because they arrive on the same event loop tick. - assert.equal(events.join(' ').match(/server/g).length, 1); - assert.equal(events.join(' ').match(/client/g).length, 2); + assert.strictEqual(events.join(' ').match(/server/g).length, 1); + assert.strictEqual(events.join(' ').match(/client/g).length, 2); }); const server = net.createServer(function(c) { diff --git a/test/parallel/test-net-server-connections.js b/test/parallel/test-net-server-connections.js index 4e41d29a505199..7ee1df1a544b95 100644 --- a/test/parallel/test-net-server-connections.js +++ b/test/parallel/test-net-server-connections.js @@ -9,4 +9,4 @@ const net = require('net'); const server = new net.Server(); -assert.equal(Object.keys(server).indexOf('connections'), -1); +assert.strictEqual(Object.keys(server).indexOf('connections'), -1); diff --git a/test/parallel/test-net-server-listen-remove-callback.js b/test/parallel/test-net-server-listen-remove-callback.js index a678922683eeb1..cd47f325a9580f 100644 --- a/test/parallel/test-net-server-listen-remove-callback.js +++ b/test/parallel/test-net-server-listen-remove-callback.js @@ -9,7 +9,7 @@ const server = net.createServer(); server.on('close', function() { const listeners = server.listeners('listening'); console.log('Closed, listeners:', listeners.length); - assert.equal(0, listeners.length); + assert.strictEqual(0, listeners.length); }); server.listen(0, function() { diff --git a/test/parallel/test-net-server-max-connections-close-makes-more-available.js b/test/parallel/test-net-server-max-connections-close-makes-more-available.js index c7fe7c74a77d37..4e1f381e0fdb50 100644 --- a/test/parallel/test-net-server-max-connections-close-makes-more-available.js +++ b/test/parallel/test-net-server-max-connections-close-makes-more-available.js @@ -29,7 +29,7 @@ const createConnection = function(index) { }); connection.on('error', function(err) { - assert.equal(err.code, 'ECONNRESET'); + assert.strictEqual(err.code, 'ECONNRESET'); resolve(); }); diff --git a/test/parallel/test-net-server-pause-on-connect.js b/test/parallel/test-net-server-pause-on-connect.js index ee5ac4e2807b0a..5b42876e6d652e 100644 --- a/test/parallel/test-net-server-pause-on-connect.js +++ b/test/parallel/test-net-server-pause-on-connect.js @@ -13,7 +13,7 @@ const server1ConnHandler = function(socket) { common.fail('data event should not have happened yet'); } - assert.equal(data.toString(), msg, 'invalid data received'); + assert.strictEqual(data.toString(), msg, 'invalid data received'); socket.end(); server1.close(); }); @@ -25,11 +25,12 @@ const server1 = net.createServer({pauseOnConnect: true}, server1ConnHandler); const server2ConnHandler = function(socket) { socket.on('data', function(data) { - assert.equal(data.toString(), msg, 'invalid data received'); + assert.strictEqual(data.toString(), msg, 'invalid data received'); socket.end(); server2.close(); - assert.equal(server1Sock.bytesRead, 0, 'no data should have been read yet'); + assert.strictEqual(server1Sock.bytesRead, 0, + 'no data should have been read yet'); server1Sock.resume(); stopped = false; }); @@ -47,5 +48,5 @@ server1.listen(0, function() { }); process.on('exit', function() { - assert.equal(stopped, false); + assert.strictEqual(stopped, false); }); diff --git a/test/parallel/test-net-stream.js b/test/parallel/test-net-stream.js index 9d091bd66f3a1e..9e1ca670e1e145 100644 --- a/test/parallel/test-net-stream.js +++ b/test/parallel/test-net-stream.js @@ -12,11 +12,11 @@ s.server = new net.Server(); s.server.connections = 10; s._server = s.server; -assert.equal(10, s.server.connections); +assert.strictEqual(10, s.server.connections); s.destroy(); -assert.equal(9, s.server.connections); +assert.strictEqual(9, s.server.connections); s.destroy(); -assert.equal(9, s.server.connections); +assert.strictEqual(9, s.server.connections); const SIZE = 2E6; const N = 10; @@ -47,5 +47,5 @@ const server = net.createServer(function(socket) { }); process.on('exit', function() { - assert.equal(server.connections, 0); + assert.strictEqual(server.connections, 0); }); diff --git a/test/parallel/test-net-sync-cork.js b/test/parallel/test-net-sync-cork.js index 4dff309cb97816..3872f5f96944fc 100644 --- a/test/parallel/test-net-sync-cork.js +++ b/test/parallel/test-net-sync-cork.js @@ -21,13 +21,13 @@ server.listen(0, function() { res = conn.write(buf); conn.uncork(); } - assert.equal(i, N); + assert.strictEqual(i, N); conn.end(); }); }); process.on('exit', function() { - assert.equal(server.connections, 0); + assert.strictEqual(server.connections, 0); }); function handle(socket) { diff --git a/test/parallel/test-next-tick-ordering.js b/test/parallel/test-next-tick-ordering.js index 2f13147d8ed733..ea019facdd8fa0 100644 --- a/test/parallel/test-next-tick-ordering.js +++ b/test/parallel/test-next-tick-ordering.js @@ -26,10 +26,10 @@ console.log('Running from main.'); process.on('exit', function() { - assert.equal('nextTick', done[0]); + assert.strictEqual('nextTick', done[0]); /* Disabling this test. I don't think we can ensure the order for (i = 0; i < N; i += 1) { - assert.equal(i, done[i + 1]); + assert.strictEqual(i, done[i + 1]); } */ }); diff --git a/test/parallel/test-next-tick.js b/test/parallel/test-next-tick.js index 3001ad0e561a77..9d2b1917fae2f7 100644 --- a/test/parallel/test-next-tick.js +++ b/test/parallel/test-next-tick.js @@ -17,8 +17,8 @@ process.nextTick(common.mustCall(function() {})); const obj = {}; process.nextTick(function(a, b) { - assert.equal(a, 42); - assert.equal(b, obj); + assert.strictEqual(a, 42); + assert.strictEqual(b, obj); }, 42, obj); process.on('exit', function() { diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index c7f216fce5f2fa..00a3504fa925ae 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -53,7 +53,7 @@ const proc = spawn(process.execPath, args, { }); function handleExit(code, signalCode) { - assert.equal(code, 0, 'npm install should run without an error'); + assert.strictEqual(code, 0, 'npm install should run without an error'); assert.ok(signalCode === null, 'signalCode should be null'); assert.doesNotThrow(function() { fs.accessSync(installDir + '/node_modules/package-name'); diff --git a/test/parallel/test-os-homedir-no-envvar.js b/test/parallel/test-os-homedir-no-envvar.js index 94d8ab5a08fa14..2f9b1b47a70477 100644 --- a/test/parallel/test-os-homedir-no-envvar.js +++ b/test/parallel/test-os-homedir-no-envvar.js @@ -26,5 +26,5 @@ if (process.argv[2] === 'child') { env: process.env }); - assert.equal(child.status, 0); + assert.strictEqual(child.status, 0); } diff --git a/test/parallel/test-path-makelong.js b/test/parallel/test-path-makelong.js index 293d6284f173bc..1284f625160ebe 100644 --- a/test/parallel/test-path-makelong.js +++ b/test/parallel/test-path-makelong.js @@ -7,18 +7,19 @@ if (common.isWindows) { const file = path.join(common.fixturesDir, 'a.js'); const resolvedFile = path.resolve(file); - assert.equal('\\\\?\\' + resolvedFile, path._makeLong(file)); - assert.equal('\\\\?\\' + resolvedFile, path._makeLong('\\\\?\\' + file)); - assert.equal('\\\\?\\UNC\\someserver\\someshare\\somefile', - path._makeLong('\\\\someserver\\someshare\\somefile')); - assert.equal('\\\\?\\UNC\\someserver\\someshare\\somefile', - path._makeLong('\\\\?\\UNC\\someserver\\someshare\\somefile')); - assert.equal('\\\\.\\pipe\\somepipe', - path._makeLong('\\\\.\\pipe\\somepipe')); + assert.strictEqual('\\\\?\\' + resolvedFile, path._makeLong(file)); + assert.strictEqual('\\\\?\\' + resolvedFile, path._makeLong('\\\\?\\' + + file)); + assert.strictEqual('\\\\?\\UNC\\someserver\\someshare\\somefile', + path._makeLong('\\\\someserver\\someshare\\somefile')); + assert.strictEqual('\\\\?\\UNC\\someserver\\someshare\\somefile', path + ._makeLong('\\\\?\\UNC\\someserver\\someshare\\somefile')); + assert.strictEqual('\\\\.\\pipe\\somepipe', + path._makeLong('\\\\.\\pipe\\somepipe')); } -assert.equal(path._makeLong(null), null); -assert.equal(path._makeLong(100), 100); -assert.equal(path._makeLong(path), path); -assert.equal(path._makeLong(false), false); -assert.equal(path._makeLong(true), true); +assert.strictEqual(path._makeLong(null), null); +assert.strictEqual(path._makeLong(100), 100); +assert.strictEqual(path._makeLong(path), path); +assert.strictEqual(path._makeLong(false), false); +assert.strictEqual(path._makeLong(true), true); diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js index f112bc0e4067cd..ac0cf62117f09d 100644 --- a/test/parallel/test-path-parse-format.js +++ b/test/parallel/test-path-parse-format.js @@ -154,7 +154,7 @@ trailingTests.forEach(function(test) { failures.push('\n' + message); }); }); -assert.equal(failures.length, 0, failures.join('')); +assert.strictEqual(failures.length, 0, failures.join('')); function checkErrors(path) { errors.forEach(function(errorCase) { diff --git a/test/parallel/test-path-zero-length-strings.js b/test/parallel/test-path-zero-length-strings.js index b08ef4809201eb..ec9585fafaa169 100644 --- a/test/parallel/test-path-zero-length-strings.js +++ b/test/parallel/test-path-zero-length-strings.js @@ -12,28 +12,28 @@ const pwd = process.cwd(); // join will internally ignore all the zero-length strings and it will return // '.' if the joined string is a zero-length string. -assert.equal(path.posix.join(''), '.'); -assert.equal(path.posix.join('', ''), '.'); -assert.equal(path.win32.join(''), '.'); -assert.equal(path.win32.join('', ''), '.'); -assert.equal(path.join(pwd), pwd); -assert.equal(path.join(pwd, ''), pwd); +assert.strictEqual(path.posix.join(''), '.'); +assert.strictEqual(path.posix.join('', ''), '.'); +assert.strictEqual(path.win32.join(''), '.'); +assert.strictEqual(path.win32.join('', ''), '.'); +assert.strictEqual(path.join(pwd), pwd); +assert.strictEqual(path.join(pwd, ''), pwd); // normalize will return '.' if the input is a zero-length string -assert.equal(path.posix.normalize(''), '.'); -assert.equal(path.win32.normalize(''), '.'); -assert.equal(path.normalize(pwd), pwd); +assert.strictEqual(path.posix.normalize(''), '.'); +assert.strictEqual(path.win32.normalize(''), '.'); +assert.strictEqual(path.normalize(pwd), pwd); // Since '' is not a valid path in any of the common environments, return false -assert.equal(path.posix.isAbsolute(''), false); -assert.equal(path.win32.isAbsolute(''), false); +assert.strictEqual(path.posix.isAbsolute(''), false); +assert.strictEqual(path.win32.isAbsolute(''), false); // resolve, internally ignores all the zero-length strings and returns the // current working directory -assert.equal(path.resolve(''), pwd); -assert.equal(path.resolve('', ''), pwd); +assert.strictEqual(path.resolve(''), pwd); +assert.strictEqual(path.resolve('', ''), pwd); // relative, internally calls resolve. So, '' is actually the current directory -assert.equal(path.relative('', pwd), ''); -assert.equal(path.relative(pwd, ''), ''); -assert.equal(path.relative(pwd, pwd), ''); +assert.strictEqual(path.relative('', pwd), ''); +assert.strictEqual(path.relative(pwd, ''), ''); +assert.strictEqual(path.relative(pwd, pwd), ''); diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index 3843088ebdc14b..b074e83c131a24 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -453,7 +453,7 @@ if (common.isWindows) { const spawnResult = child.spawnSync( process.argv[0], [resolveFixture, currentDriveLetter]); const resolvedPath = spawnResult.stdout.toString().trim(); - assert.equal(resolvedPath.toLowerCase(), process.cwd().toLowerCase()); + assert.strictEqual(resolvedPath.toLowerCase(), process.cwd().toLowerCase()); } diff --git a/test/parallel/test-pipe-stream.js b/test/parallel/test-pipe-stream.js index 5e3774fc99d535..8fd9d31d499089 100644 --- a/test/parallel/test-pipe-stream.js +++ b/test/parallel/test-pipe-stream.js @@ -26,7 +26,7 @@ function test(clazz, cb) { }); conn.on('data', function(data) { - assert.equal(data.toString(), 'PONG'); + assert.strictEqual(data.toString(), 'PONG'); have_pong = true; conn.destroy(); }); @@ -38,7 +38,7 @@ function test(clazz, cb) { }); conn.on('data', function(data) { - assert.equal(data.toString(), 'PING'); + assert.strictEqual(data.toString(), 'PING'); have_ping = true; conn.write('PONG', 'utf-8'); }); diff --git a/test/parallel/test-process-argv-0.js b/test/parallel/test-process-argv-0.js index d6b4bfe232323e..8e4f0e695ec6a1 100644 --- a/test/parallel/test-process-argv-0.js +++ b/test/parallel/test-process-argv-0.js @@ -14,7 +14,7 @@ if (process.argv[2] !== 'child') { childArgv0 += chunk; }); process.on('exit', function() { - assert.equal(childArgv0, process.execPath); + assert.strictEqual(childArgv0, process.execPath); }); } else { process.stdout.write(process.argv[0]); diff --git a/test/parallel/test-process-env.js b/test/parallel/test-process-env.js index 21898d19425ca3..5ea0a4a57efc68 100644 --- a/test/parallel/test-process-env.js +++ b/test/parallel/test-process-env.js @@ -63,8 +63,8 @@ process.env.TZ = 'Europe/Amsterdam'; // time difference between Greenwich and Amsterdam is +2 hours in the summer date = new Date('Fri, 10 Sep 1982 03:15:00 GMT'); -assert.equal(3, date.getUTCHours()); -assert.equal(5, date.getHours()); +assert.strictEqual(3, date.getUTCHours()); +assert.strictEqual(5, date.getHours()); */ /* eslint-enable max-len */ diff --git a/test/parallel/test-process-exit-code.js b/test/parallel/test-process-exit-code.js index 337502ffcb30e8..8d0ed1b33bae76 100644 --- a/test/parallel/test-process-exit-code.js +++ b/test/parallel/test-process-exit-code.js @@ -22,14 +22,14 @@ switch (process.argv[2]) { function child1() { process.exitCode = 42; process.on('exit', function(code) { - assert.equal(code, 42); + assert.strictEqual(code, 42); }); } function child2() { process.exitCode = 99; process.on('exit', function(code) { - assert.equal(code, 42); + assert.strictEqual(code, 42); }); process.exit(42); } @@ -37,7 +37,7 @@ function child2() { function child3() { process.exitCode = 99; process.on('exit', function(code) { - assert.equal(code, 0); + assert.strictEqual(code, 0); }); process.exit(0); } @@ -56,7 +56,7 @@ function child4() { function child5() { process.exitCode = 95; process.on('exit', function(code) { - assert.equal(code, 95); + assert.strictEqual(code, 95); process.exitCode = 99; }); } @@ -75,7 +75,7 @@ function test(arg, exit) { const f = __filename; const option = { stdio: [ 0, 1, 'ignore' ] }; spawn(node, [f, arg], option).on('exit', function(code) { - assert.equal(code, exit, 'wrong exit for ' + + assert.strictEqual(code, exit, 'wrong exit for ' + arg + '\nexpected:' + exit + ' but got:' + code); console.log('ok - %s exited with %d', arg, exit); diff --git a/test/parallel/test-process-exit-recursive.js b/test/parallel/test-process-exit-recursive.js index 1634aad15497f5..48ad8259168a90 100644 --- a/test/parallel/test-process-exit-recursive.js +++ b/test/parallel/test-process-exit-recursive.js @@ -6,8 +6,8 @@ const assert = require('assert'); let nexits = 0; process.on('exit', function(code) { - assert.equal(nexits++, 0); - assert.equal(code, 1); + assert.strictEqual(nexits++, 0); + assert.strictEqual(code, 1); // now override the exit code of 1 with 0 so that the test passes process.exit(0); diff --git a/test/parallel/test-process-exit.js b/test/parallel/test-process-exit.js index f7df7737ed1531..a4ea2bf51b53f5 100644 --- a/test/parallel/test-process-exit.js +++ b/test/parallel/test-process-exit.js @@ -6,8 +6,8 @@ const assert = require('assert'); let nexits = 0; process.on('exit', function(code) { - assert.equal(nexits++, 0); - assert.equal(code, 0); + assert.strictEqual(nexits++, 0); + assert.strictEqual(code, 0); process.exit(); }); diff --git a/test/parallel/test-process-getactiverequests.js b/test/parallel/test-process-getactiverequests.js index 30773f8f11380a..f1874e4ad09a86 100644 --- a/test/parallel/test-process-getactiverequests.js +++ b/test/parallel/test-process-getactiverequests.js @@ -7,4 +7,4 @@ const fs = require('fs'); for (let i = 0; i < 12; i++) fs.open(__filename, 'r', function() { }); -assert.equal(12, process._getActiveRequests().length); +assert.strictEqual(12, process._getActiveRequests().length); diff --git a/test/parallel/test-process-getgroups.js b/test/parallel/test-process-getgroups.js index e92f04853976f7..2d7a93c9a32c75 100644 --- a/test/parallel/test-process-getgroups.js +++ b/test/parallel/test-process-getgroups.js @@ -15,7 +15,7 @@ if (typeof process.getgroups === 'function') { exec('id -G', function(err, stdout) { assert.ifError(err); const real_groups = stdout.match(/\d+/g).map(Number); - assert.equal(groups.length, real_groups.length); + assert.strictEqual(groups.length, real_groups.length); check(groups, real_groups); check(real_groups, groups); }); diff --git a/test/parallel/test-process-kill-pid.js b/test/parallel/test-process-kill-pid.js index 2c6ef37fc120df..79dc00163b78f8 100644 --- a/test/parallel/test-process-kill-pid.js +++ b/test/parallel/test-process-kill-pid.js @@ -47,8 +47,8 @@ function kill(tryPid, trySig, expectPid, expectSig) { process.kill(tryPid, trySig); - assert.equal(getPid, expectPid); - assert.equal(getSig, expectSig); + assert.strictEqual(getPid.toString(), expectPid.toString()); + assert.strictEqual(getSig, expectSig); } // Note that SIGHUP and SIGTERM map to 1 and 15 respectively, even on Windows diff --git a/test/parallel/test-process-raw-debug.js b/test/parallel/test-process-raw-debug.js index 74c99b1f8f8058..dc31c3737ae1cb 100644 --- a/test/parallel/test-process-raw-debug.js +++ b/test/parallel/test-process-raw-debug.js @@ -25,7 +25,7 @@ function parent() { child.stderr.setEncoding('utf8'); child.stderr.on('end', function() { - assert.equal(output, 'I can still debug!' + os.EOL); + assert.strictEqual(output, 'I can still debug!' + os.EOL); console.log('ok - got expected message'); }); diff --git a/test/parallel/test-process-remove-all-signal-listeners.js b/test/parallel/test-process-remove-all-signal-listeners.js index 76a96f7683e452..85db45ff88c7c8 100644 --- a/test/parallel/test-process-remove-all-signal-listeners.js +++ b/test/parallel/test-process-remove-all-signal-listeners.js @@ -17,7 +17,7 @@ if (process.argv[2] !== '--do-test') { const child = spawn(process.execPath, [__filename, '--do-test']); child.once('exit', common.mustCall(function(code, signal) { - assert.equal(signal, 'SIGINT'); + assert.strictEqual(signal, 'SIGINT'); })); return; diff --git a/test/parallel/test-process-wrap.js b/test/parallel/test-process-wrap.js index 326854e98335df..fee40a84167023 100644 --- a/test/parallel/test-process-wrap.js +++ b/test/parallel/test-process-wrap.js @@ -15,8 +15,8 @@ p.onexit = function(exitCode, signal) { p.close(); pipe.readStart(); - assert.equal(0, exitCode); - assert.equal(0, signal); + assert.strictEqual(0, exitCode); + assert.strictEqual('', signal); processExited = true; }; diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js index 27cb94bf704eb4..6ae70fef97a489 100644 --- a/test/parallel/test-promises-unhandled-rejections.js +++ b/test/parallel/test-promises-unhandled-rejections.js @@ -669,7 +669,7 @@ asyncTest('Throwing an error inside a rejectionHandled handler goes to' + const e = new Error(); const e2 = new Error(); const tearDownException = setupException(function(err) { - assert.equal(e2, err); + assert.strictEqual(e2, err); tearDownException(); done(); }); diff --git a/test/parallel/test-querystring-maxKeys-non-finite.js b/test/parallel/test-querystring-maxKeys-non-finite.js index 8aa47f7de0e2dc..3df381405d650a 100644 --- a/test/parallel/test-querystring-maxKeys-non-finite.js +++ b/test/parallel/test-querystring-maxKeys-non-finite.js @@ -47,9 +47,9 @@ const resultInfinityString = parse(params, undefined, undefined, { const resultNaNString = parse(params, undefined, undefined, {maxKeys: 'NaN'}); // Non Finite maxKeys should return the length of input -assert.equal(Object.keys(resultInfinity).length, count); -assert.equal(Object.keys(resultNaN).length, count); +assert.strictEqual(Object.keys(resultInfinity).length, count); +assert.strictEqual(Object.keys(resultNaN).length, count); // Strings maxKeys should return the maxLength // defined by parses internals -assert.equal(Object.keys(resultInfinityString).length, originalMaxLength); -assert.equal(Object.keys(resultNaNString).length, originalMaxLength); +assert.strictEqual(Object.keys(resultInfinityString).length, originalMaxLength); +assert.strictEqual(Object.keys(resultNaNString).length, originalMaxLength); diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index 8cc589944b0508..89c880c7e0e3ce 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -168,15 +168,15 @@ qsNoMungeTestCases.forEach(function(testCase) { // basic qsTestCases.forEach(function(testCase) { - assert.equal(testCase[1], qs.stringify(testCase[2])); + assert.strictEqual(testCase[1], qs.stringify(testCase[2])); }); qsColonTestCases.forEach(function(testCase) { - assert.equal(testCase[1], qs.stringify(testCase[2], ';', ':')); + assert.strictEqual(testCase[1], qs.stringify(testCase[2], ';', ':')); }); qsWeirdObjects.forEach(function(testCase) { - assert.equal(testCase[1], qs.stringify(testCase[0])); + assert.strictEqual(testCase[1], qs.stringify(testCase[0])); }); // invalid surrogate pair throws URIError @@ -201,7 +201,7 @@ assert.strictEqual('foo=', qs.stringify({ foo: Infinity })); y: 'z' }) }); - assert.equal(f, 'a=b&q=x%3Dy%26y%3Dz'); + assert.strictEqual(f, 'a=b&q=x%3Dy%26y%3Dz'); } assert.doesNotThrow(function() { @@ -217,14 +217,14 @@ assert.doesNotThrow(function() { y: 'z' }, ';', ':') }, ';', ':'); - assert.equal(f, 'a:b;q:x%3Ay%3By%3Az'); + assert.strictEqual(f, 'a:b;q:x%3Ay%3By%3Az'); } check(qs.parse(), {}); // Test limiting -assert.equal( +assert.strictEqual( Object.keys(qs.parse('a=1&b=1&c=1', null, null, { maxKeys: 1 })).length, 1); @@ -236,7 +236,7 @@ function testUnlimitedKeys() { const url = qs.stringify(query); - assert.equal( + assert.strictEqual( Object.keys(qs.parse(url, null, null, { maxKeys: 0 })).length, 2000); } @@ -246,26 +246,26 @@ testUnlimitedKeys(); const b = qs.unescapeBuffer('%d3%f2Ug%1f6v%24%5e%98%cb' + '%0d%ac%a2%2f%9d%eb%d8%a2%e6'); // -assert.equal(0xd3, b[0]); -assert.equal(0xf2, b[1]); -assert.equal(0x55, b[2]); -assert.equal(0x67, b[3]); -assert.equal(0x1f, b[4]); -assert.equal(0x36, b[5]); -assert.equal(0x76, b[6]); -assert.equal(0x24, b[7]); -assert.equal(0x5e, b[8]); -assert.equal(0x98, b[9]); -assert.equal(0xcb, b[10]); -assert.equal(0x0d, b[11]); -assert.equal(0xac, b[12]); -assert.equal(0xa2, b[13]); -assert.equal(0x2f, b[14]); -assert.equal(0x9d, b[15]); -assert.equal(0xeb, b[16]); -assert.equal(0xd8, b[17]); -assert.equal(0xa2, b[18]); -assert.equal(0xe6, b[19]); +assert.strictEqual(0xd3, b[0]); +assert.strictEqual(0xf2, b[1]); +assert.strictEqual(0x55, b[2]); +assert.strictEqual(0x67, b[3]); +assert.strictEqual(0x1f, b[4]); +assert.strictEqual(0x36, b[5]); +assert.strictEqual(0x76, b[6]); +assert.strictEqual(0x24, b[7]); +assert.strictEqual(0x5e, b[8]); +assert.strictEqual(0x98, b[9]); +assert.strictEqual(0xcb, b[10]); +assert.strictEqual(0x0d, b[11]); +assert.strictEqual(0xac, b[12]); +assert.strictEqual(0xa2, b[13]); +assert.strictEqual(0x2f, b[14]); +assert.strictEqual(0x9d, b[15]); +assert.strictEqual(0xeb, b[16]); +assert.strictEqual(0xd8, b[17]); +assert.strictEqual(0xa2, b[18]); +assert.strictEqual(0xe6, b[19]); // Test custom decode @@ -281,7 +281,7 @@ function demoEncode(str) { return str[0]; } const obj = { aa: 'aa', bb: 'bb', cc: 'cc' }; -assert.equal( +assert.strictEqual( qs.stringify(obj, null, null, { encodeURIComponent: demoEncode }), 'a=a&b=b&c=c'); diff --git a/test/parallel/test-readdouble.js b/test/parallel/test-readdouble.js index 728a2b4605d9ff..00340a39e631c0 100644 --- a/test/parallel/test-readdouble.js +++ b/test/parallel/test-readdouble.js @@ -19,8 +19,8 @@ function test(clazz) { buffer[5] = 0x55; buffer[6] = 0xd5; buffer[7] = 0x3f; - assert.equal(1.1945305291680097e+103, buffer.readDoubleBE(0)); - assert.equal(0.3333333333333333, buffer.readDoubleLE(0)); + assert.strictEqual(1.1945305291680097e+103, buffer.readDoubleBE(0)); + assert.strictEqual(0.3333333333333333, buffer.readDoubleLE(0)); buffer[0] = 1; buffer[1] = 0; @@ -30,18 +30,18 @@ function test(clazz) { buffer[5] = 0; buffer[6] = 0xf0; buffer[7] = 0x3f; - assert.equal(7.291122019655968e-304, buffer.readDoubleBE(0)); - assert.equal(1.0000000000000002, buffer.readDoubleLE(0)); + assert.strictEqual(7.291122019655968e-304, buffer.readDoubleBE(0)); + assert.strictEqual(1.0000000000000002, buffer.readDoubleLE(0)); buffer[0] = 2; - assert.equal(4.778309726801735e-299, buffer.readDoubleBE(0)); - assert.equal(1.0000000000000004, buffer.readDoubleLE(0)); + assert.strictEqual(4.778309726801735e-299, buffer.readDoubleBE(0)); + assert.strictEqual(1.0000000000000004, buffer.readDoubleLE(0)); buffer[0] = 1; buffer[6] = 0; buffer[7] = 0; - assert.equal(7.291122019556398e-304, buffer.readDoubleBE(0)); - assert.equal(5e-324, buffer.readDoubleLE(0)); + assert.strictEqual(7.291122019556398e-304, buffer.readDoubleBE(0)); + assert.strictEqual(5e-324, buffer.readDoubleLE(0)); buffer[0] = 0xff; buffer[1] = 0xff; @@ -52,12 +52,12 @@ function test(clazz) { buffer[6] = 0x0f; buffer[7] = 0x00; assert.ok(isNaN(buffer.readDoubleBE(0))); - assert.equal(2.225073858507201e-308, buffer.readDoubleLE(0)); + assert.strictEqual(2.225073858507201e-308, buffer.readDoubleLE(0)); buffer[6] = 0xef; buffer[7] = 0x7f; assert.ok(isNaN(buffer.readDoubleBE(0))); - assert.equal(1.7976931348623157e+308, buffer.readDoubleLE(0)); + assert.strictEqual(1.7976931348623157e+308, buffer.readDoubleLE(0)); buffer[0] = 0; buffer[1] = 0; @@ -67,42 +67,42 @@ function test(clazz) { buffer[5] = 0; buffer[6] = 0xf0; buffer[7] = 0x3f; - assert.equal(3.03865e-319, buffer.readDoubleBE(0)); - assert.equal(1, buffer.readDoubleLE(0)); + assert.strictEqual(3.03865e-319, buffer.readDoubleBE(0)); + assert.strictEqual(1, buffer.readDoubleLE(0)); buffer[6] = 0; buffer[7] = 0x40; - assert.equal(3.16e-322, buffer.readDoubleBE(0)); - assert.equal(2, buffer.readDoubleLE(0)); + assert.strictEqual(3.16e-322, buffer.readDoubleBE(0)); + assert.strictEqual(2, buffer.readDoubleLE(0)); buffer[7] = 0xc0; - assert.equal(9.5e-322, buffer.readDoubleBE(0)); - assert.equal(-2, buffer.readDoubleLE(0)); + assert.strictEqual(9.5e-322, buffer.readDoubleBE(0)); + assert.strictEqual(-2, buffer.readDoubleLE(0)); buffer[6] = 0x10; buffer[7] = 0; - assert.equal(2.0237e-320, buffer.readDoubleBE(0)); - assert.equal(2.2250738585072014e-308, buffer.readDoubleLE(0)); + assert.strictEqual(2.0237e-320, buffer.readDoubleBE(0)); + assert.strictEqual(2.2250738585072014e-308, buffer.readDoubleLE(0)); buffer[6] = 0; - assert.equal(0, buffer.readDoubleBE(0)); - assert.equal(0, buffer.readDoubleLE(0)); - assert.equal(false, 1 / buffer.readDoubleLE(0) < 0); + assert.strictEqual(0, buffer.readDoubleBE(0)); + assert.strictEqual(0, buffer.readDoubleLE(0)); + assert.strictEqual(false, 1 / buffer.readDoubleLE(0) < 0); buffer[7] = 0x80; - assert.equal(6.3e-322, buffer.readDoubleBE(0)); - assert.equal(0, buffer.readDoubleLE(0)); - assert.equal(true, 1 / buffer.readDoubleLE(0) < 0); + assert.strictEqual(6.3e-322, buffer.readDoubleBE(0)); + assert.strictEqual(0, buffer.readDoubleLE(0)); + assert.strictEqual(true, 1 / buffer.readDoubleLE(0) < 0); buffer[6] = 0xf0; buffer[7] = 0x7f; - assert.equal(3.0418e-319, buffer.readDoubleBE(0)); - assert.equal(Infinity, buffer.readDoubleLE(0)); + assert.strictEqual(3.0418e-319, buffer.readDoubleBE(0)); + assert.strictEqual(Infinity, buffer.readDoubleLE(0)); buffer[6] = 0xf0; buffer[7] = 0xff; - assert.equal(3.04814e-319, buffer.readDoubleBE(0)); - assert.equal(-Infinity, buffer.readDoubleLE(0)); + assert.strictEqual(3.04814e-319, buffer.readDoubleBE(0)); + assert.strictEqual(-Infinity, buffer.readDoubleLE(0)); } diff --git a/test/parallel/test-readfloat.js b/test/parallel/test-readfloat.js index 437e4778671bd2..0175c195b8ec22 100644 --- a/test/parallel/test-readfloat.js +++ b/test/parallel/test-readfloat.js @@ -15,56 +15,56 @@ function test(clazz) { buffer[1] = 0; buffer[2] = 0x80; buffer[3] = 0x3f; - assert.equal(4.600602988224807e-41, buffer.readFloatBE(0)); - assert.equal(1, buffer.readFloatLE(0)); + assert.strictEqual(4.600602988224807e-41, buffer.readFloatBE(0)); + assert.strictEqual(1, buffer.readFloatLE(0)); buffer[0] = 0; buffer[1] = 0; buffer[2] = 0; buffer[3] = 0xc0; - assert.equal(2.6904930515036488e-43, buffer.readFloatBE(0)); - assert.equal(-2, buffer.readFloatLE(0)); + assert.strictEqual(2.6904930515036488e-43, buffer.readFloatBE(0)); + assert.strictEqual(-2, buffer.readFloatLE(0)); buffer[0] = 0xff; buffer[1] = 0xff; buffer[2] = 0x7f; buffer[3] = 0x7f; assert.ok(isNaN(buffer.readFloatBE(0))); - assert.equal(3.4028234663852886e+38, buffer.readFloatLE(0)); + assert.strictEqual(3.4028234663852886e+38, buffer.readFloatLE(0)); buffer[0] = 0xab; buffer[1] = 0xaa; buffer[2] = 0xaa; buffer[3] = 0x3e; - assert.equal(-1.2126478207002966e-12, buffer.readFloatBE(0)); - assert.equal(0.3333333432674408, buffer.readFloatLE(0)); + assert.strictEqual(-1.2126478207002966e-12, buffer.readFloatBE(0)); + assert.strictEqual(0.3333333432674408, buffer.readFloatLE(0)); buffer[0] = 0; buffer[1] = 0; buffer[2] = 0; buffer[3] = 0; - assert.equal(0, buffer.readFloatBE(0)); - assert.equal(0, buffer.readFloatLE(0)); - assert.equal(false, 1 / buffer.readFloatLE(0) < 0); + assert.strictEqual(0, buffer.readFloatBE(0)); + assert.strictEqual(0, buffer.readFloatLE(0)); + assert.strictEqual(false, 1 / buffer.readFloatLE(0) < 0); buffer[3] = 0x80; - assert.equal(1.793662034335766e-43, buffer.readFloatBE(0)); - assert.equal(0, buffer.readFloatLE(0)); - assert.equal(true, 1 / buffer.readFloatLE(0) < 0); + assert.strictEqual(1.793662034335766e-43, buffer.readFloatBE(0)); + assert.strictEqual(0, buffer.readFloatLE(0)); + assert.strictEqual(true, 1 / buffer.readFloatLE(0) < 0); buffer[0] = 0; buffer[1] = 0; buffer[2] = 0x80; buffer[3] = 0x7f; - assert.equal(4.609571298396486e-41, buffer.readFloatBE(0)); - assert.equal(Infinity, buffer.readFloatLE(0)); + assert.strictEqual(4.609571298396486e-41, buffer.readFloatBE(0)); + assert.strictEqual(Infinity, buffer.readFloatLE(0)); buffer[0] = 0; buffer[1] = 0; buffer[2] = 0x80; buffer[3] = 0xff; - assert.equal(4.627507918739843e-41, buffer.readFloatBE(0)); - assert.equal(-Infinity, buffer.readFloatLE(0)); + assert.strictEqual(4.627507918739843e-41, buffer.readFloatBE(0)); + assert.strictEqual(-Infinity, buffer.readFloatLE(0)); } diff --git a/test/parallel/test-readint.js b/test/parallel/test-readint.js index 086dd4e3aa0d1a..97faa1e7d58d77 100644 --- a/test/parallel/test-readint.js +++ b/test/parallel/test-readint.js @@ -12,19 +12,19 @@ function test8(clazz) { const data = new clazz(4); data[0] = 0x23; - assert.equal(0x23, data.readInt8(0)); + assert.strictEqual(0x23, data.readInt8(0)); data[0] = 0xff; - assert.equal(-1, data.readInt8(0)); + assert.strictEqual(-1, data.readInt8(0)); data[0] = 0x87; data[1] = 0xab; data[2] = 0x7c; data[3] = 0xef; - assert.equal(-121, data.readInt8(0)); - assert.equal(-85, data.readInt8(1)); - assert.equal(124, data.readInt8(2)); - assert.equal(-17, data.readInt8(3)); + assert.strictEqual(-121, data.readInt8(0)); + assert.strictEqual(-85, data.readInt8(1)); + assert.strictEqual(124, data.readInt8(2)); + assert.strictEqual(-17, data.readInt8(3)); } @@ -33,13 +33,13 @@ function test16(clazz) { buffer[0] = 0x16; buffer[1] = 0x79; - assert.equal(0x1679, buffer.readInt16BE(0)); - assert.equal(0x7916, buffer.readInt16LE(0)); + assert.strictEqual(0x1679, buffer.readInt16BE(0)); + assert.strictEqual(0x7916, buffer.readInt16LE(0)); buffer[0] = 0xff; buffer[1] = 0x80; - assert.equal(-128, buffer.readInt16BE(0)); - assert.equal(-32513, buffer.readInt16LE(0)); + assert.strictEqual(-128, buffer.readInt16BE(0)); + assert.strictEqual(-32513, buffer.readInt16LE(0)); /* test offset with weenix */ buffer[0] = 0x77; @@ -48,16 +48,16 @@ function test16(clazz) { buffer[3] = 0x6e; buffer[4] = 0x69; buffer[5] = 0x78; - assert.equal(0x7765, buffer.readInt16BE(0)); - assert.equal(0x6565, buffer.readInt16BE(1)); - assert.equal(0x656e, buffer.readInt16BE(2)); - assert.equal(0x6e69, buffer.readInt16BE(3)); - assert.equal(0x6978, buffer.readInt16BE(4)); - assert.equal(0x6577, buffer.readInt16LE(0)); - assert.equal(0x6565, buffer.readInt16LE(1)); - assert.equal(0x6e65, buffer.readInt16LE(2)); - assert.equal(0x696e, buffer.readInt16LE(3)); - assert.equal(0x7869, buffer.readInt16LE(4)); + assert.strictEqual(0x7765, buffer.readInt16BE(0)); + assert.strictEqual(0x6565, buffer.readInt16BE(1)); + assert.strictEqual(0x656e, buffer.readInt16BE(2)); + assert.strictEqual(0x6e69, buffer.readInt16BE(3)); + assert.strictEqual(0x6978, buffer.readInt16BE(4)); + assert.strictEqual(0x6577, buffer.readInt16LE(0)); + assert.strictEqual(0x6565, buffer.readInt16LE(1)); + assert.strictEqual(0x6e65, buffer.readInt16LE(2)); + assert.strictEqual(0x696e, buffer.readInt16LE(3)); + assert.strictEqual(0x7869, buffer.readInt16LE(4)); } @@ -68,15 +68,15 @@ function test32(clazz) { buffer[1] = 0x53; buffer[2] = 0x16; buffer[3] = 0x79; - assert.equal(0x43531679, buffer.readInt32BE(0)); - assert.equal(0x79165343, buffer.readInt32LE(0)); + assert.strictEqual(0x43531679, buffer.readInt32BE(0)); + assert.strictEqual(0x79165343, buffer.readInt32LE(0)); buffer[0] = 0xff; buffer[1] = 0xfe; buffer[2] = 0xef; buffer[3] = 0xfa; - assert.equal(-69638, buffer.readInt32BE(0)); - assert.equal(-84934913, buffer.readInt32LE(0)); + assert.strictEqual(-69638, buffer.readInt32BE(0)); + assert.strictEqual(-84934913, buffer.readInt32LE(0)); buffer[0] = 0x42; buffer[1] = 0xc3; @@ -84,12 +84,12 @@ function test32(clazz) { buffer[3] = 0xa9; buffer[4] = 0x36; buffer[5] = 0x17; - assert.equal(0x42c395a9, buffer.readInt32BE(0)); - assert.equal(-1013601994, buffer.readInt32BE(1)); - assert.equal(-1784072681, buffer.readInt32BE(2)); - assert.equal(-1449802942, buffer.readInt32LE(0)); - assert.equal(917083587, buffer.readInt32LE(1)); - assert.equal(389458325, buffer.readInt32LE(2)); + assert.strictEqual(0x42c395a9, buffer.readInt32BE(0)); + assert.strictEqual(-1013601994, buffer.readInt32BE(1)); + assert.strictEqual(-1784072681, buffer.readInt32BE(2)); + assert.strictEqual(-1449802942, buffer.readInt32LE(0)); + assert.strictEqual(917083587, buffer.readInt32LE(1)); + assert.strictEqual(389458325, buffer.readInt32LE(2)); } diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index e8fc92ad1c9e27..53c132dc30ec25 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -84,7 +84,7 @@ function isWarned(emitter) { called = false; rli.on('line', function(line) { called = true; - assert.equal(line, 'asdf'); + assert.strictEqual(line, 'asdf'); }); fi.emit('data', 'asdf\n'); assert.ok(called); @@ -95,7 +95,7 @@ function isWarned(emitter) { called = false; rli.on('line', function(line) { called = true; - assert.equal(line, ''); + assert.strictEqual(line, ''); }); fi.emit('data', '\n'); assert.ok(called); @@ -117,7 +117,7 @@ function isWarned(emitter) { called = false; rli.on('line', function(line) { called = true; - assert.equal(line, 'a'); + assert.strictEqual(line, 'a'); }); fi.emit('data', 'a'); assert.ok(!called); @@ -131,11 +131,11 @@ function isWarned(emitter) { let expectedLines = ['foo', 'bar', 'baz']; let callCount = 0; rli.on('line', function(line) { - assert.equal(line, expectedLines[callCount]); + assert.strictEqual(line, expectedLines[callCount]); callCount++; }); fi.emit('data', expectedLines.join('\n') + '\n'); - assert.equal(callCount, expectedLines.length); + assert.strictEqual(callCount, expectedLines.length); rli.close(); // sending multiple newlines at once that does not end with a new line @@ -144,11 +144,11 @@ function isWarned(emitter) { expectedLines = ['foo', 'bar', 'baz', 'bat']; callCount = 0; rli.on('line', function(line) { - assert.equal(line, expectedLines[callCount]); + assert.strictEqual(line, expectedLines[callCount]); callCount++; }); fi.emit('data', expectedLines.join('\n')); - assert.equal(callCount, expectedLines.length - 1); + assert.strictEqual(callCount, expectedLines.length - 1); rli.close(); // sending multiple newlines at once that does not end with a new(empty) @@ -158,7 +158,7 @@ function isWarned(emitter) { expectedLines = ['foo', 'bar', 'baz', '']; callCount = 0; rli.on('line', function(line) { - assert.equal(line, expectedLines[callCount]); + assert.strictEqual(line, expectedLines[callCount]); callCount++; }); rli.on('close', function() { @@ -166,7 +166,7 @@ function isWarned(emitter) { }); fi.emit('data', expectedLines.join('\n')); fi.emit('end'); - assert.equal(callCount, expectedLines.length); + assert.strictEqual(callCount, expectedLines.length); rli.close(); // sending multiple newlines at once that does not end with a new line @@ -178,11 +178,11 @@ function isWarned(emitter) { expectedLines = ['foo', 'bar', 'baz', 'bat']; callCount = 0; rli.on('line', function(line) { - assert.equal(line, expectedLines[callCount]); + assert.strictEqual(line, expectedLines[callCount]); callCount++; }); fi.emit('data', expectedLines.join('\r\n')); - assert.equal(callCount, expectedLines.length - 1); + assert.strictEqual(callCount, expectedLines.length - 1); rli.close(); // \r\n should emit one line event when split across multiple writes. @@ -191,14 +191,14 @@ function isWarned(emitter) { expectedLines = ['foo', 'bar', 'baz', 'bat']; callCount = 0; rli.on('line', function(line) { - assert.equal(line, expectedLines[callCount]); + assert.strictEqual(line, expectedLines[callCount]); callCount++; }); expectedLines.forEach(function(line) { fi.emit('data', line + '\r'); fi.emit('data', '\n'); }); - assert.equal(callCount, expectedLines.length); + assert.strictEqual(callCount, expectedLines.length); rli.close(); // \r should behave like \n when alone @@ -207,11 +207,11 @@ function isWarned(emitter) { expectedLines = ['foo', 'bar', 'baz', 'bat']; callCount = 0; rli.on('line', function(line) { - assert.equal(line, expectedLines[callCount]); + assert.strictEqual(line, expectedLines[callCount]); callCount++; }); fi.emit('data', expectedLines.join('\r')); - assert.equal(callCount, expectedLines.length - 1); + assert.strictEqual(callCount, expectedLines.length - 1); rli.close(); // \r at start of input should output blank line @@ -220,11 +220,11 @@ function isWarned(emitter) { expectedLines = ['', 'foo' ]; callCount = 0; rli.on('line', function(line) { - assert.equal(line, expectedLines[callCount]); + assert.strictEqual(line, expectedLines[callCount]); callCount++; }); fi.emit('data', '\rfoo\r'); - assert.equal(callCount, expectedLines.length); + assert.strictEqual(callCount, expectedLines.length); rli.close(); // Emit two line events when the delay @@ -245,7 +245,7 @@ function isWarned(emitter) { fi.emit('data', '\r'); setTimeout(common.mustCall(() => { fi.emit('data', '\n'); - assert.equal(callCount, 2); + assert.strictEqual(callCount, 2); rli.close(); }), delay * 2); } @@ -256,7 +256,7 @@ function isWarned(emitter) { rli = new readline.Interface({ input: fi, output: fi, terminal: true }); called = false; rli.on('line', function(line) { - assert.equal(line, '\t'); + assert.strictEqual(line, '\t'); assert.strictEqual(called, false); called = true; }); @@ -278,7 +278,7 @@ function isWarned(emitter) { }); called = false; rli.on('line', function(line) { - assert.equal(line, 'foo'); + assert.strictEqual(line, 'foo'); assert.strictEqual(called, false); called = true; }); @@ -312,14 +312,14 @@ function isWarned(emitter) { callCount = 0; rli.on('line', function(line) { callCount++; - assert.equal(line, buf.toString('utf8')); + assert.strictEqual(line, buf.toString('utf8')); }); [].forEach.call(buf, function(i) { fi.emit('data', Buffer.from([i])); }); - assert.equal(callCount, 0); + assert.strictEqual(callCount, 0); fi.emit('data', '\n'); - assert.equal(callCount, 1); + assert.strictEqual(callCount, 1); rli.close(); // Regression test for repl freeze, #1968: @@ -337,7 +337,7 @@ function isWarned(emitter) { fi.emit('data', 'fooX'); } catch (e) { } fi.emit('data', 'bar'); - assert.equal(keys.join(''), 'fooXbar'); + assert.strictEqual(keys.join(''), 'fooXbar'); rli.close(); // calling readline without `new` @@ -346,7 +346,7 @@ function isWarned(emitter) { called = false; rli.on('line', function(line) { called = true; - assert.equal(line, 'asdf'); + assert.strictEqual(line, 'asdf'); }); fi.emit('data', 'asdf\n'); assert.ok(called); @@ -361,8 +361,8 @@ function isWarned(emitter) { rli.close(); }); let cursorPos = rli._getCursorPos(); - assert.equal(cursorPos.rows, 0); - assert.equal(cursorPos.cols, expectedLines[0].length); + assert.strictEqual(cursorPos.rows, 0); + assert.strictEqual(cursorPos.cols, expectedLines[0].length); rli.close(); // sending a multi-line question @@ -373,8 +373,8 @@ function isWarned(emitter) { rli.close(); }); cursorPos = rli._getCursorPos(); - assert.equal(cursorPos.rows, expectedLines.length - 1); - assert.equal(cursorPos.cols, expectedLines.slice(-1)[0].length); + assert.strictEqual(cursorPos.rows, expectedLines.length - 1); + assert.strictEqual(cursorPos.cols, expectedLines.slice(-1)[0].length); rli.close(); } @@ -384,17 +384,21 @@ function isWarned(emitter) { }); // wide characters should be treated as two columns. - assert.equal(internalReadline.isFullWidthCodePoint('a'.charCodeAt(0)), false); - assert.equal(internalReadline.isFullWidthCodePoint('あ'.charCodeAt(0)), true); - assert.equal(internalReadline.isFullWidthCodePoint('谢'.charCodeAt(0)), true); - assert.equal(internalReadline.isFullWidthCodePoint('고'.charCodeAt(0)), true); - assert.equal(internalReadline.isFullWidthCodePoint(0x1f251), true); - assert.equal(internalReadline.getStringWidth('abcde'), 5); - assert.equal(internalReadline.getStringWidth('古池や'), 6); - assert.equal(internalReadline.getStringWidth('ノード.js'), 9); - assert.equal(internalReadline.getStringWidth('你好'), 4); - assert.equal(internalReadline.getStringWidth('안녕하세요'), 10); - assert.equal(internalReadline.getStringWidth('A\ud83c\ude00BC'), 5); + assert.strictEqual(internalReadline.isFullWidthCodePoint('a'.charCodeAt(0)), + false); + assert.strictEqual(internalReadline.isFullWidthCodePoint('あ'.charCodeAt(0)), + true); + assert.strictEqual(internalReadline.isFullWidthCodePoint('谢'.charCodeAt(0)), + true); + assert.strictEqual(internalReadline.isFullWidthCodePoint('고'.charCodeAt(0)), + true); + assert.strictEqual(internalReadline.isFullWidthCodePoint(0x1f251), true); + assert.strictEqual(internalReadline.getStringWidth('abcde'), 5); + assert.strictEqual(internalReadline.getStringWidth('古池や'), 6); + assert.strictEqual(internalReadline.getStringWidth('ノード.js'), 9); + assert.strictEqual(internalReadline.getStringWidth('你好'), 4); + assert.strictEqual(internalReadline.getStringWidth('안녕하세요'), 10); + assert.strictEqual(internalReadline.getStringWidth('A\ud83c\ude00BC'), 5); // check if vt control chars are stripped assert.strictEqual( @@ -413,10 +417,13 @@ function isWarned(emitter) { internalReadline.stripVTControlCharacters('> '), '> ' ); - assert.equal(internalReadline.getStringWidth('\u001b[31m> \u001b[39m'), 2); - assert.equal(internalReadline.getStringWidth('\u001b[31m> \u001b[39m> '), 4); - assert.equal(internalReadline.getStringWidth('\u001b[31m\u001b[39m'), 0); - assert.equal(internalReadline.getStringWidth('> '), 2); + assert.strictEqual(internalReadline + .getStringWidth('\u001b[31m> \u001b[39m'), 2); + assert.strictEqual(internalReadline + .getStringWidth('\u001b[31m> \u001b[39m> '), 4); + assert.strictEqual(internalReadline + .getStringWidth('\u001b[31m\u001b[39m'), 0); + assert.strictEqual(internalReadline.getStringWidth('> '), 2); assert.deepStrictEqual(fi.listeners(terminal ? 'keypress' : 'data'), []); @@ -427,8 +434,8 @@ function isWarned(emitter) { output: process.stdout }); rl.close(); - assert.equal(isWarned(process.stdin._events), false); - assert.equal(isWarned(process.stdout._events), false); + assert.strictEqual(isWarned(process.stdin._events), false); + assert.strictEqual(isWarned(process.stdout._events), false); } //can create a new readline Interface with a null output arugument @@ -438,7 +445,7 @@ function isWarned(emitter) { called = false; rli.on('line', function(line) { called = true; - assert.equal(line, 'asdf'); + assert.strictEqual(line, 'asdf'); }); fi.emit('data', 'asdf\n'); assert.ok(called); diff --git a/test/parallel/test-readline-set-raw-mode.js b/test/parallel/test-readline-set-raw-mode.js index 78c42f5f5f627d..389f014bc3e19a 100644 --- a/test/parallel/test-readline-set-raw-mode.js +++ b/test/parallel/test-readline-set-raw-mode.js @@ -12,7 +12,7 @@ let pauseCalled = false; stream.setRawMode = function(mode) { rawModeCalled = true; - assert.equal(mode, expectedRawMode); + assert.strictEqual(mode, expectedRawMode); }; stream.resume = function() { resumeCalled = true; @@ -66,4 +66,4 @@ assert(pauseCalled); assert.deepStrictEqual(stream.listeners('keypress'), []); // one data listener for the keypress events. -assert.equal(stream.listeners('data').length, 1); +assert.strictEqual(stream.listeners('data').length, 1); diff --git a/test/parallel/test-readuint.js b/test/parallel/test-readuint.js index 0d1f79b12eabd4..d1507a81b5188a 100644 --- a/test/parallel/test-readuint.js +++ b/test/parallel/test-readuint.js @@ -20,13 +20,13 @@ function test8(clazz) { data[1] = 23; data[2] = 23; data[3] = 23; - assert.equal(23, data.readUInt8(0)); - assert.equal(23, data.readUInt8(1)); - assert.equal(23, data.readUInt8(2)); - assert.equal(23, data.readUInt8(3)); + assert.strictEqual(23, data.readUInt8(0)); + assert.strictEqual(23, data.readUInt8(1)); + assert.strictEqual(23, data.readUInt8(2)); + assert.strictEqual(23, data.readUInt8(3)); data[0] = 255; /* If it became a signed int, would be -1 */ - assert.equal(255, data.readUInt8(0)); + assert.strictEqual(255, data.readUInt8(0)); } @@ -45,17 +45,17 @@ function test16(clazz) { data[1] = 0x23; data[2] = 0x42; data[3] = 0x3f; - assert.equal(0x23, data.readUInt16BE(0)); - assert.equal(0x2342, data.readUInt16BE(1)); - assert.equal(0x423f, data.readUInt16BE(2)); - assert.equal(0x2300, data.readUInt16LE(0)); - assert.equal(0x4223, data.readUInt16LE(1)); - assert.equal(0x3f42, data.readUInt16LE(2)); + assert.strictEqual(0x23, data.readUInt16BE(0)); + assert.strictEqual(0x2342, data.readUInt16BE(1)); + assert.strictEqual(0x423f, data.readUInt16BE(2)); + assert.strictEqual(0x2300, data.readUInt16LE(0)); + assert.strictEqual(0x4223, data.readUInt16LE(1)); + assert.strictEqual(0x3f42, data.readUInt16LE(2)); data[0] = 0xfe; data[1] = 0xfe; - assert.equal(0xfefe, data.readUInt16BE(0)); - assert.equal(0xfefe, data.readUInt16LE(0)); + assert.strictEqual(0xfefe, data.readUInt16BE(0)); + assert.strictEqual(0xfefe, data.readUInt16LE(0)); } @@ -75,12 +75,12 @@ function test32(clazz) { data[3] = 0x56; data[4] = 0x23; data[5] = 0xff; - assert.equal(0x32654256, data.readUInt32BE(0)); - assert.equal(0x65425623, data.readUInt32BE(1)); - assert.equal(0x425623ff, data.readUInt32BE(2)); - assert.equal(0x56426532, data.readUInt32LE(0)); - assert.equal(0x23564265, data.readUInt32LE(1)); - assert.equal(0xff235642, data.readUInt32LE(2)); + assert.strictEqual(0x32654256, data.readUInt32BE(0)); + assert.strictEqual(0x65425623, data.readUInt32BE(1)); + assert.strictEqual(0x425623ff, data.readUInt32BE(2)); + assert.strictEqual(0x56426532, data.readUInt32LE(0)); + assert.strictEqual(0x23564265, data.readUInt32LE(1)); + assert.strictEqual(0xff235642, data.readUInt32LE(2)); } diff --git a/test/parallel/test-regress-GH-1899.js b/test/parallel/test-regress-GH-1899.js index 838391acd23b5f..a072bc551a5c4f 100644 --- a/test/parallel/test-regress-GH-1899.js +++ b/test/parallel/test-regress-GH-1899.js @@ -14,6 +14,6 @@ child.stdout.on('data', function(data) { }); child.on('exit', function(code, signal) { - assert.equal(code, 0); - assert.equal(output, 'hello, world!\n'); + assert.strictEqual(code, 0); + assert.strictEqual(output, 'hello, world!\n'); }); diff --git a/test/parallel/test-regress-GH-5051.js b/test/parallel/test-regress-GH-5051.js index a86d0943d313fe..f2562bd7eb8020 100644 --- a/test/parallel/test-regress-GH-5051.js +++ b/test/parallel/test-regress-GH-5051.js @@ -13,8 +13,8 @@ agent.maxSockets = 0; // localAddress is used when naming requests / sockets // while using the Legacy API agent.addRequest(req, 'localhost', common.PORT, '127.0.0.1'); -assert.equal(Object.keys(agent.requests).length, 1); -assert.equal( +assert.strictEqual(Object.keys(agent.requests).length, 1); +assert.strictEqual( Object.keys(agent.requests)[0], 'localhost:' + common.PORT + ':127.0.0.1'); @@ -25,7 +25,7 @@ agent.addRequest(req, { localAddress: '127.0.0.1', path: '/foo' }); -assert.equal(Object.keys(agent.requests).length, 1); -assert.equal( +assert.strictEqual(Object.keys(agent.requests).length, 1); +assert.strictEqual( Object.keys(agent.requests)[0], 'localhost:' + common.PORT + ':127.0.0.1'); diff --git a/test/parallel/test-regress-GH-5727.js b/test/parallel/test-regress-GH-5727.js index 3f52c55e7aaca6..5fe9776d9b30fc 100644 --- a/test/parallel/test-regress-GH-5727.js +++ b/test/parallel/test-regress-GH-5727.js @@ -10,7 +10,7 @@ net.Server().listen(common.PORT, function() { const address = this.address(); const key = `${address.family.slice(-1)}:${address.address}:${common.PORT}`; - assert.equal(this._connectionKey, key); + assert.strictEqual(this._connectionKey, key); this.close(); }); diff --git a/test/parallel/test-repl-.save.load.js b/test/parallel/test-repl-.save.load.js index 00d5f6791d54a5..449dd28e90d59e 100644 --- a/test/parallel/test-repl-.save.load.js +++ b/test/parallel/test-repl-.save.load.js @@ -27,7 +27,8 @@ putIn.run(testFile); putIn.run(['.save ' + saveFileName]); // the file should have what I wrote -assert.equal(fs.readFileSync(saveFileName, 'utf8'), testFile.join('\n') + '\n'); +assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'), testFile.join('\n') + + '\n'); { // save .editor mode code @@ -74,7 +75,7 @@ let loadFile = join(common.tmpDir, 'file.does.not.exist'); // should not break putIn.write = function(data) { // make sure I get a failed to load message and not some crazy error - assert.equal(data, 'Failed to load:' + loadFile + '\n'); + assert.strictEqual(data, 'Failed to load:' + loadFile + '\n'); // eat me to avoid work putIn.write = function() {}; }; @@ -83,7 +84,8 @@ putIn.run(['.load ' + loadFile]); // throw error on loading directory loadFile = common.tmpDir; putIn.write = function(data) { - assert.equal(data, 'Failed to load:' + loadFile + ' is not a valid file\n'); + assert.strictEqual(data, 'Failed to load:' + loadFile + + ' is not a valid file\n'); putIn.write = function() {}; }; putIn.run(['.load ' + loadFile]); @@ -98,7 +100,7 @@ const invalidFileName = join(common.tmpDir, '\0\0\0\0\0'); // should not break putIn.write = function(data) { // make sure I get a failed to save message and not some other error - assert.equal(data, 'Failed to save:' + invalidFileName + '\n'); + assert.strictEqual(data, 'Failed to save:' + invalidFileName + '\n'); // reset to no-op putIn.write = function() {}; }; diff --git a/test/parallel/test-repl-autolibs.js b/test/parallel/test-repl-autolibs.js index e0554831cdca50..ce108ba2aa859f 100644 --- a/test/parallel/test-repl-autolibs.js +++ b/test/parallel/test-repl-autolibs.js @@ -19,9 +19,10 @@ function test1() { if (data.length) { // inspect output matches repl output - assert.equal(data, util.inspect(require('fs'), null, 2, false) + '\n'); + assert.strictEqual(data, util.inspect(require('fs'), null, 2, false) + + '\n'); // globally added lib matches required lib - assert.equal(global.fs, require('fs')); + assert.strictEqual(global.fs, require('fs')); test2(); } }; @@ -36,9 +37,9 @@ function test2() { gotWrite = true; if (data.length) { // repl response error message - assert.equal(data, '{}\n'); + assert.strictEqual(data, '{}\n'); // original value wasn't overwritten - assert.equal(val, global.url); + assert.strictEqual(val, global.url); } }; const val = {}; diff --git a/test/parallel/test-repl-end-emits-exit.js b/test/parallel/test-repl-end-emits-exit.js index 661f9f0ad0e3a4..c62a51c9626e24 100644 --- a/test/parallel/test-repl-end-emits-exit.js +++ b/test/parallel/test-repl-end-emits-exit.js @@ -45,8 +45,8 @@ function testRegularMode() { } process.on('exit', function() { - assert.equal(terminalExit, 1); - assert.equal(regularExit, 1); + assert.strictEqual(terminalExit, 1); + assert.strictEqual(regularExit, 1); }); diff --git a/test/parallel/test-repl-envvars.js b/test/parallel/test-repl-envvars.js index e8c369b244c607..bd4e1fc9afb679 100644 --- a/test/parallel/test-repl-envvars.js +++ b/test/parallel/test-repl-envvars.js @@ -50,10 +50,10 @@ function run(test) { // The REPL registers 'module' and 'require' globals common.allowGlobals(repl.context.module, repl.context.require); - assert.equal(expected.terminal, repl.terminal, - 'Expected ' + inspect(expected) + ' with ' + inspect(env)); - assert.equal(expected.useColors, repl.useColors, - 'Expected ' + inspect(expected) + ' with ' + inspect(env)); + assert.strictEqual(expected.terminal, repl.terminal, 'Expected ' + + inspect(expected) + ' with ' + inspect(env)); + assert.strictEqual(expected.useColors, repl.useColors, 'Expected ' + + inspect(expected) + ' with ' + inspect(env)); repl.close(); }); } diff --git a/test/parallel/test-repl-options.js b/test/parallel/test-repl-options.js index 79994c66d148c0..03db110aca6dbc 100644 --- a/test/parallel/test-repl-options.js +++ b/test/parallel/test-repl-options.js @@ -15,24 +15,24 @@ const r1 = repl.start({ terminal: true }); -assert.equal(r1.input, stream); -assert.equal(r1.output, stream); -assert.equal(r1.input, r1.inputStream); -assert.equal(r1.output, r1.outputStream); -assert.equal(r1.terminal, true); -assert.equal(r1.useColors, r1.terminal); -assert.equal(r1.useGlobal, false); -assert.equal(r1.ignoreUndefined, false); -assert.equal(r1.replMode, repl.REPL_MODE_SLOPPY); -assert.equal(r1.historySize, 30); +assert.strictEqual(r1.input, stream); +assert.strictEqual(r1.output, stream); +assert.strictEqual(r1.input, r1.inputStream); +assert.strictEqual(r1.output, r1.outputStream); +assert.strictEqual(r1.terminal, true); +assert.strictEqual(r1.useColors, r1.terminal); +assert.strictEqual(r1.useGlobal, false); +assert.strictEqual(r1.ignoreUndefined, false); +assert.strictEqual(r1.replMode, repl.REPL_MODE_SLOPPY); +assert.strictEqual(r1.historySize, 30); // test r1 for backwards compact -assert.equal(r1.rli.input, stream); -assert.equal(r1.rli.output, stream); -assert.equal(r1.rli.input, r1.inputStream); -assert.equal(r1.rli.output, r1.outputStream); -assert.equal(r1.rli.terminal, true); -assert.equal(r1.useColors, r1.rli.terminal); +assert.strictEqual(r1.rli.input, stream); +assert.strictEqual(r1.rli.output, stream); +assert.strictEqual(r1.rli.input, r1.inputStream); +assert.strictEqual(r1.rli.output, r1.outputStream); +assert.strictEqual(r1.rli.terminal, true); +assert.strictEqual(r1.useColors, r1.rli.terminal); // 2 function writer() {} @@ -48,23 +48,23 @@ const r2 = repl.start({ writer: writer, replMode: repl.REPL_MODE_STRICT }); -assert.equal(r2.input, stream); -assert.equal(r2.output, stream); -assert.equal(r2.input, r2.inputStream); -assert.equal(r2.output, r2.outputStream); -assert.equal(r2.terminal, false); -assert.equal(r2.useColors, true); -assert.equal(r2.useGlobal, true); -assert.equal(r2.ignoreUndefined, true); -assert.equal(r2.writer, writer); -assert.equal(r2.replMode, repl.REPL_MODE_STRICT); +assert.strictEqual(r2.input, stream); +assert.strictEqual(r2.output, stream); +assert.strictEqual(r2.input, r2.inputStream); +assert.strictEqual(r2.output, r2.outputStream); +assert.strictEqual(r2.terminal, false); +assert.strictEqual(r2.useColors, true); +assert.strictEqual(r2.useGlobal, true); +assert.strictEqual(r2.ignoreUndefined, true); +assert.strictEqual(r2.writer, writer); +assert.strictEqual(r2.replMode, repl.REPL_MODE_STRICT); // test r2 for backwards compact -assert.equal(r2.rli.input, stream); -assert.equal(r2.rli.output, stream); -assert.equal(r2.rli.input, r2.inputStream); -assert.equal(r2.rli.output, r2.outputStream); -assert.equal(r2.rli.terminal, false); +assert.strictEqual(r2.rli.input, stream); +assert.strictEqual(r2.rli.output, stream); +assert.strictEqual(r2.rli.input, r2.inputStream); +assert.strictEqual(r2.rli.output, r2.outputStream); +assert.strictEqual(r2.rli.terminal, false); // testing out "magic" replMode const r3 = repl.start({ @@ -75,8 +75,8 @@ const r3 = repl.start({ historySize: 50 }); -assert.equal(r3.replMode, repl.REPL_MODE_MAGIC); -assert.equal(r3.historySize, 50); +assert.strictEqual(r3.replMode, repl.REPL_MODE_MAGIC); +assert.strictEqual(r3.historySize, 50); // Verify that defaults are used when no arguments are provided const r4 = repl.start(); diff --git a/test/parallel/test-repl-require-cache.js b/test/parallel/test-repl-require-cache.js index 8a5d384935efd4..4ccabe473cdbe8 100644 --- a/test/parallel/test-repl-require-cache.js +++ b/test/parallel/test-repl-require-cache.js @@ -6,8 +6,8 @@ const repl = require('repl'); // https://github.com/joyent/node/issues/3226 require.cache.something = 1; -assert.equal(require.cache.something, 1); +assert.strictEqual(require.cache.something, 1); repl.start({ useGlobal: false }).close(); -assert.equal(require.cache.something, 1); +assert.strictEqual(require.cache.something, 1); diff --git a/test/parallel/test-repl-syntax-error-handling.js b/test/parallel/test-repl-syntax-error-handling.js index 6a65d53a029379..9014f9a02f22be 100644 --- a/test/parallel/test-repl-syntax-error-handling.js +++ b/test/parallel/test-repl-syntax-error-handling.js @@ -27,7 +27,7 @@ function parent() { out += c; }); child.stdout.on('end', function() { - assert.equal(out, '10\n'); + assert.strictEqual(out, '10\n'); console.log('ok - got expected output'); }); diff --git a/test/parallel/test-repl-tab.js b/test/parallel/test-repl-tab.js index 7baa7d0aace812..92168b2e1df56f 100644 --- a/test/parallel/test-repl-tab.js +++ b/test/parallel/test-repl-tab.js @@ -14,5 +14,5 @@ const testMe = repl.start('', putIn, function(cmd, context, filename, testMe._domain.on('error', common.fail); testMe.complete('', function(err, results) { - assert.equal(err, null); + assert.strictEqual(err, null); }); diff --git a/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js b/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js index aa749591eb553a..85fc7ec913482d 100644 --- a/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js +++ b/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js @@ -7,4 +7,4 @@ const content = require(common.fixturesDir + '/json-with-directory-name-module/module-stub/one-trailing-slash/two/three.js'); assert.notStrictEqual(content.rocko, 'artischocko'); -assert.equal(content, 'hello from module-stub!'); +assert.strictEqual(content, 'hello from module-stub!'); diff --git a/test/parallel/test-require-unicode.js b/test/parallel/test-require-unicode.js index 0bccf06916c326..93a8787cdfe7c8 100644 --- a/test/parallel/test-require-unicode.js +++ b/test/parallel/test-require-unicode.js @@ -12,5 +12,5 @@ fs.mkdirSync(dirname); fs.writeFileSync(path.join(dirname, 'file.js'), 'module.exports = 42;'); fs.writeFileSync(path.join(dirname, 'package.json'), JSON.stringify({ name: 'test', main: 'file.js' })); -assert.equal(require(dirname), 42); -assert.equal(require(path.join(dirname, 'file.js')), 42); +assert.strictEqual(require(dirname), 42); +assert.strictEqual(require(path.join(dirname, 'file.js')), 42); diff --git a/test/parallel/test-socket-write-after-fin-error.js b/test/parallel/test-socket-write-after-fin-error.js index f21b52d519b2ba..37d042b4c6031a 100644 --- a/test/parallel/test-socket-write-after-fin-error.js +++ b/test/parallel/test-socket-write-after-fin-error.js @@ -43,12 +43,12 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(clientData, ''); - assert.equal(serverData, 'hello1hello2hello3\nTHUNDERMUSCLE!'); + assert.strictEqual(clientData, ''); + assert.strictEqual(serverData, 'hello1hello2hello3\nTHUNDERMUSCLE!'); assert(gotClientEnd); assert(gotServerEnd); assert(gotServerError); - assert.equal(gotServerError.code, 'EPIPE'); + assert.strictEqual(gotServerError.code, 'EPIPE'); assert.notStrictEqual(gotServerError.message, 'write after end'); console.log('ok'); }); diff --git a/test/parallel/test-stdin-child-proc.js b/test/parallel/test-stdin-child-proc.js index 35ae0c99d3c8ff..5359edc53a42ba 100644 --- a/test/parallel/test-stdin-child-proc.js +++ b/test/parallel/test-stdin-child-proc.js @@ -9,5 +9,5 @@ const cp = child_process.spawn(process.execPath, [path.resolve(__dirname, 'test-stdin-pause-resume.js')]); cp.on('exit', common.mustCall((code) => { - assert.equal(code, 0); + assert.strictEqual(code, 0); })); diff --git a/test/parallel/test-stdin-pipe-resume.js b/test/parallel/test-stdin-pipe-resume.js index 06cce3edfe403f..e9000933a37cfa 100644 --- a/test/parallel/test-stdin-pipe-resume.js +++ b/test/parallel/test-stdin-pipe-resume.js @@ -14,7 +14,7 @@ if (process.argv[2] === 'child') { }); child.stdout.on('close', function() { const b = Buffer.concat(buffers).toString(); - assert.equal(b, 'Hello, world\n'); + assert.strictEqual(b, 'Hello, world\n'); console.log('ok'); }); child.stdin.write('Hel'); diff --git a/test/parallel/test-stdout-cannot-be-closed-child-process-pipe.js b/test/parallel/test-stdout-cannot-be-closed-child-process-pipe.js index aa1939ebe2c334..d19b522e290ba9 100644 --- a/test/parallel/test-stdout-cannot-be-closed-child-process-pipe.js +++ b/test/parallel/test-stdout-cannot-be-closed-child-process-pipe.js @@ -25,7 +25,7 @@ function parent() { child.on('close', function(code, signal) { assert(code); - assert.equal(out, 'foo'); + assert.strictEqual(out, 'foo'); assert(/process\.stdout cannot be closed/.test(err)); console.log('ok'); }); diff --git a/test/parallel/test-stdout-stderr-reading.js b/test/parallel/test-stdout-stderr-reading.js index 6aa961301349fc..11cdcc390768a3 100644 --- a/test/parallel/test-stdout-stderr-reading.js +++ b/test/parallel/test-stdout-stderr-reading.js @@ -36,7 +36,7 @@ function parent() { c1.on('close', common.mustCall(function(code, signal) { assert(!code); assert(!signal); - assert.equal(c1out, 'ok\n'); + assert.strictEqual(c1out, 'ok\n'); console.log('ok'); })); @@ -53,7 +53,7 @@ function parent() { c2.on('close', common.mustCall(function(code, signal) { assert(!code); assert(!signal); - assert.equal(c2out, 'ok\n'); + assert.strictEqual(c2out, 'ok\n'); console.log('ok'); })); } diff --git a/test/parallel/test-stream-base-no-abort.js b/test/parallel/test-stream-base-no-abort.js index 6b1cc67ee7777e..8b85acea2fb7ea 100644 --- a/test/parallel/test-stream-base-no-abort.js +++ b/test/parallel/test-stream-base-no-abort.js @@ -17,21 +17,21 @@ const providers = Object.keys(async_wrap.Providers); let flags = 0; // Make sure all asserts have run at least once. -process.on('exit', () => assert.equal(flags, 0b111)); +process.on('exit', () => assert.strictEqual(flags, 0b111)); function init(id, provider) { this._external; // Test will abort if nullptr isn't properly checked. switch (providers[provider]) { case 'TCPWRAP': - assert.equal(this.fd, uv.UV_EINVAL); + assert.strictEqual(this.fd, uv.UV_EINVAL); flags |= 0b1; break; case 'TLSWRAP': - assert.equal(this.fd, uv.UV_EINVAL); + assert.strictEqual(this.fd, uv.UV_EINVAL); flags |= 0b10; break; case 'UDPWRAP': - assert.equal(this.fd, uv.UV_EBADF); + assert.strictEqual(this.fd, uv.UV_EBADF); flags |= 0b100; break; } diff --git a/test/parallel/test-stream-push-strings.js b/test/parallel/test-stream-push-strings.js index 7bce493bbd33ce..e77d8a48c679ef 100644 --- a/test/parallel/test-stream-push-strings.js +++ b/test/parallel/test-stream-push-strings.js @@ -40,7 +40,7 @@ ms.on('readable', function() { const expect = [ 'first chunksecond to last chunk', 'last chunk' ]; process.on('exit', function() { - assert.equal(ms._chunks, -1); + assert.strictEqual(ms._chunks, -1); assert.deepStrictEqual(results, expect); console.log('ok'); }); diff --git a/test/parallel/test-stream-readable-constructor-set-methods.js b/test/parallel/test-stream-readable-constructor-set-methods.js index a5d7e48bfb3fa9..e5e3114de456db 100644 --- a/test/parallel/test-stream-readable-constructor-set-methods.js +++ b/test/parallel/test-stream-readable-constructor-set-methods.js @@ -14,6 +14,6 @@ const r = new Readable({ read: _read }); r.resume(); process.on('exit', function() { - assert.equal(r._read, _read); + assert.strictEqual(r._read, _read); assert(_readCalled); }); diff --git a/test/parallel/test-stream-readable-flow-recursion.js b/test/parallel/test-stream-readable-flow-recursion.js index b1e421a71fd15b..e29553900511c3 100644 --- a/test/parallel/test-stream-readable-flow-recursion.js +++ b/test/parallel/test-stream-readable-flow-recursion.js @@ -45,12 +45,12 @@ flow(stream, 5000, function() { }); process.on('exit', function(code) { - assert.equal(reads, 2); + assert.strictEqual(reads, 2); // we pushed up the high water mark - assert.equal(stream._readableState.highWaterMark, 8192); + assert.strictEqual(stream._readableState.highWaterMark, 8192); // length is 0 right now, because we pulled it all out. - assert.equal(stream._readableState.length, 0); + assert.strictEqual(stream._readableState.length, 0); assert(!code); - assert.equal(depth, 0); + assert.strictEqual(depth, 0); console.log('ok'); }); diff --git a/test/parallel/test-stream-transform-constructor-set-methods.js b/test/parallel/test-stream-transform-constructor-set-methods.js index 7be673c517b30b..02ef9f55cb4460 100644 --- a/test/parallel/test-stream-transform-constructor-set-methods.js +++ b/test/parallel/test-stream-transform-constructor-set-methods.js @@ -25,8 +25,8 @@ t.end(Buffer.from('blerg')); t.resume(); process.on('exit', function() { - assert.equal(t._transform, _transform); - assert.equal(t._flush, _flush); + assert.strictEqual(t._transform, _transform); + assert.strictEqual(t._flush, _flush); assert(_transformCalled); assert(_flushCalled); }); diff --git a/test/parallel/test-stream-writable-change-default-encoding.js b/test/parallel/test-stream-writable-change-default-encoding.js index 9eac52bc1aea44..c3af66ce83701c 100644 --- a/test/parallel/test-stream-writable-change-default-encoding.js +++ b/test/parallel/test-stream-writable-change-default-encoding.js @@ -19,7 +19,7 @@ MyWritable.prototype._write = function(chunk, encoding, callback) { (function defaultCondingIsUtf8() { const m = new MyWritable(function(isBuffer, type, enc) { - assert.equal(enc, 'utf8'); + assert.strictEqual(enc, 'utf8'); }, { decodeStrings: false }); m.write('foo'); m.end(); @@ -27,7 +27,7 @@ MyWritable.prototype._write = function(chunk, encoding, callback) { (function changeDefaultEncodingToAscii() { const m = new MyWritable(function(isBuffer, type, enc) { - assert.equal(enc, 'ascii'); + assert.strictEqual(enc, 'ascii'); }, { decodeStrings: false }); m.setDefaultEncoding('ascii'); m.write('bar'); @@ -44,7 +44,7 @@ assert.throws(function changeDefaultEncodingToInvalidValue() { (function checkVairableCaseEncoding() { const m = new MyWritable(function(isBuffer, type, enc) { - assert.equal(enc, 'ascii'); + assert.strictEqual(enc, 'ascii'); }, { decodeStrings: false }); m.setDefaultEncoding('AsCii'); m.write('bar'); diff --git a/test/parallel/test-stream-writable-constructor-set-methods.js b/test/parallel/test-stream-writable-constructor-set-methods.js index 9b344487f61580..a12112d1ecc266 100644 --- a/test/parallel/test-stream-writable-constructor-set-methods.js +++ b/test/parallel/test-stream-writable-constructor-set-methods.js @@ -27,9 +27,9 @@ w2.write(Buffer.from('blerg')); w2.end(); process.on('exit', function() { - assert.equal(w._write, _write); + assert.strictEqual(w._write, _write); assert(_writeCalled); - assert.equal(w2._writev, _writev); - assert.equal(dLength, 2); + assert.strictEqual(w2._writev, _writev); + assert.strictEqual(dLength, 2); assert(_writevCalled); }); diff --git a/test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js b/test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js index 3751cd9de6461d..dbd306c53f9ccb 100644 --- a/test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js +++ b/test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js @@ -7,7 +7,7 @@ const stream = require('stream'); const writable = new stream.Writable(); writable._writev = common.mustCall((chunks, cb) => { - assert.equal(chunks.length, 2, 'two chunks to write'); + assert.strictEqual(chunks.length, 2, 'two chunks to write'); cb(); }, 1); diff --git a/test/parallel/test-stream-writev.js b/test/parallel/test-stream-writev.js index 4e05d2ba8e70e8..2caaf0a7d236c1 100644 --- a/test/parallel/test-stream-writev.js +++ b/test/parallel/test-stream-writev.js @@ -33,7 +33,7 @@ function test(decode, uncork, multi, next) { return function(er) { assert.ifError(er); counter++; - assert.equal(counter, expect); + assert.strictEqual(counter, expect); }; } diff --git a/test/parallel/test-stream2-base64-single-char-read-end.js b/test/parallel/test-stream2-base64-single-char-read-end.js index da63644de099a1..6a9edbd4eaacbe 100644 --- a/test/parallel/test-stream2-base64-single-char-read-end.js +++ b/test/parallel/test-stream2-base64-single-char-read-end.js @@ -25,7 +25,7 @@ dst._write = function(chunk, enc, cb) { }; src.on('end', function() { - assert.equal(Buffer.concat(accum) + '', 'MQ=='); + assert.strictEqual(Buffer.concat(accum) + '', 'MQ=='); clearTimeout(timeout); }); diff --git a/test/parallel/test-stream2-compatibility.js b/test/parallel/test-stream2-compatibility.js index f7c980791311da..a353da8dede305 100644 --- a/test/parallel/test-stream2-compatibility.js +++ b/test/parallel/test-stream2-compatibility.js @@ -26,7 +26,7 @@ TestReader.prototype._read = function(n) { const reader = new TestReader(); setImmediate(function() { - assert.equal(ondataCalled, 1); + assert.strictEqual(ondataCalled, 1); console.log('ok'); reader.push(null); }); diff --git a/test/parallel/test-stream2-large-read-stall.js b/test/parallel/test-stream2-large-read-stall.js index 88fef4f24b6c30..36d4e0c6c9d7c9 100644 --- a/test/parallel/test-stream2-large-read-stall.js +++ b/test/parallel/test-stream2-large-read-stall.js @@ -51,5 +51,5 @@ function push() { } process.on('exit', function() { - assert.equal(pushes, PUSHCOUNT + 1); + assert.strictEqual(pushes, PUSHCOUNT + 1); }); diff --git a/test/parallel/test-stream2-objects.js b/test/parallel/test-stream2-objects.js index 6c00f1b8691364..cab838fbfc9acb 100644 --- a/test/parallel/test-stream2-objects.js +++ b/test/parallel/test-stream2-objects.js @@ -23,7 +23,7 @@ function run() { console.log('# %s', name); fn({ same: assert.deepStrictEqual, - equal: assert.equal, + equal: assert.strictEqual, end: function() { count--; run(); diff --git a/test/parallel/test-stream2-readable-from-list.js b/test/parallel/test-stream2-readable-from-list.js index f3f39507e89dab..54db1d1c182526 100644 --- a/test/parallel/test-stream2-readable-from-list.js +++ b/test/parallel/test-stream2-readable-from-list.js @@ -24,7 +24,7 @@ function run() { console.log('# %s', name); fn({ same: assert.deepStrictEqual, - equal: assert.equal, + equal: assert.strictEqual, end: function() { count--; run(); @@ -41,7 +41,7 @@ function bufferListFromArray(arr) { // ensure all tests have run process.on('exit', function() { - assert.equal(count, 0); + assert.strictEqual(count, 0); }); process.nextTick(run); diff --git a/test/parallel/test-stream2-readable-non-empty-end.js b/test/parallel/test-stream2-readable-non-empty-end.js index 66fae8274ecf3c..46481fe1dcda4c 100644 --- a/test/parallel/test-stream2-readable-non-empty-end.js +++ b/test/parallel/test-stream2-readable-non-empty-end.js @@ -45,7 +45,7 @@ function next() { // one to get the last byte let r = test.read(); assert(r); - assert.equal(r.length, 1); + assert.strictEqual(r.length, 1); r = test.read(); - assert.equal(r, null); + assert.strictEqual(r, null); } diff --git a/test/parallel/test-stream2-set-encoding.js b/test/parallel/test-stream2-set-encoding.js index fdbd81e61332b1..a207168f39a97e 100644 --- a/test/parallel/test-stream2-set-encoding.js +++ b/test/parallel/test-stream2-set-encoding.js @@ -23,7 +23,7 @@ function run() { console.log('# %s', name); fn({ same: assert.deepStrictEqual, - equal: assert.equal, + equal: assert.strictEqual, end: function() { count--; run(); @@ -33,7 +33,7 @@ function run() { // ensure all tests have run process.on('exit', function() { - assert.equal(count, 0); + assert.strictEqual(count, 0); }); process.nextTick(run); diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index d66f1f064375e4..2695ac21b752c4 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -23,7 +23,7 @@ function run() { console.log('# %s', name); fn({ same: assert.deepStrictEqual, - equal: assert.equal, + equal: assert.strictEqual, ok: assert, end: function() { count--; @@ -34,7 +34,7 @@ function run() { // ensure all tests have run process.on('exit', function() { - assert.equal(count, 0); + assert.strictEqual(count, 0); }); process.nextTick(run); diff --git a/test/parallel/test-stream2-unpipe-leak.js b/test/parallel/test-stream2-unpipe-leak.js index 1a1599ca32b4c7..8800a2bbc68e45 100644 --- a/test/parallel/test-stream2-unpipe-leak.js +++ b/test/parallel/test-stream2-unpipe-leak.js @@ -36,14 +36,14 @@ for (let i = 0; i < 10; i++) { src.unpipe(dest); } -assert.equal(src.listeners('end').length, 0); -assert.equal(src.listeners('readable').length, 0); - -assert.equal(dest.listeners('unpipe').length, 0); -assert.equal(dest.listeners('drain').length, 0); -assert.equal(dest.listeners('error').length, 0); -assert.equal(dest.listeners('close').length, 0); -assert.equal(dest.listeners('finish').length, 0); +assert.strictEqual(src.listeners('end').length, 0); +assert.strictEqual(src.listeners('readable').length, 0); + +assert.strictEqual(dest.listeners('unpipe').length, 0); +assert.strictEqual(dest.listeners('drain').length, 0); +assert.strictEqual(dest.listeners('error').length, 0); +assert.strictEqual(dest.listeners('close').length, 0); +assert.strictEqual(dest.listeners('finish').length, 0); console.error(src._readableState); process.on('exit', function() { diff --git a/test/parallel/test-stream3-cork-end.js b/test/parallel/test-stream3-cork-end.js index 230227e0b13ddb..7227f87ada7fa1 100644 --- a/test/parallel/test-stream3-cork-end.js +++ b/test/parallel/test-stream3-cork-end.js @@ -22,7 +22,7 @@ w._write = function(chunk, encoding, cb) { // stream end event is not seen before the last write assert.ok(!seenEnd); // default encoding given none was specified - assert.equal(encoding, 'buffer'); + assert.strictEqual(encoding, 'buffer'); seenChunks.push(chunk); cb(); @@ -52,7 +52,7 @@ function writeChunks(remainingChunks, callback) { // do an initial write w.write('stuff'); // the write was immediate -assert.equal(seenChunks.length, 1); +assert.strictEqual(seenChunks.length, 1); // reset the seen chunks seenChunks = []; @@ -62,7 +62,7 @@ w.cork(); // write the bufferedChunks writeChunks(inputChunks, () => { // should not have seen anything yet - assert.equal(seenChunks.length, 0); + assert.strictEqual(seenChunks.length, 0); // trigger flush and ending the stream w.end(); @@ -71,7 +71,7 @@ writeChunks(inputChunks, () => { assert.ok(!seenEnd); // buffered bytes should be seen in current tick - assert.equal(seenChunks.length, 4); + assert.strictEqual(seenChunks.length, 4); // did the chunks match for (let i = 0, l = expectedChunks.length; i < l; i++) { diff --git a/test/parallel/test-stream3-cork-uncork.js b/test/parallel/test-stream3-cork-uncork.js index 821fd22bf8b8a3..98f74a45c6624e 100644 --- a/test/parallel/test-stream3-cork-uncork.js +++ b/test/parallel/test-stream3-cork-uncork.js @@ -20,7 +20,7 @@ const w = new Writable(); // lets arrange to store the chunks w._write = function(chunk, encoding, cb) { // default encoding given none was specified - assert.equal(encoding, 'buffer'); + assert.strictEqual(encoding, 'buffer'); seenChunks.push(chunk); cb(); @@ -50,7 +50,7 @@ function writeChunks(remainingChunks, callback) { // do an initial write w.write('stuff'); // the write was immediate -assert.equal(seenChunks.length, 1); +assert.strictEqual(seenChunks.length, 1); // reset the chunks seen so far seenChunks = []; @@ -60,13 +60,13 @@ w.cork(); // write the bufferedChunks writeChunks(inputChunks, () => { // should not have seen anything yet - assert.equal(seenChunks.length, 0); + assert.strictEqual(seenChunks.length, 0); // trigger writing out the buffer w.uncork(); // buffered bytes shoud be seen in current tick - assert.equal(seenChunks.length, 4); + assert.strictEqual(seenChunks.length, 4); // did the chunks match for (let i = 0, l = expectedChunks.length; i < l; i++) { diff --git a/test/parallel/test-stream3-pause-then-read.js b/test/parallel/test-stream3-pause-then-read.js index 5a9550bcd41d7f..a1be563683c0a2 100644 --- a/test/parallel/test-stream3-pause-then-read.js +++ b/test/parallel/test-stream3-pause-then-read.js @@ -46,7 +46,7 @@ function readn(n, then) { if (!c) r.once('readable', read); else { - assert.equal(c.length, n); + assert.strictEqual(c.length, n); assert(!r._readableState.flowing); then(); } @@ -85,7 +85,7 @@ function pipeLittle() { const w = new Writable(); let written = 0; w.on('finish', function() { - assert.equal(written, 200); + assert.strictEqual(written, 200); setImmediate(read1234); }); w._write = function(chunk, encoding, cb) { @@ -138,8 +138,8 @@ function pipe() { }; w.on('finish', function() { console.error('written', written, totalPushed); - assert.equal(written, expectEndingData); - assert.equal(totalPushed, expectTotalData); + assert.strictEqual(written, expectEndingData); + assert.strictEqual(totalPushed, expectTotalData); console.log('ok'); }); r.pipe(w); diff --git a/test/parallel/test-string-decoder-end.js b/test/parallel/test-string-decoder-end.js index 2c187d60142bbf..a04972e545bf1d 100644 --- a/test/parallel/test-string-decoder-end.js +++ b/test/parallel/test-string-decoder-end.js @@ -53,6 +53,6 @@ function testBuf(encoding, buf) { console.log('expect=%j', res3); console.log('res1=%j', res1); console.log('res2=%j', res2); - assert.equal(res1, res3, 'one byte at a time should match toString'); - assert.equal(res2, res3, 'all bytes at once should match toString'); + assert.strictEqual(res1, res3, 'one byte at a time should match toString'); + assert.strictEqual(res2, res3, 'all bytes at once should match toString'); } diff --git a/test/parallel/test-stringbytes-external.js b/test/parallel/test-stringbytes-external.js index a242b943c91a4d..94b58d9c6eadf0 100644 --- a/test/parallel/test-stringbytes-external.js +++ b/test/parallel/test-stringbytes-external.js @@ -13,14 +13,14 @@ let write_str = 'a'; let b = Buffer.from(write_str, 'ucs2'); // first check latin1 let c = b.toString('latin1'); -assert.equal(b[0], 0x61); -assert.equal(b[1], 0); -assert.equal(ucs2_control, c); +assert.strictEqual(b[0], 0x61); +assert.strictEqual(b[1], 0); +assert.strictEqual(ucs2_control, c); // now check binary c = b.toString('binary'); -assert.equal(b[0], 0x61); -assert.equal(b[1], 0); -assert.equal(ucs2_control, c); +assert.strictEqual(b[0], 0x61); +assert.strictEqual(b[1], 0); +assert.strictEqual(ucs2_control, c); // now create big strings const size = 1 + (1 << 20); @@ -31,8 +31,8 @@ ucs2_control = Array(size).join(ucs2_control); b = Buffer.from(write_str, 'ucs2'); // check fist Buffer created from write string for (let i = 0; i < b.length; i += 2) { - assert.equal(b[i], 0x61); - assert.equal(b[i + 1], 0); + assert.strictEqual(b[i], 0x61); + assert.strictEqual(b[i + 1], 0); } // create another string to create an external string @@ -40,25 +40,25 @@ const b_ucs = b.toString('ucs2'); // check control against external binary string const l_bin = b.toString('latin1'); -assert.equal(ucs2_control, l_bin); +assert.strictEqual(ucs2_control, l_bin); // check control against external binary string const b_bin = b.toString('binary'); -assert.equal(ucs2_control, b_bin); +assert.strictEqual(ucs2_control, b_bin); // create buffer copy from external const c_bin = Buffer.from(l_bin, 'latin1'); const c_ucs = Buffer.from(b_ucs, 'ucs2'); // make sure they're the same length -assert.equal(c_bin.length, c_ucs.length); +assert.strictEqual(c_bin.length, c_ucs.length); // make sure Buffers from externals are the same for (let i = 0; i < c_bin.length; i++) { - assert.equal(c_bin[i], c_ucs[i]); + assert.strictEqual(c_bin[i], c_ucs[i]); } // check resultant strings -assert.equal(c_bin.toString('ucs2'), c_ucs.toString('ucs2')); -assert.equal(c_bin.toString('latin1'), ucs2_control); -assert.equal(c_ucs.toString('latin1'), ucs2_control); +assert.strictEqual(c_bin.toString('ucs2'), c_ucs.toString('ucs2')); +assert.strictEqual(c_bin.toString('latin1'), ucs2_control); +assert.strictEqual(c_ucs.toString('latin1'), ucs2_control); // now let's test BASE64 and HEX ecoding/decoding diff --git a/test/parallel/test-sync-io-option.js b/test/parallel/test-sync-io-option.js index 6166bffc0bd68c..fb0b2333e82e4c 100644 --- a/test/parallel/test-sync-io-option.js +++ b/test/parallel/test-sync-io-option.js @@ -18,14 +18,14 @@ if (process.argv[2] === 'child') { args = execArgv.concat(args); if (!args[0]) args.shift(); execFile(process.execPath, args, function(err, stdout, stderr) { - assert.equal(err, null); - assert.equal(stdout, ''); + assert.strictEqual(err, null); + assert.strictEqual(stdout, ''); if (/WARNING[\s\S]*fs\.readFileSync/.test(stderr)) cntr++; if (args[0] === '--trace-sync-io') { - assert.equal(cntr, 1); + assert.strictEqual(cntr, 1); } else if (args[0] === __filename) { - assert.equal(cntr, 0); + assert.strictEqual(cntr, 0); } else { throw new Error('UNREACHABLE'); } diff --git a/test/parallel/test-tcp-wrap.js b/test/parallel/test-tcp-wrap.js index 6b9dbd90a4c113..aee0bcc8509fdf 100644 --- a/test/parallel/test-tcp-wrap.js +++ b/test/parallel/test-tcp-wrap.js @@ -9,12 +9,12 @@ const handle = new TCP(); // Should be able to bind to the port let err = handle.bind('0.0.0.0', 0); -assert.equal(err, 0); +assert.strictEqual(err, 0); // Should not be able to bind to the same port again const out = {}; handle.getsockname(out); err = handle.bind('0.0.0.0', out.port); -assert.equal(err, uv.UV_EINVAL); +assert.strictEqual(err, uv.UV_EINVAL); handle.close(); diff --git a/test/parallel/test-timers-reset-process-domain-on-throw.js b/test/parallel/test-timers-reset-process-domain-on-throw.js index 55e7ef57dcafc4..946ae715b0e193 100644 --- a/test/parallel/test-timers-reset-process-domain-on-throw.js +++ b/test/parallel/test-timers-reset-process-domain-on-throw.js @@ -28,7 +28,7 @@ function err() { function handleDomainError(e) { // In the domain's error handler, the current active domain should be the // domain within which the error was thrown. - assert.equal(process.domain, d); + assert.strictEqual(process.domain, d); } } diff --git a/test/parallel/test-timers-unref-active.js b/test/parallel/test-timers-unref-active.js index 8b1c89673bc35f..69f6d4e9f1bce4 100644 --- a/test/parallel/test-timers-unref-active.js +++ b/test/parallel/test-timers-unref-active.js @@ -47,5 +47,5 @@ someObject._onTimeout = function _onTimeout() { timers._unrefActive(someObject); setTimeout(function() { - assert.equal(nbTimeouts, N); + assert.strictEqual(nbTimeouts, N); }, TEST_DURATION); diff --git a/test/parallel/test-timers-unref-leak.js b/test/parallel/test-timers-unref-leak.js index d970910b24abe6..8eef00dd4ffe92 100644 --- a/test/parallel/test-timers-unref-leak.js +++ b/test/parallel/test-timers-unref-leak.js @@ -22,6 +22,6 @@ setTimeout(function() { }, 50); process.on('exit', function() { - assert.equal(called, 1); - assert.equal(closed, 1); + assert.strictEqual(called, 1); + assert.strictEqual(closed, 1); }); diff --git a/test/parallel/test-timers.js b/test/parallel/test-timers.js index 33f1706e3d399a..64a33515b1660c 100644 --- a/test/parallel/test-timers.js +++ b/test/parallel/test-timers.js @@ -46,7 +46,7 @@ inputs.forEach(function(value, index) { process.on('exit', function() { // assert that all timers have run inputs.forEach(function(value, index) { - assert.equal(true, timeouts[index]); - assert.equal(true, intervals[index]); + assert.strictEqual(true, timeouts[index]); + assert.strictEqual(true, intervals[index]); }); }); diff --git a/test/parallel/test-tls-cipher-list.js b/test/parallel/test-tls-cipher-list.js index 4acb30bc1c74bf..1533900f861177 100644 --- a/test/parallel/test-tls-cipher-list.js +++ b/test/parallel/test-tls-cipher-list.js @@ -21,7 +21,7 @@ function doCheck(arg, check) { .stdout.on('data', function(chunk) { out += chunk; }).on('end', function() { - assert.equal(out.trim(), check); + assert.strictEqual(out.trim(), check); }).on('error', common.fail); } diff --git a/test/parallel/test-tls-client-default-ciphers.js b/test/parallel/test-tls-client-default-ciphers.js index 618178d4a497ad..30095197b1c807 100644 --- a/test/parallel/test-tls-client-default-ciphers.js +++ b/test/parallel/test-tls-client-default-ciphers.js @@ -23,6 +23,6 @@ function test1() { } catch (e) { assert(e instanceof Done); } - assert.equal(ciphers, tls.DEFAULT_CIPHERS); + assert.strictEqual(ciphers, tls.DEFAULT_CIPHERS); } test1(); diff --git a/test/parallel/test-tls-client-getephemeralkeyinfo.js b/test/parallel/test-tls-client-getephemeralkeyinfo.js index b49d7131c47cf9..7d68046de9baae 100644 --- a/test/parallel/test-tls-client-getephemeralkeyinfo.js +++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js @@ -93,6 +93,6 @@ function testECDHE512() { testNOT_PFS(); process.on('exit', function() { - assert.equal(ntests, nsuccess); - assert.equal(ntests, 5); + assert.strictEqual(ntests, nsuccess); + assert.strictEqual(ntests, 5); }); diff --git a/test/parallel/test-tls-client-mindhsize.js b/test/parallel/test-tls-client-mindhsize.js index 76e1034621f031..6bbf90030e85c2 100644 --- a/test/parallel/test-tls-client-mindhsize.js +++ b/test/parallel/test-tls-client-mindhsize.js @@ -88,6 +88,6 @@ assert.throws(() => test(512, true, common.fail), }); process.on('exit', function() { - assert.equal(nsuccess, 1); - assert.equal(nerror, 1); + assert.strictEqual(nsuccess, 1); + assert.strictEqual(nerror, 1); }); diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js index 70d96ef1545ede..33d6c95fde50d3 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.js @@ -130,5 +130,5 @@ runTest(0); process.on('exit', function() { console.log('successful tests: %d', successfulTests); - assert.equal(successfulTests, testCases.length); + assert.strictEqual(successfulTests, testCases.length); }); diff --git a/test/parallel/test-tls-delayed-attach.js b/test/parallel/test-tls-delayed-attach.js index d757ca756c3a09..9d2aca6a7d6c6f 100644 --- a/test/parallel/test-tls-delayed-attach.js +++ b/test/parallel/test-tls-delayed-attach.js @@ -44,5 +44,5 @@ const server = net.createServer(function(c) { }); process.on('exit', function() { - assert.equal(received, sent); + assert.strictEqual(received, sent); }); diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js index 4bc81af6e1f8a2..1f3f73557a6a2a 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.js @@ -90,6 +90,6 @@ function testError() { test1024(); process.on('exit', function() { - assert.equal(ntests, nsuccess); - assert.equal(ntests, 3); + assert.strictEqual(ntests, nsuccess); + assert.strictEqual(ntests, 3); }); diff --git a/test/parallel/test-tls-env-bad-extra-ca.js b/test/parallel/test-tls-env-bad-extra-ca.js index cb6c4ba489fcd6..9b42bbbbd5558e 100644 --- a/test/parallel/test-tls-env-bad-extra-ca.js +++ b/test/parallel/test-tls-env-bad-extra-ca.js @@ -30,7 +30,7 @@ let stderr = ''; fork(__filename, opts) .on('exit', common.mustCall(function(status) { - assert.equal(status, 0, 'client did not succeed in connecting'); + assert.strictEqual(status, 0, 'client did not succeed in connecting'); })) .on('close', common.mustCall(function() { assert(stderr.match(new RegExp( diff --git a/test/parallel/test-tls-env-extra-ca.js b/test/parallel/test-tls-env-extra-ca.js index 12e3272bd401a2..89f1b3a6c040d1 100644 --- a/test/parallel/test-tls-env-extra-ca.js +++ b/test/parallel/test-tls-env-extra-ca.js @@ -40,6 +40,6 @@ const server = tls.createServer(options, function(s) { }; fork(__filename, {env: env}).on('exit', common.mustCall(function(status) { - assert.equal(status, 0, 'client did not succeed in connecting'); + assert.strictEqual(status, 0, 'client did not succeed in connecting'); })); })); diff --git a/test/parallel/test-tls-honorcipherorder.js b/test/parallel/test-tls-honorcipherorder.js index f7894e46706da9..fdfc303146c1fa 100644 --- a/test/parallel/test-tls-honorcipherorder.js +++ b/test/parallel/test-tls-honorcipherorder.js @@ -17,7 +17,7 @@ const SSL_Method = 'TLSv1_2_method'; const localhost = '127.0.0.1'; process.on('exit', function() { - assert.equal(nconns, 6); + assert.strictEqual(nconns, 6); }); function test(honorCipherOrder, clientCipher, expectedCipher, cb) { @@ -50,7 +50,7 @@ function test(honorCipherOrder, clientCipher, expectedCipher, cb) { const cipher = client.getCipher(); client.end(); server.close(); - assert.equal(cipher.name, expectedCipher); + assert.strictEqual(cipher.name, expectedCipher); if (cb) cb(); }); }); diff --git a/test/parallel/test-tls-js-stream.js b/test/parallel/test-tls-js-stream.js index e1b580da303f8d..4e7cf618701173 100644 --- a/test/parallel/test-tls-js-stream.js +++ b/test/parallel/test-tls-js-stream.js @@ -71,6 +71,6 @@ const server = tls.createServer({ }); process.once('exit', function() { - assert.equal(connected.client, 1); - assert.equal(connected.server, 1); + assert.strictEqual(connected.client, 1); + assert.strictEqual(connected.server, 1); }); diff --git a/test/parallel/test-tls-no-rsa-key.js b/test/parallel/test-tls-no-rsa-key.js index 233d8453db1318..ed5c941b2d33ba 100644 --- a/test/parallel/test-tls-no-rsa-key.js +++ b/test/parallel/test-tls-no-rsa-key.js @@ -27,7 +27,7 @@ const server = tls.createServer(options, function(conn) { })); c.on('data', function(data) { - assert.equal(data, 'ok'); + assert.strictEqual(data.toString(), 'ok'); }); const cert = c.getPeerCertificate(); diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js index 1b622cc8f72c20..3c69204d680d7c 100644 --- a/test/parallel/test-tls-npn-server-client.js +++ b/test/parallel/test-tls-npn-server-client.js @@ -98,10 +98,10 @@ function startTest() { } process.on('exit', function() { - assert.equal(serverResults[0], clientsResults[0]); - assert.equal(serverResults[1], clientsResults[1]); - assert.equal(serverResults[2], 'http/1.1'); - assert.equal(clientsResults[2], false); - assert.equal(serverResults[3], 'first-priority-unsupported'); - assert.equal(clientsResults[3], false); + assert.strictEqual(serverResults[0], clientsResults[0]); + assert.strictEqual(serverResults[1], clientsResults[1]); + assert.strictEqual(serverResults[2], 'http/1.1'); + assert.strictEqual(clientsResults[2], false); + assert.strictEqual(serverResults[3], 'first-priority-unsupported'); + assert.strictEqual(clientsResults[3], false); }); diff --git a/test/parallel/test-tls-over-http-tunnel.js b/test/parallel/test-tls-over-http-tunnel.js index 4e03bcaf537f26..a37913907b5b19 100644 --- a/test/parallel/test-tls-over-http-tunnel.js +++ b/test/parallel/test-tls-over-http-tunnel.js @@ -39,11 +39,12 @@ const proxy = net.createServer(function(clientSocket) { clientSocket.on('data', function(chunk) { if (!serverSocket) { // Verify the CONNECT request - assert.equal(`CONNECT localhost:${server.address().port} HTTP/1.1\r\n` + - 'Proxy-Connections: keep-alive\r\n' + - `Host: localhost:${proxy.address().port}\r\n` + - 'Connection: close\r\n\r\n', - chunk); + assert.strictEqual(`CONNECT localhost:${server.address().port} ` + + 'HTTP/1.1\r\n' + + 'Proxy-Connections: keep-alive\r\n' + + `Host: localhost:${proxy.address().port}\r\n` + + 'Connection: close\r\n\r\n', + chunk.toString()); console.log('PROXY: got CONNECT request'); console.log('PROXY: creating a tunnel'); @@ -107,7 +108,7 @@ proxy.listen(0, function() { } function onConnect(res, socket, header) { - assert.equal(200, res.statusCode); + assert.strictEqual(200, res.statusCode); console.log('CLIENT: got CONNECT response'); // detach the socket @@ -130,10 +131,10 @@ proxy.listen(0, function() { agent: false, rejectUnauthorized: false }, function(res) { - assert.equal(200, res.statusCode); + assert.strictEqual(200, res.statusCode); res.on('data', function(chunk) { - assert.equal('hello world\n', chunk); + assert.strictEqual('hello world\n', chunk.toString()); console.log('CLIENT: got HTTPS response'); gotRequest = true; }); diff --git a/test/parallel/test-tls-pause.js b/test/parallel/test-tls-pause.js index 911ea7097b1e70..c5b96b96dd675f 100644 --- a/test/parallel/test-tls-pause.js +++ b/test/parallel/test-tls-pause.js @@ -69,5 +69,5 @@ server.listen(0, function() { }); process.on('exit', function() { - assert.equal(sent, received); + assert.strictEqual(sent, received); }); diff --git a/test/parallel/test-tls-peer-certificate-encoding.js b/test/parallel/test-tls-peer-certificate-encoding.js index 545caf403e103c..1ae30974aeda83 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.js @@ -29,7 +29,7 @@ server.listen(0, common.mustCall(function() { const peerCert = socket.getPeerCertificate(); console.error(util.inspect(peerCert)); - assert.equal(peerCert.subject.CN, 'Ádám Lippai'); + assert.strictEqual(peerCert.subject.CN, 'Ádám Lippai'); server.close(); })); socket.end('Hello'); diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index 58a58324fb383f..3b297dd4cea4d7 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -216,7 +216,7 @@ function runClient(prefix, port, options, cb) { //client.stdout.pipe(process.stdout); client.on('exit', function(code) { - //assert.equal(0, code, prefix + options.name + + //assert.strictEqual(0, code, prefix + options.name + // ": s_client exited with error code " + code); if (options.shouldReject) { assert.strictEqual(true, rejected, prefix + options.name + diff --git a/test/parallel/test-tls-session-cache.js b/test/parallel/test-tls-session-cache.js index 5e3ae5128ecfaf..0b2942215141e3 100644 --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js @@ -63,7 +63,7 @@ function doTest(testOptions, callback) { server.on('resumeSession', function(id, callback) { ++resumeCount; assert.ok(session); - assert.equal(session.id.toString('hex'), id.toString('hex')); + assert.strictEqual(session.id.toString('hex'), id.toString('hex')); // Just to check that async really works there setTimeout(function() { @@ -107,7 +107,7 @@ function doTest(testOptions, callback) { } common.fail(`code: ${code}, signal: ${signal}, output: ${err}`); } - assert.equal(code, 0); + assert.strictEqual(code, 0); server.close(common.mustCall(function() { setTimeout(callback, 100); })); @@ -119,13 +119,13 @@ function doTest(testOptions, callback) { process.on('exit', function() { if (testOptions.tickets) { - assert.equal(requestCount, 6); - assert.equal(resumeCount, 0); + assert.strictEqual(requestCount, 6); + assert.strictEqual(resumeCount, 0); } else { // initial request + reconnect requests (5 times) assert.ok(session); - assert.equal(requestCount, 6); - assert.equal(resumeCount, 5); + assert.strictEqual(requestCount, 6); + assert.strictEqual(resumeCount, 5); } }); } diff --git a/test/parallel/test-tls-socket-default-options.js b/test/parallel/test-tls-socket-default-options.js index 5c325570643225..dd62a41090c88e 100644 --- a/test/parallel/test-tls-socket-default-options.js +++ b/test/parallel/test-tls-socket-default-options.js @@ -28,7 +28,7 @@ function testSocketOptions(socket, socketOptions) { s.on('end', function() { server.close(); s.destroy(); - assert.equal(received, sent); + assert.strictEqual(received, sent); setImmediate(runTests); }); }).listen(0, function() { diff --git a/test/parallel/test-umask.js b/test/parallel/test-umask.js index 1c870893a3bced..7e4827a4cfc47d 100644 --- a/test/parallel/test-umask.js +++ b/test/parallel/test-umask.js @@ -12,10 +12,10 @@ if (common.isWindows) { const old = process.umask(mask); -assert.equal(parseInt(mask, 8), process.umask(old)); +assert.strictEqual(parseInt(mask, 8), process.umask(old)); // confirm reading the umask does not modify it. // 1. If the test fails, this call will succeed, but the mask will be set to 0 -assert.equal(old, process.umask()); +assert.strictEqual(old, process.umask()); // 2. If the test fails, process.umask() will return 0 -assert.equal(old, process.umask()); +assert.strictEqual(old, process.umask()); diff --git a/test/parallel/test-url.js b/test/parallel/test-url.js index 3a8c06c3ee4637..fa43e1fd5f1330 100644 --- a/test/parallel/test-url.js +++ b/test/parallel/test-url.js @@ -921,8 +921,8 @@ for (const u in parseTests) { expected = parseTests[u].href; actual = url.format(parseTests[u]); - assert.equal(actual, expected, - 'format(' + u + ') == ' + u + '\nactual:' + actual); + assert.strictEqual(actual, expected, + 'format(' + u + ') == ' + u + '\nactual:' + actual); } function createWithNoPrototype(properties = []) { @@ -1299,8 +1299,8 @@ const relativeTests = [ relativeTests.forEach(function(relativeTest) { const a = url.resolve(relativeTest[0], relativeTest[1]); const e = relativeTest[2]; - assert.equal(a, e, - 'resolve(' + [relativeTest[0], relativeTest[1]] + ') == ' + e + + assert.strictEqual(a, e, + 'resolve(' + [relativeTest[0], relativeTest[1]] + ') == ' + e + '\n actual=' + a); }); @@ -1631,8 +1631,8 @@ const relativeTests2 = [ relativeTests2.forEach(function(relativeTest) { const a = url.resolve(relativeTest[1], relativeTest[0]); const e = url.format(relativeTest[2]); - assert.equal(a, e, - 'resolve(' + [relativeTest[1], relativeTest[0]] + ') == ' + e + + assert.strictEqual(a, e, + 'resolve(' + [relativeTest[1], relativeTest[0]] + ') == ' + e + '\n actual=' + a); }); @@ -1650,8 +1650,8 @@ relativeTests.forEach(function(relativeTest) { expected = relativeTest[2]; actual = url.format(actual); - assert.equal(actual, expected, - 'format(' + actual + ') == ' + expected + '\nactual:' + actual); + assert.strictEqual(actual, expected, + 'format(' + actual + ') == ' + expected + '\nactual:' + actual); }); //format: [to, from, result] @@ -1681,8 +1681,8 @@ relativeTests2.forEach(function(relativeTest) { expected = url.format(relativeTest[2]); actual = url.format(actual); - assert.equal(actual, expected, - 'format(' + relativeTest[1] + ') == ' + expected + + assert.strictEqual(actual, expected, + 'format(' + relativeTest[1] + ') == ' + expected + '\nactual:' + actual); }); diff --git a/test/parallel/test-utf8-scripts.js b/test/parallel/test-utf8-scripts.js index 484d3bdefe5eda..e9d141d58abab0 100644 --- a/test/parallel/test-utf8-scripts.js +++ b/test/parallel/test-utf8-scripts.js @@ -6,4 +6,4 @@ const assert = require('assert'); console.log('Σὲ γνωρίζω ἀπὸ τὴν κόψη'); -assert.equal(true, /Hellö Wörld/.test('Hellö Wörld')); +assert.strictEqual(true, /Hellö Wörld/.test('Hellö Wörld')); diff --git a/test/parallel/test-util-log.js b/test/parallel/test-util-log.js index d45ebf2fc0b729..3604b42820063e 100644 --- a/test/parallel/test-util-log.js +++ b/test/parallel/test-util-log.js @@ -32,7 +32,7 @@ tests.forEach(function(test) { const re = (/[0-9]{1,2} [A-Z][a-z]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} - (.+)$/); const match = re.exec(result); assert.ok(match); - assert.equal(match[1], test.output); + assert.strictEqual(match[1], test.output); }); global.process.stdout.write = stdout_write; diff --git a/test/parallel/test-util.js b/test/parallel/test-util.js index 0f5ee28e37b59c..3b7e78ea1e464e 100644 --- a/test/parallel/test-util.js +++ b/test/parallel/test-util.js @@ -5,78 +5,78 @@ const util = require('util'); const context = require('vm').runInNewContext; // isArray -assert.equal(true, util.isArray([])); -assert.equal(true, util.isArray(Array())); -assert.equal(true, util.isArray(new Array())); -assert.equal(true, util.isArray(new Array(5))); -assert.equal(true, util.isArray(new Array('with', 'some', 'entries'))); -assert.equal(true, util.isArray(context('Array')())); -assert.equal(false, util.isArray({})); -assert.equal(false, util.isArray({ push: function() {} })); -assert.equal(false, util.isArray(/regexp/)); -assert.equal(false, util.isArray(new Error())); -assert.equal(false, util.isArray(Object.create(Array.prototype))); +assert.strictEqual(true, util.isArray([])); +assert.strictEqual(true, util.isArray(Array())); +assert.strictEqual(true, util.isArray(new Array())); +assert.strictEqual(true, util.isArray(new Array(5))); +assert.strictEqual(true, util.isArray(new Array('with', 'some', 'entries'))); +assert.strictEqual(true, util.isArray(context('Array')())); +assert.strictEqual(false, util.isArray({})); +assert.strictEqual(false, util.isArray({ push: function() {} })); +assert.strictEqual(false, util.isArray(/regexp/)); +assert.strictEqual(false, util.isArray(new Error())); +assert.strictEqual(false, util.isArray(Object.create(Array.prototype))); // isRegExp -assert.equal(true, util.isRegExp(/regexp/)); -assert.equal(true, util.isRegExp(RegExp())); -assert.equal(true, util.isRegExp(new RegExp())); -assert.equal(true, util.isRegExp(context('RegExp')())); -assert.equal(false, util.isRegExp({})); -assert.equal(false, util.isRegExp([])); -assert.equal(false, util.isRegExp(new Date())); -assert.equal(false, util.isRegExp(Object.create(RegExp.prototype))); +assert.strictEqual(true, util.isRegExp(/regexp/)); +assert.strictEqual(true, util.isRegExp(RegExp())); +assert.strictEqual(true, util.isRegExp(new RegExp())); +assert.strictEqual(true, util.isRegExp(context('RegExp')())); +assert.strictEqual(false, util.isRegExp({})); +assert.strictEqual(false, util.isRegExp([])); +assert.strictEqual(false, util.isRegExp(new Date())); +assert.strictEqual(false, util.isRegExp(Object.create(RegExp.prototype))); // isDate -assert.equal(true, util.isDate(new Date())); -assert.equal(true, util.isDate(new Date(0))); +assert.strictEqual(true, util.isDate(new Date())); +assert.strictEqual(true, util.isDate(new Date(0))); // eslint-disable-next-line new-parens -assert.equal(true, util.isDate(new (context('Date')))); -assert.equal(false, util.isDate(Date())); -assert.equal(false, util.isDate({})); -assert.equal(false, util.isDate([])); -assert.equal(false, util.isDate(new Error())); -assert.equal(false, util.isDate(Object.create(Date.prototype))); +assert.strictEqual(true, util.isDate(new (context('Date')))); +assert.strictEqual(false, util.isDate(Date())); +assert.strictEqual(false, util.isDate({})); +assert.strictEqual(false, util.isDate([])); +assert.strictEqual(false, util.isDate(new Error())); +assert.strictEqual(false, util.isDate(Object.create(Date.prototype))); // isError -assert.equal(true, util.isError(new Error())); -assert.equal(true, util.isError(new TypeError())); -assert.equal(true, util.isError(new SyntaxError())); +assert.strictEqual(true, util.isError(new Error())); +assert.strictEqual(true, util.isError(new TypeError())); +assert.strictEqual(true, util.isError(new SyntaxError())); /* eslint-disable new-parens */ -assert.equal(true, util.isError(new (context('Error')))); -assert.equal(true, util.isError(new (context('TypeError')))); -assert.equal(true, util.isError(new (context('SyntaxError')))); +assert.strictEqual(true, util.isError(new (context('Error')))); +assert.strictEqual(true, util.isError(new (context('TypeError')))); +assert.strictEqual(true, util.isError(new (context('SyntaxError')))); /* eslint-enable */ -assert.equal(false, util.isError({})); -assert.equal(false, util.isError({ name: 'Error', message: '' })); -assert.equal(false, util.isError([])); -assert.equal(true, util.isError(Object.create(Error.prototype))); +assert.strictEqual(false, util.isError({})); +assert.strictEqual(false, util.isError({ name: 'Error', message: '' })); +assert.strictEqual(false, util.isError([])); +assert.strictEqual(true, util.isError(Object.create(Error.prototype))); // isObject assert.ok(util.isObject({}) === true); // isPrimitive -assert.equal(false, util.isPrimitive({})); -assert.equal(false, util.isPrimitive(new Error())); -assert.equal(false, util.isPrimitive(new Date())); -assert.equal(false, util.isPrimitive([])); -assert.equal(false, util.isPrimitive(/regexp/)); -assert.equal(false, util.isPrimitive(function() {})); -assert.equal(false, util.isPrimitive(new Number(1))); -assert.equal(false, util.isPrimitive(new String('bla'))); -assert.equal(false, util.isPrimitive(new Boolean(true))); -assert.equal(true, util.isPrimitive(1)); -assert.equal(true, util.isPrimitive('bla')); -assert.equal(true, util.isPrimitive(true)); -assert.equal(true, util.isPrimitive(undefined)); -assert.equal(true, util.isPrimitive(null)); -assert.equal(true, util.isPrimitive(Infinity)); -assert.equal(true, util.isPrimitive(NaN)); -assert.equal(true, util.isPrimitive(Symbol('symbol'))); +assert.strictEqual(false, util.isPrimitive({})); +assert.strictEqual(false, util.isPrimitive(new Error())); +assert.strictEqual(false, util.isPrimitive(new Date())); +assert.strictEqual(false, util.isPrimitive([])); +assert.strictEqual(false, util.isPrimitive(/regexp/)); +assert.strictEqual(false, util.isPrimitive(function() {})); +assert.strictEqual(false, util.isPrimitive(new Number(1))); +assert.strictEqual(false, util.isPrimitive(new String('bla'))); +assert.strictEqual(false, util.isPrimitive(new Boolean(true))); +assert.strictEqual(true, util.isPrimitive(1)); +assert.strictEqual(true, util.isPrimitive('bla')); +assert.strictEqual(true, util.isPrimitive(true)); +assert.strictEqual(true, util.isPrimitive(undefined)); +assert.strictEqual(true, util.isPrimitive(null)); +assert.strictEqual(true, util.isPrimitive(Infinity)); +assert.strictEqual(true, util.isPrimitive(NaN)); +assert.strictEqual(true, util.isPrimitive(Symbol('symbol'))); // isBuffer -assert.equal(false, util.isBuffer('foo')); -assert.equal(true, util.isBuffer(Buffer.from('foo'))); +assert.strictEqual(false, util.isBuffer('foo')); +assert.strictEqual(true, util.isBuffer(Buffer.from('foo'))); // _extend assert.deepStrictEqual(util._extend({a: 1}), {a: 1}); diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js index 5b756f35962525..02182e2816bbc7 100644 --- a/test/parallel/test-v8-stats.js +++ b/test/parallel/test-v8-stats.js @@ -16,7 +16,7 @@ const keys = [ 'used_heap_size']; assert.deepStrictEqual(Object.keys(s).sort(), keys); keys.forEach(function(key) { - assert.equal(typeof s[key], 'number'); + assert.strictEqual(typeof s[key], 'number'); }); diff --git a/test/parallel/test-vm-cached-data.js b/test/parallel/test-vm-cached-data.js index 35ab236ae1eb98..3f74f398b814ca 100644 --- a/test/parallel/test-vm-cached-data.js +++ b/test/parallel/test-vm-cached-data.js @@ -32,7 +32,7 @@ function produce(source, count) { console.log(data); `, source]); - assert.equal(out.status, 0, out.stderr + ''); + assert.strictEqual(out.status, 0, out.stderr + ''); return Buffer.from(out.stdout.toString(), 'base64'); } @@ -47,7 +47,7 @@ function testProduceConsume() { cachedData: data }); assert(!script.cachedDataRejected); - assert.equal(script.runInThisContext()(), 'original'); + assert.strictEqual(script.runInThisContext()(), 'original'); } testProduceConsume(); @@ -68,7 +68,7 @@ function testRejectInvalid() { cachedData: data }); assert(script.cachedDataRejected); - assert.equal(script.runInThisContext()(), 'invalid_1'); + assert.strictEqual(script.runInThisContext()(), 'invalid_1'); } testRejectInvalid(); diff --git a/test/parallel/test-vm-context.js b/test/parallel/test-vm-context.js index e4f6960259abe2..7056ce7be35d05 100644 --- a/test/parallel/test-vm-context.js +++ b/test/parallel/test-vm-context.js @@ -9,18 +9,18 @@ let script = new Script('"passed";'); console.error('run in a new empty context'); let context = vm.createContext(); let result = script.runInContext(context); -assert.equal('passed', result); +assert.strictEqual('passed', result); console.error('create a new pre-populated context'); context = vm.createContext({'foo': 'bar', 'thing': 'lala'}); -assert.equal('bar', context.foo); -assert.equal('lala', context.thing); +assert.strictEqual('bar', context.foo); +assert.strictEqual('lala', context.thing); console.error('test updating context'); script = new Script('foo = 3;'); result = script.runInContext(context); -assert.equal(3, context.foo); -assert.equal('lala', context.thing); +assert.strictEqual(3, context.foo); +assert.strictEqual('lala', context.thing); // Issue GH-227: assert.throws(function() { @@ -58,7 +58,7 @@ script = vm.createScript('delete b'); let ctx = {}; Object.defineProperty(ctx, 'b', { configurable: false }); ctx = vm.createContext(ctx); -assert.equal(script.runInContext(ctx), false); +assert.strictEqual(script.runInContext(ctx), false); // Error on the first line of a module should // have the correct line and column number diff --git a/test/parallel/test-vm-create-and-run-in-context.js b/test/parallel/test-vm-create-and-run-in-context.js index a0026102b578f8..7fd3f1d70436ad 100644 --- a/test/parallel/test-vm-create-and-run-in-context.js +++ b/test/parallel/test-vm-create-and-run-in-context.js @@ -8,17 +8,17 @@ const vm = require('vm'); console.error('run in a new empty context'); let context = vm.createContext(); let result = vm.runInContext('"passed";', context); -assert.equal('passed', result); +assert.strictEqual('passed', result); console.error('create a new pre-populated context'); context = vm.createContext({'foo': 'bar', 'thing': 'lala'}); -assert.equal('bar', context.foo); -assert.equal('lala', context.thing); +assert.strictEqual('bar', context.foo); +assert.strictEqual('lala', context.thing); console.error('test updating context'); result = vm.runInContext('var foo = 3;', context); -assert.equal(3, context.foo); -assert.equal('lala', context.thing); +assert.strictEqual(3, context.foo); +assert.strictEqual('lala', context.thing); // https://github.com/nodejs/node/issues/5768 console.error('run in contextified sandbox without referencing the context'); diff --git a/test/parallel/test-vm-create-context-circular-reference.js b/test/parallel/test-vm-create-context-circular-reference.js index 13680c4c4e11ef..1d7be0db9fdaf4 100644 --- a/test/parallel/test-vm-create-context-circular-reference.js +++ b/test/parallel/test-vm-create-context-circular-reference.js @@ -10,4 +10,4 @@ sbx = vm.createContext(sbx); sbx.test = 123; -assert.equal(sbx.window.window.window.window.window.test, 123); +assert.strictEqual(sbx.window.window.window.window.window.test, 123); diff --git a/test/parallel/test-vm-function-declaration.js b/test/parallel/test-vm-function-declaration.js index 9f27723a0421a9..668b29885c44cf 100644 --- a/test/parallel/test-vm-function-declaration.js +++ b/test/parallel/test-vm-function-declaration.js @@ -18,10 +18,10 @@ code += '(function(){return this})().b;\n'; const res = vm.runInContext(code, o, 'test'); -assert.equal(typeof res, 'function', 'result should be function'); -assert.equal(res.name, 'b', 'res should be named b'); -assert.equal(typeof o.a, 'function', 'a should be function'); -assert.equal(typeof o.b, 'function', 'b should be function'); -assert.equal(res, o.b, 'result should be global b function'); +assert.strictEqual(typeof res, 'function', 'result should be function'); +assert.strictEqual(res.name, 'b', 'res should be named b'); +assert.strictEqual(typeof o.a, 'function', 'a should be function'); +assert.strictEqual(typeof o.b, 'function', 'b should be function'); +assert.strictEqual(res, o.b, 'result should be global b function'); console.log('ok'); diff --git a/test/parallel/test-vm-global-define-property.js b/test/parallel/test-vm-global-define-property.js index 62a714615ddc31..83f6073d1ceaf1 100644 --- a/test/parallel/test-vm-global-define-property.js +++ b/test/parallel/test-vm-global-define-property.js @@ -20,7 +20,7 @@ const o = vm.createContext({ console: console, x: x }); const res = vm.runInContext(code, o, 'test'); assert(res); -assert.equal(typeof res, 'object'); -assert.equal(res, x); -assert.equal(o.f, res); +assert.strictEqual(typeof res, 'object'); +assert.strictEqual(res, x); +assert.strictEqual(o.f, res); assert.deepStrictEqual(Object.keys(o), ['console', 'x', 'g', 'f']); diff --git a/test/parallel/test-vm-new-script-new-context.js b/test/parallel/test-vm-new-script-new-context.js index a02627668f6db7..693a041138602f 100644 --- a/test/parallel/test-vm-new-script-new-context.js +++ b/test/parallel/test-vm-new-script-new-context.js @@ -10,8 +10,8 @@ let script = new Script('\'passed\';'); console.error('script created'); const result1 = script.runInNewContext(); const result2 = script.runInNewContext(); -assert.equal('passed', result1); -assert.equal('passed', result2); +assert.strictEqual('passed', result1); +assert.strictEqual('passed', result2); console.error('thrown error'); script = new Script('throw new Error(\'test\');'); @@ -30,7 +30,7 @@ assert.throws(function() { global.hello = 5; script = new Script('hello = 2'); script.runInNewContext(); -assert.equal(5, global.hello); +assert.strictEqual(5, global.hello); console.error('pass values in and out'); @@ -43,21 +43,21 @@ script = new Script(global.code); /* eslint-disable no-unused-vars */ const baz = script.runInNewContext(global.obj); /* eslint-enable no-unused-vars */ -assert.equal(1, global.obj.foo); -assert.equal(2, global.obj.bar); -assert.equal(2, global.foo); +assert.strictEqual(1, global.obj.foo); +assert.strictEqual(2, global.obj.bar); +assert.strictEqual(2, global.foo); console.error('call a function by reference'); script = new Script('f()'); function changeFoo() { global.foo = 100; } script.runInNewContext({ f: changeFoo }); -assert.equal(global.foo, 100); +assert.strictEqual(global.foo, 100); console.error('modify an object by reference'); script = new Script('f.a = 2'); const f = { a: 1 }; script.runInNewContext({ f: f }); -assert.equal(f.a, 2); +assert.strictEqual(f.a, 2); assert.throws(function() { script.runInNewContext(); diff --git a/test/parallel/test-vm-new-script-this-context.js b/test/parallel/test-vm-new-script-this-context.js index fb7e2719855174..3df5dc1b5020d5 100644 --- a/test/parallel/test-vm-new-script-this-context.js +++ b/test/parallel/test-vm-new-script-this-context.js @@ -8,7 +8,7 @@ common.globalCheck = false; console.error('run a string'); let script = new Script('\'passed\';'); const result = script.runInThisContext(script); -assert.equal('passed', result); +assert.strictEqual('passed', result); console.error('thrown error'); script = new Script('throw new Error(\'test\');'); @@ -19,7 +19,7 @@ assert.throws(function() { global.hello = 5; script = new Script('hello = 2'); script.runInThisContext(script); -assert.equal(2, global.hello); +assert.strictEqual(2, global.hello); console.error('pass values'); @@ -30,12 +30,12 @@ global.foo = 2; global.obj = { foo: 0, baz: 3 }; script = new Script(global.code); script.runInThisContext(script); -assert.equal(0, global.obj.foo); -assert.equal(2, global.bar); -assert.equal(1, global.foo); +assert.strictEqual(0, global.obj.foo); +assert.strictEqual(2, global.bar); +assert.strictEqual(1, global.foo); console.error('call a function'); global.f = function() { global.foo = 100; }; script = new Script('f()'); script.runInThisContext(script); -assert.equal(100, global.foo); +assert.strictEqual(100, global.foo); diff --git a/test/parallel/test-vm-run-in-new-context.js b/test/parallel/test-vm-run-in-new-context.js index b00e5a973e0d25..7b096ffc3fdc5f 100644 --- a/test/parallel/test-vm-run-in-new-context.js +++ b/test/parallel/test-vm-run-in-new-context.js @@ -5,13 +5,14 @@ const common = require('../common'); const assert = require('assert'); const vm = require('vm'); -assert.equal(typeof global.gc, 'function', 'Run this test with --expose-gc'); +assert.strictEqual(typeof global.gc, 'function', + 'Run this test with --expose-gc'); common.globalCheck = false; console.error('run a string'); const result = vm.runInNewContext('\'passed\';'); -assert.equal('passed', result); +assert.strictEqual('passed', result); console.error('thrown error'); assert.throws(function() { @@ -20,7 +21,7 @@ assert.throws(function() { global.hello = 5; vm.runInNewContext('hello = 2'); -assert.equal(5, global.hello); +assert.strictEqual(5, global.hello); console.error('pass values in and out'); @@ -32,19 +33,19 @@ global.obj = { foo: 0, baz: 3 }; /* eslint-disable no-unused-vars */ const baz = vm.runInNewContext(global.code, global.obj); /* eslint-enable no-unused-vars */ -assert.equal(1, global.obj.foo); -assert.equal(2, global.obj.bar); -assert.equal(2, global.foo); +assert.strictEqual(1, global.obj.foo); +assert.strictEqual(2, global.obj.bar); +assert.strictEqual(2, global.foo); console.error('call a function by reference'); function changeFoo() { global.foo = 100; } vm.runInNewContext('f()', { f: changeFoo }); -assert.equal(global.foo, 100); +assert.strictEqual(global.foo, 100); console.error('modify an object by reference'); const f = { a: 1 }; vm.runInNewContext('f.a = 2', { f: f }); -assert.equal(f.a, 2); +assert.strictEqual(f.a, 2); console.error('use function in context without referencing context'); const fn = vm.runInNewContext('(function() { obj.p = {}; })', { obj: {} }); diff --git a/test/parallel/test-vm-syntax-error-message.js b/test/parallel/test-vm-syntax-error-message.js index 1a97393d6d97a7..c0a00d06aa54f8 100644 --- a/test/parallel/test-vm-syntax-error-message.js +++ b/test/parallel/test-vm-syntax-error-message.js @@ -22,5 +22,5 @@ p.stdout.on('data', function(data) { }); process.on('exit', function() { - assert.equal(output.replace(/[\r\n]+/g, ''), 'boo'); + assert.strictEqual(output.replace(/[\r\n]+/g, ''), 'boo'); }); diff --git a/test/parallel/test-whatwg-url-setters.js b/test/parallel/test-whatwg-url-setters.js index dfaeb6e4ac2fd0..8cd9fc51d52ae8 100644 --- a/test/parallel/test-whatwg-url-setters.js +++ b/test/parallel/test-whatwg-url-setters.js @@ -24,8 +24,9 @@ for (const attr in attrs) { const url = new URL(test.href); url[attr] = test.new_value; for (const test_attr in test.expected) { - assert.equal(test.expected[test_attr], url[test_attr], - `${n} ${attr} ${test_attr} ${test.href} ${test.comment}`); + assert.strictEqual(test.expected[test_attr], url[test_attr], + `${n} ${attr} ${test_attr} ` + + `${test.href} ${test.comment}`); } } } diff --git a/test/parallel/test-writedouble.js b/test/parallel/test-writedouble.js index 935f9e7ae08ffd..fa9c94022d419b 100644 --- a/test/parallel/test-writedouble.js +++ b/test/parallel/test-writedouble.js @@ -10,140 +10,140 @@ function test(clazz) { buffer.writeDoubleBE(2.225073858507201e-308, 0); buffer.writeDoubleLE(2.225073858507201e-308, 8); - assert.equal(0x00, buffer[0]); - assert.equal(0x0f, buffer[1]); - assert.equal(0xff, buffer[2]); - assert.equal(0xff, buffer[3]); - assert.equal(0xff, buffer[4]); - assert.equal(0xff, buffer[5]); - assert.equal(0xff, buffer[6]); - assert.equal(0xff, buffer[7]); - assert.equal(0xff, buffer[8]); - assert.equal(0xff, buffer[9]); - assert.equal(0xff, buffer[10]); - assert.equal(0xff, buffer[11]); - assert.equal(0xff, buffer[12]); - assert.equal(0xff, buffer[13]); - assert.equal(0x0f, buffer[14]); - assert.equal(0x00, buffer[15]); + assert.strictEqual(0x00, buffer[0]); + assert.strictEqual(0x0f, buffer[1]); + assert.strictEqual(0xff, buffer[2]); + assert.strictEqual(0xff, buffer[3]); + assert.strictEqual(0xff, buffer[4]); + assert.strictEqual(0xff, buffer[5]); + assert.strictEqual(0xff, buffer[6]); + assert.strictEqual(0xff, buffer[7]); + assert.strictEqual(0xff, buffer[8]); + assert.strictEqual(0xff, buffer[9]); + assert.strictEqual(0xff, buffer[10]); + assert.strictEqual(0xff, buffer[11]); + assert.strictEqual(0xff, buffer[12]); + assert.strictEqual(0xff, buffer[13]); + assert.strictEqual(0x0f, buffer[14]); + assert.strictEqual(0x00, buffer[15]); buffer.writeDoubleBE(1.0000000000000004, 0); buffer.writeDoubleLE(1.0000000000000004, 8); - assert.equal(0x3f, buffer[0]); - assert.equal(0xf0, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x02, buffer[7]); - assert.equal(0x02, buffer[8]); - assert.equal(0x00, buffer[9]); - assert.equal(0x00, buffer[10]); - assert.equal(0x00, buffer[11]); - assert.equal(0x00, buffer[12]); - assert.equal(0x00, buffer[13]); - assert.equal(0xf0, buffer[14]); - assert.equal(0x3f, buffer[15]); + assert.strictEqual(0x3f, buffer[0]); + assert.strictEqual(0xf0, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x02, buffer[7]); + assert.strictEqual(0x02, buffer[8]); + assert.strictEqual(0x00, buffer[9]); + assert.strictEqual(0x00, buffer[10]); + assert.strictEqual(0x00, buffer[11]); + assert.strictEqual(0x00, buffer[12]); + assert.strictEqual(0x00, buffer[13]); + assert.strictEqual(0xf0, buffer[14]); + assert.strictEqual(0x3f, buffer[15]); buffer.writeDoubleBE(-2, 0); buffer.writeDoubleLE(-2, 8); - assert.equal(0xc0, buffer[0]); - assert.equal(0x00, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x00, buffer[7]); - assert.equal(0x00, buffer[8]); - assert.equal(0x00, buffer[9]); - assert.equal(0x00, buffer[10]); - assert.equal(0x00, buffer[11]); - assert.equal(0x00, buffer[12]); - assert.equal(0x00, buffer[13]); - assert.equal(0x00, buffer[14]); - assert.equal(0xc0, buffer[15]); + assert.strictEqual(0xc0, buffer[0]); + assert.strictEqual(0x00, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x00, buffer[7]); + assert.strictEqual(0x00, buffer[8]); + assert.strictEqual(0x00, buffer[9]); + assert.strictEqual(0x00, buffer[10]); + assert.strictEqual(0x00, buffer[11]); + assert.strictEqual(0x00, buffer[12]); + assert.strictEqual(0x00, buffer[13]); + assert.strictEqual(0x00, buffer[14]); + assert.strictEqual(0xc0, buffer[15]); buffer.writeDoubleBE(1.7976931348623157e+308, 0); buffer.writeDoubleLE(1.7976931348623157e+308, 8); - assert.equal(0x7f, buffer[0]); - assert.equal(0xef, buffer[1]); - assert.equal(0xff, buffer[2]); - assert.equal(0xff, buffer[3]); - assert.equal(0xff, buffer[4]); - assert.equal(0xff, buffer[5]); - assert.equal(0xff, buffer[6]); - assert.equal(0xff, buffer[7]); - assert.equal(0xff, buffer[8]); - assert.equal(0xff, buffer[9]); - assert.equal(0xff, buffer[10]); - assert.equal(0xff, buffer[11]); - assert.equal(0xff, buffer[12]); - assert.equal(0xff, buffer[13]); - assert.equal(0xef, buffer[14]); - assert.equal(0x7f, buffer[15]); + assert.strictEqual(0x7f, buffer[0]); + assert.strictEqual(0xef, buffer[1]); + assert.strictEqual(0xff, buffer[2]); + assert.strictEqual(0xff, buffer[3]); + assert.strictEqual(0xff, buffer[4]); + assert.strictEqual(0xff, buffer[5]); + assert.strictEqual(0xff, buffer[6]); + assert.strictEqual(0xff, buffer[7]); + assert.strictEqual(0xff, buffer[8]); + assert.strictEqual(0xff, buffer[9]); + assert.strictEqual(0xff, buffer[10]); + assert.strictEqual(0xff, buffer[11]); + assert.strictEqual(0xff, buffer[12]); + assert.strictEqual(0xff, buffer[13]); + assert.strictEqual(0xef, buffer[14]); + assert.strictEqual(0x7f, buffer[15]); buffer.writeDoubleBE(0 * -1, 0); buffer.writeDoubleLE(0 * -1, 8); - assert.equal(0x80, buffer[0]); - assert.equal(0x00, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x00, buffer[7]); - assert.equal(0x00, buffer[8]); - assert.equal(0x00, buffer[9]); - assert.equal(0x00, buffer[10]); - assert.equal(0x00, buffer[11]); - assert.equal(0x00, buffer[12]); - assert.equal(0x00, buffer[13]); - assert.equal(0x00, buffer[14]); - assert.equal(0x80, buffer[15]); + assert.strictEqual(0x80, buffer[0]); + assert.strictEqual(0x00, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x00, buffer[7]); + assert.strictEqual(0x00, buffer[8]); + assert.strictEqual(0x00, buffer[9]); + assert.strictEqual(0x00, buffer[10]); + assert.strictEqual(0x00, buffer[11]); + assert.strictEqual(0x00, buffer[12]); + assert.strictEqual(0x00, buffer[13]); + assert.strictEqual(0x00, buffer[14]); + assert.strictEqual(0x80, buffer[15]); buffer.writeDoubleBE(Infinity, 0); buffer.writeDoubleLE(Infinity, 8); - assert.equal(0x7F, buffer[0]); - assert.equal(0xF0, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x00, buffer[7]); - assert.equal(0x00, buffer[8]); - assert.equal(0x00, buffer[9]); - assert.equal(0x00, buffer[10]); - assert.equal(0x00, buffer[11]); - assert.equal(0x00, buffer[12]); - assert.equal(0x00, buffer[13]); - assert.equal(0xF0, buffer[14]); - assert.equal(0x7F, buffer[15]); - assert.equal(Infinity, buffer.readDoubleBE(0)); - assert.equal(Infinity, buffer.readDoubleLE(8)); + assert.strictEqual(0x7F, buffer[0]); + assert.strictEqual(0xF0, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x00, buffer[7]); + assert.strictEqual(0x00, buffer[8]); + assert.strictEqual(0x00, buffer[9]); + assert.strictEqual(0x00, buffer[10]); + assert.strictEqual(0x00, buffer[11]); + assert.strictEqual(0x00, buffer[12]); + assert.strictEqual(0x00, buffer[13]); + assert.strictEqual(0xF0, buffer[14]); + assert.strictEqual(0x7F, buffer[15]); + assert.strictEqual(Infinity, buffer.readDoubleBE(0)); + assert.strictEqual(Infinity, buffer.readDoubleLE(8)); buffer.writeDoubleBE(-Infinity, 0); buffer.writeDoubleLE(-Infinity, 8); - assert.equal(0xFF, buffer[0]); - assert.equal(0xF0, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x00, buffer[7]); - assert.equal(0x00, buffer[8]); - assert.equal(0x00, buffer[9]); - assert.equal(0x00, buffer[10]); - assert.equal(0x00, buffer[11]); - assert.equal(0x00, buffer[12]); - assert.equal(0x00, buffer[13]); - assert.equal(0xF0, buffer[14]); - assert.equal(0xFF, buffer[15]); - assert.equal(-Infinity, buffer.readDoubleBE(0)); - assert.equal(-Infinity, buffer.readDoubleLE(8)); + assert.strictEqual(0xFF, buffer[0]); + assert.strictEqual(0xF0, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x00, buffer[7]); + assert.strictEqual(0x00, buffer[8]); + assert.strictEqual(0x00, buffer[9]); + assert.strictEqual(0x00, buffer[10]); + assert.strictEqual(0x00, buffer[11]); + assert.strictEqual(0x00, buffer[12]); + assert.strictEqual(0x00, buffer[13]); + assert.strictEqual(0xF0, buffer[14]); + assert.strictEqual(0xFF, buffer[15]); + assert.strictEqual(-Infinity, buffer.readDoubleBE(0)); + assert.strictEqual(-Infinity, buffer.readDoubleLE(8)); buffer.writeDoubleBE(NaN, 0); buffer.writeDoubleLE(NaN, 8); diff --git a/test/parallel/test-writefloat.js b/test/parallel/test-writefloat.js index 113e97c6d333b7..aeb62c8c022484 100644 --- a/test/parallel/test-writefloat.js +++ b/test/parallel/test-writefloat.js @@ -10,86 +10,86 @@ function test(clazz) { buffer.writeFloatBE(1, 0); buffer.writeFloatLE(1, 4); - assert.equal(0x3f, buffer[0]); - assert.equal(0x80, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x80, buffer[6]); - assert.equal(0x3f, buffer[7]); + assert.strictEqual(0x3f, buffer[0]); + assert.strictEqual(0x80, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x80, buffer[6]); + assert.strictEqual(0x3f, buffer[7]); buffer.writeFloatBE(1 / 3, 0); buffer.writeFloatLE(1 / 3, 4); - assert.equal(0x3e, buffer[0]); - assert.equal(0xaa, buffer[1]); - assert.equal(0xaa, buffer[2]); - assert.equal(0xab, buffer[3]); - assert.equal(0xab, buffer[4]); - assert.equal(0xaa, buffer[5]); - assert.equal(0xaa, buffer[6]); - assert.equal(0x3e, buffer[7]); + assert.strictEqual(0x3e, buffer[0]); + assert.strictEqual(0xaa, buffer[1]); + assert.strictEqual(0xaa, buffer[2]); + assert.strictEqual(0xab, buffer[3]); + assert.strictEqual(0xab, buffer[4]); + assert.strictEqual(0xaa, buffer[5]); + assert.strictEqual(0xaa, buffer[6]); + assert.strictEqual(0x3e, buffer[7]); buffer.writeFloatBE(3.4028234663852886e+38, 0); buffer.writeFloatLE(3.4028234663852886e+38, 4); - assert.equal(0x7f, buffer[0]); - assert.equal(0x7f, buffer[1]); - assert.equal(0xff, buffer[2]); - assert.equal(0xff, buffer[3]); - assert.equal(0xff, buffer[4]); - assert.equal(0xff, buffer[5]); - assert.equal(0x7f, buffer[6]); - assert.equal(0x7f, buffer[7]); + assert.strictEqual(0x7f, buffer[0]); + assert.strictEqual(0x7f, buffer[1]); + assert.strictEqual(0xff, buffer[2]); + assert.strictEqual(0xff, buffer[3]); + assert.strictEqual(0xff, buffer[4]); + assert.strictEqual(0xff, buffer[5]); + assert.strictEqual(0x7f, buffer[6]); + assert.strictEqual(0x7f, buffer[7]); buffer.writeFloatLE(1.1754943508222875e-38, 0); buffer.writeFloatBE(1.1754943508222875e-38, 4); - assert.equal(0x00, buffer[0]); - assert.equal(0x00, buffer[1]); - assert.equal(0x80, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x80, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x00, buffer[7]); + assert.strictEqual(0x00, buffer[0]); + assert.strictEqual(0x00, buffer[1]); + assert.strictEqual(0x80, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x80, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x00, buffer[7]); buffer.writeFloatBE(0 * -1, 0); buffer.writeFloatLE(0 * -1, 4); - assert.equal(0x80, buffer[0]); - assert.equal(0x00, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x80, buffer[7]); + assert.strictEqual(0x80, buffer[0]); + assert.strictEqual(0x00, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x80, buffer[7]); buffer.writeFloatBE(Infinity, 0); buffer.writeFloatLE(Infinity, 4); - assert.equal(0x7F, buffer[0]); - assert.equal(0x80, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x80, buffer[6]); - assert.equal(0x7F, buffer[7]); - assert.equal(Infinity, buffer.readFloatBE(0)); - assert.equal(Infinity, buffer.readFloatLE(4)); + assert.strictEqual(0x7F, buffer[0]); + assert.strictEqual(0x80, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x80, buffer[6]); + assert.strictEqual(0x7F, buffer[7]); + assert.strictEqual(Infinity, buffer.readFloatBE(0)); + assert.strictEqual(Infinity, buffer.readFloatLE(4)); buffer.writeFloatBE(-Infinity, 0); buffer.writeFloatLE(-Infinity, 4); // Darwin ia32 does the other kind of NaN. // Compiler bug. No one really cares. assert(0xFF === buffer[0] || 0x7F === buffer[0]); - assert.equal(0x80, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x00, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x80, buffer[6]); - assert.equal(0xFF, buffer[7]); - assert.equal(-Infinity, buffer.readFloatBE(0)); - assert.equal(-Infinity, buffer.readFloatLE(4)); + assert.strictEqual(0x80, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x80, buffer[6]); + assert.strictEqual(0xFF, buffer[7]); + assert.strictEqual(-Infinity, buffer.readFloatBE(0)); + assert.strictEqual(-Infinity, buffer.readFloatLE(4)); buffer.writeFloatBE(NaN, 0); buffer.writeFloatLE(NaN, 4); diff --git a/test/parallel/test-writeint.js b/test/parallel/test-writeint.js index 838b1ce4798b75..70599dc17750d7 100644 --- a/test/parallel/test-writeint.js +++ b/test/parallel/test-writeint.js @@ -12,8 +12,8 @@ function test8(clazz) { buffer.writeInt8(0x23, 0); buffer.writeInt8(-5, 1); - assert.equal(0x23, buffer[0]); - assert.equal(0xfb, buffer[1]); + assert.strictEqual(0x23, buffer[0]); + assert.strictEqual(0xfb, buffer[1]); /* Make sure we handle truncation correctly */ assert.throws(function() { @@ -27,8 +27,8 @@ function test8(clazz) { buffer.writeInt8(0x7f, 0); buffer.writeInt8(-0x80, 1); - assert.equal(0x7f, buffer[0]); - assert.equal(0x80, buffer[1]); + assert.strictEqual(0x7f, buffer[0]); + assert.strictEqual(0x80, buffer[1]); assert.throws(function() { buffer.writeInt8(0x7f + 1, 0); }, errorOutOfBounds); @@ -43,32 +43,32 @@ function test16(clazz) { buffer.writeInt16BE(0x0023, 0); buffer.writeInt16LE(0x0023, 2); - assert.equal(0x00, buffer[0]); - assert.equal(0x23, buffer[1]); - assert.equal(0x23, buffer[2]); - assert.equal(0x00, buffer[3]); + assert.strictEqual(0x00, buffer[0]); + assert.strictEqual(0x23, buffer[1]); + assert.strictEqual(0x23, buffer[2]); + assert.strictEqual(0x00, buffer[3]); buffer.writeInt16BE(-5, 0); buffer.writeInt16LE(-5, 2); - assert.equal(0xff, buffer[0]); - assert.equal(0xfb, buffer[1]); - assert.equal(0xfb, buffer[2]); - assert.equal(0xff, buffer[3]); + assert.strictEqual(0xff, buffer[0]); + assert.strictEqual(0xfb, buffer[1]); + assert.strictEqual(0xfb, buffer[2]); + assert.strictEqual(0xff, buffer[3]); buffer.writeInt16BE(-1679, 1); buffer.writeInt16LE(-1679, 3); - assert.equal(0xf9, buffer[1]); - assert.equal(0x71, buffer[2]); - assert.equal(0x71, buffer[3]); - assert.equal(0xf9, buffer[4]); + assert.strictEqual(0xf9, buffer[1]); + assert.strictEqual(0x71, buffer[2]); + assert.strictEqual(0x71, buffer[3]); + assert.strictEqual(0xf9, buffer[4]); /* Make sure we handle min/max correctly */ buffer.writeInt16BE(0x7fff, 0); buffer.writeInt16BE(-0x8000, 2); - assert.equal(0x7f, buffer[0]); - assert.equal(0xff, buffer[1]); - assert.equal(0x80, buffer[2]); - assert.equal(0x00, buffer[3]); + assert.strictEqual(0x7f, buffer[0]); + assert.strictEqual(0xff, buffer[1]); + assert.strictEqual(0x80, buffer[2]); + assert.strictEqual(0x00, buffer[3]); assert.throws(function() { buffer.writeInt16BE(0x7fff + 1, 0); }, errorOutOfBounds); @@ -78,10 +78,10 @@ function test16(clazz) { buffer.writeInt16LE(0x7fff, 0); buffer.writeInt16LE(-0x8000, 2); - assert.equal(0xff, buffer[0]); - assert.equal(0x7f, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x80, buffer[3]); + assert.strictEqual(0xff, buffer[0]); + assert.strictEqual(0x7f, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x80, buffer[3]); assert.throws(function() { buffer.writeInt16LE(0x7fff + 1, 0); }, errorOutOfBounds); @@ -96,48 +96,48 @@ function test32(clazz) { buffer.writeInt32BE(0x23, 0); buffer.writeInt32LE(0x23, 4); - assert.equal(0x00, buffer[0]); - assert.equal(0x00, buffer[1]); - assert.equal(0x00, buffer[2]); - assert.equal(0x23, buffer[3]); - assert.equal(0x23, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x00, buffer[7]); + assert.strictEqual(0x00, buffer[0]); + assert.strictEqual(0x00, buffer[1]); + assert.strictEqual(0x00, buffer[2]); + assert.strictEqual(0x23, buffer[3]); + assert.strictEqual(0x23, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x00, buffer[7]); buffer.writeInt32BE(-5, 0); buffer.writeInt32LE(-5, 4); - assert.equal(0xff, buffer[0]); - assert.equal(0xff, buffer[1]); - assert.equal(0xff, buffer[2]); - assert.equal(0xfb, buffer[3]); - assert.equal(0xfb, buffer[4]); - assert.equal(0xff, buffer[5]); - assert.equal(0xff, buffer[6]); - assert.equal(0xff, buffer[7]); + assert.strictEqual(0xff, buffer[0]); + assert.strictEqual(0xff, buffer[1]); + assert.strictEqual(0xff, buffer[2]); + assert.strictEqual(0xfb, buffer[3]); + assert.strictEqual(0xfb, buffer[4]); + assert.strictEqual(0xff, buffer[5]); + assert.strictEqual(0xff, buffer[6]); + assert.strictEqual(0xff, buffer[7]); buffer.writeInt32BE(-805306713, 0); buffer.writeInt32LE(-805306713, 4); - assert.equal(0xcf, buffer[0]); - assert.equal(0xff, buffer[1]); - assert.equal(0xfe, buffer[2]); - assert.equal(0xa7, buffer[3]); - assert.equal(0xa7, buffer[4]); - assert.equal(0xfe, buffer[5]); - assert.equal(0xff, buffer[6]); - assert.equal(0xcf, buffer[7]); + assert.strictEqual(0xcf, buffer[0]); + assert.strictEqual(0xff, buffer[1]); + assert.strictEqual(0xfe, buffer[2]); + assert.strictEqual(0xa7, buffer[3]); + assert.strictEqual(0xa7, buffer[4]); + assert.strictEqual(0xfe, buffer[5]); + assert.strictEqual(0xff, buffer[6]); + assert.strictEqual(0xcf, buffer[7]); /* Make sure we handle min/max correctly */ buffer.writeInt32BE(0x7fffffff, 0); buffer.writeInt32BE(-0x80000000, 4); - assert.equal(0x7f, buffer[0]); - assert.equal(0xff, buffer[1]); - assert.equal(0xff, buffer[2]); - assert.equal(0xff, buffer[3]); - assert.equal(0x80, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x00, buffer[7]); + assert.strictEqual(0x7f, buffer[0]); + assert.strictEqual(0xff, buffer[1]); + assert.strictEqual(0xff, buffer[2]); + assert.strictEqual(0xff, buffer[3]); + assert.strictEqual(0x80, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x00, buffer[7]); assert.throws(function() { buffer.writeInt32BE(0x7fffffff + 1, 0); }, errorOutOfBounds); @@ -147,14 +147,14 @@ function test32(clazz) { buffer.writeInt32LE(0x7fffffff, 0); buffer.writeInt32LE(-0x80000000, 4); - assert.equal(0xff, buffer[0]); - assert.equal(0xff, buffer[1]); - assert.equal(0xff, buffer[2]); - assert.equal(0x7f, buffer[3]); - assert.equal(0x00, buffer[4]); - assert.equal(0x00, buffer[5]); - assert.equal(0x00, buffer[6]); - assert.equal(0x80, buffer[7]); + assert.strictEqual(0xff, buffer[0]); + assert.strictEqual(0xff, buffer[1]); + assert.strictEqual(0xff, buffer[2]); + assert.strictEqual(0x7f, buffer[3]); + assert.strictEqual(0x00, buffer[4]); + assert.strictEqual(0x00, buffer[5]); + assert.strictEqual(0x00, buffer[6]); + assert.strictEqual(0x80, buffer[7]); assert.throws(function() { buffer.writeInt32LE(0x7fffffff + 1, 0); }, errorOutOfBounds); diff --git a/test/parallel/test-writeuint.js b/test/parallel/test-writeuint.js index bddb954d248633..e91e1d256d0261 100644 --- a/test/parallel/test-writeuint.js +++ b/test/parallel/test-writeuint.js @@ -19,25 +19,25 @@ function test8(clazz) { data.writeUInt8(23, 1); data.writeUInt8(23, 2); data.writeUInt8(23, 3); - assert.equal(23, data[0]); - assert.equal(23, data[1]); - assert.equal(23, data[2]); - assert.equal(23, data[3]); + assert.strictEqual(23, data[0]); + assert.strictEqual(23, data[1]); + assert.strictEqual(23, data[2]); + assert.strictEqual(23, data[3]); data.writeUInt8(23, 0); data.writeUInt8(23, 1); data.writeUInt8(23, 2); data.writeUInt8(23, 3); - assert.equal(23, data[0]); - assert.equal(23, data[1]); - assert.equal(23, data[2]); - assert.equal(23, data[3]); + assert.strictEqual(23, data[0]); + assert.strictEqual(23, data[1]); + assert.strictEqual(23, data[2]); + assert.strictEqual(23, data[3]); data.writeUInt8(255, 0); - assert.equal(255, data[0]); + assert.strictEqual(255, data[0]); data.writeUInt8(255, 0); - assert.equal(255, data[0]); + assert.strictEqual(255, data[0]); } @@ -46,37 +46,37 @@ function test16(clazz) { const data = new clazz(4); data.writeUInt16BE(value, 0); - assert.equal(0x23, data[0]); - assert.equal(0x43, data[1]); + assert.strictEqual(0x23, data[0]); + assert.strictEqual(0x43, data[1]); data.writeUInt16BE(value, 1); - assert.equal(0x23, data[1]); - assert.equal(0x43, data[2]); + assert.strictEqual(0x23, data[1]); + assert.strictEqual(0x43, data[2]); data.writeUInt16BE(value, 2); - assert.equal(0x23, data[2]); - assert.equal(0x43, data[3]); + assert.strictEqual(0x23, data[2]); + assert.strictEqual(0x43, data[3]); data.writeUInt16LE(value, 0); - assert.equal(0x23, data[1]); - assert.equal(0x43, data[0]); + assert.strictEqual(0x23, data[1]); + assert.strictEqual(0x43, data[0]); data.writeUInt16LE(value, 1); - assert.equal(0x23, data[2]); - assert.equal(0x43, data[1]); + assert.strictEqual(0x23, data[2]); + assert.strictEqual(0x43, data[1]); data.writeUInt16LE(value, 2); - assert.equal(0x23, data[3]); - assert.equal(0x43, data[2]); + assert.strictEqual(0x23, data[3]); + assert.strictEqual(0x43, data[2]); value = 0xff80; data.writeUInt16LE(value, 0); - assert.equal(0xff, data[1]); - assert.equal(0x80, data[0]); + assert.strictEqual(0xff, data[1]); + assert.strictEqual(0x80, data[0]); data.writeUInt16BE(value, 0); - assert.equal(0xff, data[0]); - assert.equal(0x80, data[1]); + assert.strictEqual(0xff, data[0]); + assert.strictEqual(0x80, data[1]); } @@ -85,40 +85,40 @@ function test32(clazz) { const value = 0xe7f90a6d; data.writeUInt32BE(value, 0); - assert.equal(0xe7, data[0]); - assert.equal(0xf9, data[1]); - assert.equal(0x0a, data[2]); - assert.equal(0x6d, data[3]); + assert.strictEqual(0xe7, data[0]); + assert.strictEqual(0xf9, data[1]); + assert.strictEqual(0x0a, data[2]); + assert.strictEqual(0x6d, data[3]); data.writeUInt32BE(value, 1); - assert.equal(0xe7, data[1]); - assert.equal(0xf9, data[2]); - assert.equal(0x0a, data[3]); - assert.equal(0x6d, data[4]); + assert.strictEqual(0xe7, data[1]); + assert.strictEqual(0xf9, data[2]); + assert.strictEqual(0x0a, data[3]); + assert.strictEqual(0x6d, data[4]); data.writeUInt32BE(value, 2); - assert.equal(0xe7, data[2]); - assert.equal(0xf9, data[3]); - assert.equal(0x0a, data[4]); - assert.equal(0x6d, data[5]); + assert.strictEqual(0xe7, data[2]); + assert.strictEqual(0xf9, data[3]); + assert.strictEqual(0x0a, data[4]); + assert.strictEqual(0x6d, data[5]); data.writeUInt32LE(value, 0); - assert.equal(0xe7, data[3]); - assert.equal(0xf9, data[2]); - assert.equal(0x0a, data[1]); - assert.equal(0x6d, data[0]); + assert.strictEqual(0xe7, data[3]); + assert.strictEqual(0xf9, data[2]); + assert.strictEqual(0x0a, data[1]); + assert.strictEqual(0x6d, data[0]); data.writeUInt32LE(value, 1); - assert.equal(0xe7, data[4]); - assert.equal(0xf9, data[3]); - assert.equal(0x0a, data[2]); - assert.equal(0x6d, data[1]); + assert.strictEqual(0xe7, data[4]); + assert.strictEqual(0xf9, data[3]); + assert.strictEqual(0x0a, data[2]); + assert.strictEqual(0x6d, data[1]); data.writeUInt32LE(value, 2); - assert.equal(0xe7, data[5]); - assert.equal(0xf9, data[4]); - assert.equal(0x0a, data[3]); - assert.equal(0x6d, data[2]); + assert.strictEqual(0xe7, data[5]); + assert.strictEqual(0xf9, data[4]); + assert.strictEqual(0x0a, data[3]); + assert.strictEqual(0x6d, data[2]); } diff --git a/test/parallel/test-zlib-const.js b/test/parallel/test-zlib-const.js index cafa4f8caaf28a..ba6bb5fb8a26b4 100644 --- a/test/parallel/test-zlib-const.js +++ b/test/parallel/test-zlib-const.js @@ -4,14 +4,14 @@ const assert = require('assert'); const zlib = require('zlib'); -assert.equal(zlib.constants.Z_OK, 0, 'Z_OK should be 0'); +assert.strictEqual(zlib.constants.Z_OK, 0, 'Z_OK should be 0'); zlib.constants.Z_OK = 1; -assert.equal(zlib.constants.Z_OK, 0, 'Z_OK should be 0'); +assert.strictEqual(zlib.constants.Z_OK, 0, 'Z_OK should be 0'); -assert.equal(zlib.codes.Z_OK, 0, 'Z_OK should be 0'); +assert.strictEqual(zlib.codes.Z_OK, 0, 'Z_OK should be 0'); zlib.codes.Z_OK = 1; -assert.equal(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0'); +assert.strictEqual(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0'); zlib.codes = {Z_OK: 1}; -assert.equal(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0'); +assert.strictEqual(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0'); assert.ok(Object.isFrozen(zlib.codes), 'zlib.codes should be frozen'); diff --git a/test/parallel/test-zlib-convenience-methods.js b/test/parallel/test-zlib-convenience-methods.js index b67b65d7d0b689..9b9419c7bfaf47 100644 --- a/test/parallel/test-zlib-convenience-methods.js +++ b/test/parallel/test-zlib-convenience-methods.js @@ -22,8 +22,8 @@ const opts = { zlib[method[0]](expect, opts, function(err, result) { zlib[method[1]](result, opts, function(err, result) { - assert.equal(result, expect, - 'Should get original string after ' + + assert.strictEqual(result.toString(), expect, + 'Should get original string after ' + method[0] + '/' + method[1] + ' with options.'); hadRun++; }); @@ -31,8 +31,8 @@ const opts = { zlib[method[0]](expect, function(err, result) { zlib[method[1]](result, function(err, result) { - assert.equal(result, expect, - 'Should get original string after ' + + assert.strictEqual(result.toString(), expect, + 'Should get original string after ' + method[0] + '/' + method[1] + ' without options.'); hadRun++; }); @@ -40,20 +40,20 @@ const opts = { let result = zlib[method[0] + 'Sync'](expect, opts); result = zlib[method[1] + 'Sync'](result, opts); - assert.equal(result, expect, - 'Should get original string after ' + + assert.strictEqual(result.toString(), expect, + 'Should get original string after ' + method[0] + '/' + method[1] + ' with options.'); hadRun++; result = zlib[method[0] + 'Sync'](expect); result = zlib[method[1] + 'Sync'](result); - assert.equal(result, expect, - 'Should get original string after ' + + assert.strictEqual(result.toString(), expect, + 'Should get original string after ' + method[0] + '/' + method[1] + ' without options.'); hadRun++; }); process.on('exit', function() { - assert.equal(hadRun, 16, 'expect 16 compressions'); + assert.strictEqual(hadRun, 16, 'expect 16 compressions'); }); diff --git a/test/parallel/test-zlib-flush-drain.js b/test/parallel/test-zlib-flush-drain.js index afa4194ac6d453..d446f048b06586 100644 --- a/test/parallel/test-zlib-flush-drain.js +++ b/test/parallel/test-zlib-flush-drain.js @@ -37,12 +37,12 @@ deflater.on('drain', function() { }); process.once('exit', function() { - assert.equal(beforeFlush, true, - 'before calling flush, writable stream should need to drain'); - assert.equal(afterFlush, false, - 'after calling flush, writable stream should not need to drain'); - assert.equal(drainCount, 1, - 'the deflater should have emitted a single drain event'); - assert.equal(flushCount, 2, - 'flush should be called twice'); + assert.strictEqual(beforeFlush, true, 'before calling flush, writable ' + + 'stream should need to drain'); + assert.strictEqual(afterFlush, false, 'after calling flush, writable ' + + 'stream should not need to drain'); + assert.strictEqual(drainCount, 1, + 'the deflater should have emitted a single drain event'); + assert.strictEqual(flushCount, 2, + 'flush should be called twice'); }); diff --git a/test/parallel/test-zlib-from-concatenated-gzip.js b/test/parallel/test-zlib-from-concatenated-gzip.js index 998a086eb76514..f59b6796357e3b 100644 --- a/test/parallel/test-zlib-from-concatenated-gzip.js +++ b/test/parallel/test-zlib-from-concatenated-gzip.js @@ -15,16 +15,18 @@ const data = Buffer.concat([ defEncoded ]); -assert.equal(zlib.gunzipSync(data).toString(), 'abcdef'); +assert.strictEqual(zlib.gunzipSync(data).toString(), 'abcdef'); zlib.gunzip(data, common.mustCall((err, result) => { assert.ifError(err); - assert.equal(result, 'abcdef', 'result should match original string'); + assert.strictEqual(result.toString(), 'abcdef', + 'result should match original string'); })); zlib.unzip(data, common.mustCall((err, result) => { assert.ifError(err); - assert.equal(result, 'abcdef', 'result should match original string'); + assert.strictEqual(result.toString(), 'abcdef', + 'result should match original string'); })); // Multi-member support does not apply to zlib inflate/deflate. @@ -33,7 +35,8 @@ zlib.unzip(Buffer.concat([ zlib.deflateSync('def') ]), common.mustCall((err, result) => { assert.ifError(err); - assert.equal(result, 'abc', 'result should match contents of first "member"'); + assert.strictEqual(result.toString(), 'abc', + 'result should match contents of first "member"'); })); // files that have the "right" magic bytes for starting a new gzip member diff --git a/test/parallel/test-zlib-from-gzip.js b/test/parallel/test-zlib-from-gzip.js index 3c7e96cef92a0a..ac01fc03d11c6f 100644 --- a/test/parallel/test-zlib-from-gzip.js +++ b/test/parallel/test-zlib-from-gzip.js @@ -23,8 +23,8 @@ const out = fs.createWriteStream(outputFile); inp.pipe(gunzip).pipe(out); out.on('close', function() { const actual = fs.readFileSync(outputFile); - assert.equal(actual.length, expect.length, 'length should match'); + assert.strictEqual(actual.length, expect.length, 'length should match'); for (let i = 0, l = actual.length; i < l; i++) { - assert.equal(actual[i], expect[i], 'byte[' + i + ']'); + assert.strictEqual(actual[i], expect[i], 'byte[' + i + ']'); } }); diff --git a/test/parallel/test-zlib-from-string.js b/test/parallel/test-zlib-from-string.js index 0f885ac80ecbe6..ab2f7d023d8bc8 100644 --- a/test/parallel/test-zlib-from-string.js +++ b/test/parallel/test-zlib-from-string.js @@ -34,8 +34,8 @@ const expectedBase64Gzip = 'H4sIAAAAAAAAA11RS05DMQy8yhzg6d2BPSAkJPZu4laWkjiN4' + 'sHnHNzRtagj5AQAA'; zlib.deflate(inputString, function(err, buffer) { - assert.equal(buffer.toString('base64'), expectedBase64Deflate, - 'deflate encoded string should match'); + assert.strictEqual(buffer.toString('base64'), expectedBase64Deflate, + 'deflate encoded string should match'); }); zlib.gzip(inputString, function(err, buffer) { @@ -46,19 +46,19 @@ zlib.gzip(inputString, function(err, buffer) { // result that we're expecting, and this should match what we get // from inflating the known valid deflate data. zlib.gunzip(buffer, function(err, gunzipped) { - assert.equal(gunzipped.toString(), inputString, - 'Should get original string after gzip/gunzip'); + assert.strictEqual(gunzipped.toString(), inputString, + 'Should get original string after gzip/gunzip'); }); }); let buffer = Buffer.from(expectedBase64Deflate, 'base64'); zlib.unzip(buffer, function(err, buffer) { - assert.equal(buffer.toString(), inputString, - 'decoded inflated string should match'); + assert.strictEqual(buffer.toString(), inputString, + 'decoded inflated string should match'); }); buffer = Buffer.from(expectedBase64Gzip, 'base64'); zlib.unzip(buffer, function(err, buffer) { - assert.equal(buffer.toString(), inputString, - 'decoded gunzipped string should match'); + assert.strictEqual(buffer.toString(), inputString, + 'decoded gunzipped string should match'); }); diff --git a/test/parallel/test-zlib-random-byte-pipes.js b/test/parallel/test-zlib-random-byte-pipes.js index 83855ebd1f2c0a..d4cd4319f93c21 100644 --- a/test/parallel/test-zlib-random-byte-pipes.js +++ b/test/parallel/test-zlib-random-byte-pipes.js @@ -154,5 +154,5 @@ out.on('data', function(c) { out.on('data', common.mustCall(function(c) { console.error('hash=%s', c); - assert.equal(c, inp._hash, 'hashes should match'); + assert.strictEqual(c, inp._hash, 'hashes should match'); })); diff --git a/test/parallel/test-zlib-write-after-flush.js b/test/parallel/test-zlib-write-after-flush.js index 342c9143ba4643..e0e962218269dd 100644 --- a/test/parallel/test-zlib-write-after-flush.js +++ b/test/parallel/test-zlib-write-after-flush.js @@ -16,10 +16,10 @@ gunz.on('data', function(c) { }); process.on('exit', function() { - assert.equal(output, input); + assert.strictEqual(output, input); // Make sure that the flush flag was set back to normal - assert.equal(gzip._flushFlag, zlib.constants.Z_NO_FLUSH); + assert.strictEqual(gzip._flushFlag, zlib.constants.Z_NO_FLUSH); console.log('ok'); }); diff --git a/test/pummel/test-crypto-dh.js b/test/pummel/test-crypto-dh.js index d441e80926df45..64c2800f16ae8d 100644 --- a/test/pummel/test-crypto-dh.js +++ b/test/pummel/test-crypto-dh.js @@ -35,8 +35,8 @@ for (const name in hashes) { const hash1 = hashes[name]; const hash2 = crypto.createHash('sha1') .update(private_key.toUpperCase()).digest('hex'); - assert.equal(hash1, hash2); - assert.equal(group.getGenerator('hex'), '02'); + assert.strictEqual(hash1, hash2); + assert.strictEqual(group.getGenerator('hex'), '02'); } for (const name in hashes) { diff --git a/test/pummel/test-dtrace-jsstack.js b/test/pummel/test-dtrace-jsstack.js index d1615a3855af43..6c8423c2c9c83b 100644 --- a/test/pummel/test-dtrace-jsstack.js +++ b/test/pummel/test-dtrace-jsstack.js @@ -71,11 +71,12 @@ dtrace.on('exit', function(code) { const frame = line.substr(line.indexOf(sentinel) + sentinel.length); const top = frames.shift(); - assert.equal(frame.indexOf(top), 0, 'unexpected frame where ' + + assert.strictEqual(frame.indexOf(top), 0, 'unexpected frame where ' + top + ' was expected'); } - assert.equal(frames.length, 0, 'did not find expected frame ' + frames[0]); + assert.strictEqual(frames.length, 0, + 'did not find expected frame ' + frames[0]); process.exit(0); }); diff --git a/test/pummel/test-fs-watch-file-slow.js b/test/pummel/test-fs-watch-file-slow.js index 78c36152ecd315..1e9b5eb1f219ff 100644 --- a/test/pummel/test-fs-watch-file-slow.js +++ b/test/pummel/test-fs-watch-file-slow.js @@ -19,14 +19,14 @@ fs.watchFile(FILENAME, {interval: TIMEOUT - 250}, function(curr, prev) { console.log([curr, prev]); switch (++nevents) { case 1: - assert.equal(common.fileExists(FILENAME), false); + assert.strictEqual(common.fileExists(FILENAME), false); break; case 2: case 3: - assert.equal(common.fileExists(FILENAME), true); + assert.strictEqual(common.fileExists(FILENAME), true); break; case 4: - assert.equal(common.fileExists(FILENAME), false); + assert.strictEqual(common.fileExists(FILENAME), false); fs.unwatchFile(FILENAME); break; default: @@ -35,7 +35,7 @@ fs.watchFile(FILENAME, {interval: TIMEOUT - 250}, function(curr, prev) { }); process.on('exit', function() { - assert.equal(nevents, 4); + assert.strictEqual(nevents, 4); }); setTimeout(createFile, TIMEOUT); diff --git a/test/pummel/test-fs-watch-file.js b/test/pummel/test-fs-watch-file.js index 7713fe74ed99aa..3fda41040486df 100644 --- a/test/pummel/test-fs-watch-file.js +++ b/test/pummel/test-fs-watch-file.js @@ -27,10 +27,10 @@ process.on('exit', function() { fs.unlinkSync(filepathTwoAbs); fs.unlinkSync(filenameThree); fs.unlinkSync(filenameFour); - assert.equal(1, watchSeenOne); - assert.equal(2, watchSeenTwo); - assert.equal(1, watchSeenThree); - assert.equal(1, watchSeenFour); + assert.strictEqual(1, watchSeenOne); + assert.strictEqual(2, watchSeenTwo); + assert.strictEqual(1, watchSeenThree); + assert.strictEqual(1, watchSeenFour); }); @@ -122,7 +122,7 @@ assert.doesNotThrow( function() { function a() { ++watchSeenFour; - assert.equal(1, watchSeenFour); + assert.strictEqual(1, watchSeenFour); fs.unwatchFile('.' + path.sep + filenameFour, a); } fs.watchFile(filenameFour, a); diff --git a/test/pummel/test-http-many-keep-alive-connections.js b/test/pummel/test-http-many-keep-alive-connections.js index e465c02a90161c..ee616e1d918e66 100644 --- a/test/pummel/test-http-many-keep-alive-connections.js +++ b/test/pummel/test-http-many-keep-alive-connections.js @@ -10,7 +10,7 @@ let connection; const server = http.Server(function(req, res) { requests++; - assert.equal(req.connection, connection); + assert.strictEqual(req.connection, connection); res.writeHead(200); res.end('hello world\n'); }); @@ -43,6 +43,6 @@ server.listen(common.PORT, function connect() { }); process.on('exit', function() { - assert.equal(expected, responses); - assert.equal(expected, requests); + assert.strictEqual(expected, responses); + assert.strictEqual(expected, requests); }); diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/pummel/test-https-ci-reneg-attack.js index 850e0949c4a64a..6113ee54ce904b 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -71,7 +71,7 @@ function test(next) { }); child.on('exit', function() { - assert.equal(renegs, tls.CLIENT_RENEG_LIMIT + 1); + assert.strictEqual(renegs, tls.CLIENT_RENEG_LIMIT + 1); server.close(); process.nextTick(next); }); @@ -83,7 +83,7 @@ function test(next) { case 'EPIPE': break; default: - assert.equal(err.code, 'ECONNRESET'); + assert.strictEqual(err.code, 'ECONNRESET'); break; } closed = true; diff --git a/test/pummel/test-net-connect-econnrefused.js b/test/pummel/test-net-connect-econnrefused.js index 30da36d983e4f7..4ac55da40553e0 100644 --- a/test/pummel/test-net-connect-econnrefused.js +++ b/test/pummel/test-net-connect-econnrefused.js @@ -18,7 +18,7 @@ function pummel() { let pending; for (pending = 0; pending < ATTEMPTS_PER_ROUND; pending++) { net.createConnection(common.PORT).on('error', function(err) { - assert.equal(err.code, 'ECONNREFUSED'); + assert.strictEqual(err.code, 'ECONNREFUSED'); if (--pending > 0) return; if (rounds === ROUNDS) return check(); rounds++; @@ -30,15 +30,15 @@ function pummel() { function check() { setTimeout(function() { - assert.equal(process._getActiveRequests().length, 0); - assert.equal(process._getActiveHandles().length, 1); // the timer + assert.strictEqual(process._getActiveRequests().length, 0); + assert.strictEqual(process._getActiveHandles().length, 1); // the timer check_called = true; }, 0); } let check_called = false; process.on('exit', function() { - assert.equal(rounds, ROUNDS); - assert.equal(reqs, ROUNDS * ATTEMPTS_PER_ROUND); + assert.strictEqual(rounds, ROUNDS); + assert.strictEqual(reqs, ROUNDS * ATTEMPTS_PER_ROUND); assert(check_called); }); diff --git a/test/pummel/test-net-many-clients.js b/test/pummel/test-net-many-clients.js index a92ae033a09a17..fdcdf1198f8df2 100644 --- a/test/pummel/test-net-many-clients.js +++ b/test/pummel/test-net-many-clients.js @@ -49,8 +49,8 @@ function runClient(callback) { client.on('close', function(had_error) { console.log('.'); - assert.equal(false, had_error); - assert.equal(bytes, client.recved.length); + assert.strictEqual(false, had_error); + assert.strictEqual(bytes, client.recved.length); if (client.fd) { console.log(client.fd); @@ -75,6 +75,6 @@ server.listen(common.PORT, function() { }); process.on('exit', function() { - assert.equal(connections_per_client * concurrency, total_connections); + assert.strictEqual(connections_per_client * concurrency, total_connections); console.log('\nokay!'); }); diff --git a/test/pummel/test-net-pause.js b/test/pummel/test-net-pause.js index db426edbe9c507..6a701d56869afb 100644 --- a/test/pummel/test-net-pause.js +++ b/test/pummel/test-net-pause.js @@ -31,11 +31,11 @@ server.on('listening', function() { setTimeout(function() { chars_recved = recv.length; console.log('pause at: ' + chars_recved); - assert.equal(true, chars_recved > 1); + assert.strictEqual(true, chars_recved > 1); client.pause(); setTimeout(function() { console.log('resume at: ' + chars_recved); - assert.equal(chars_recved, recv.length); + assert.strictEqual(chars_recved, recv.length); client.resume(); setTimeout(function() { @@ -45,7 +45,7 @@ server.on('listening', function() { setTimeout(function() { console.log('resume at: ' + chars_recved); - assert.equal(chars_recved, recv.length); + assert.strictEqual(chars_recved, recv.length); client.resume(); }, 500); @@ -64,6 +64,6 @@ server.on('listening', function() { server.listen(common.PORT); process.on('exit', function() { - assert.equal(N, recv.length); + assert.strictEqual(N, recv.length); console.error('Exit'); }); diff --git a/test/pummel/test-net-pingpong-delay.js b/test/pummel/test-net-pingpong-delay.js index 9a598435d1bd28..2236ba83a88f02 100644 --- a/test/pummel/test-net-pingpong-delay.js +++ b/test/pummel/test-net-pingpong-delay.js @@ -14,30 +14,30 @@ function pingPongTest(port, host, on_complete) { socket.on('data', function(data) { console.log(data); - assert.equal('PING', data); - assert.equal('open', socket.readyState); - assert.equal(true, count <= N); + assert.strictEqual('PING', data); + assert.strictEqual('open', socket.readyState); + assert.strictEqual(true, count <= N); setTimeout(function() { - assert.equal('open', socket.readyState); + assert.strictEqual('open', socket.readyState); socket.write('PONG'); }, DELAY); }); socket.on('timeout', function() { console.error('server-side timeout!!'); - assert.equal(false, true); + assert.strictEqual(false, true); }); socket.on('end', function() { console.log('server-side socket EOF'); - assert.equal('writeOnly', socket.readyState); + assert.strictEqual('writeOnly', socket.readyState); socket.end(); }); socket.on('close', function(had_error) { console.log('server-side socket.end'); - assert.equal(false, had_error); - assert.equal('closed', socket.readyState); + assert.strictEqual(false, had_error); + assert.strictEqual('closed', socket.readyState); socket.server.close(); }); }); @@ -48,17 +48,17 @@ function pingPongTest(port, host, on_complete) { client.setEncoding('utf8'); client.on('connect', function() { - assert.equal('open', client.readyState); + assert.strictEqual('open', client.readyState); client.write('PING'); }); client.on('data', function(data) { console.log(data); - assert.equal('PONG', data); - assert.equal('open', client.readyState); + assert.strictEqual('PONG', data); + assert.strictEqual('open', client.readyState); setTimeout(function() { - assert.equal('open', client.readyState); + assert.strictEqual('open', client.readyState); if (count++ < N) { client.write('PING'); } else { @@ -71,12 +71,12 @@ function pingPongTest(port, host, on_complete) { client.on('timeout', function() { console.error('client-side timeout!!'); - assert.equal(false, true); + assert.strictEqual(false, true); }); client.on('close', common.mustCall(function() { console.log('client.end'); - assert.equal(N + 1, count); + assert.strictEqual(N + 1, count); assert.ok(client_ended); if (on_complete) on_complete(); })); diff --git a/test/pummel/test-net-pingpong.js b/test/pummel/test-net-pingpong.js index 6ede6f9fcb2763..5e0950285739a1 100644 --- a/test/pummel/test-net-pingpong.js +++ b/test/pummel/test-net-pingpong.js @@ -11,16 +11,16 @@ function pingPongTest(port, host, on_complete) { let sent_final_ping = false; const server = net.createServer({ allowHalfOpen: true }, function(socket) { - assert.equal(true, socket.remoteAddress !== null); - assert.equal(true, socket.remoteAddress !== undefined); + assert.strictEqual(true, socket.remoteAddress !== null); + assert.strictEqual(true, socket.remoteAddress !== undefined); const address = socket.remoteAddress; if (host === '127.0.0.1') { - assert.equal(address, '127.0.0.1'); + assert.strictEqual(address, '127.0.0.1'); } else if (host == null || host === 'localhost') { assert(address === '127.0.0.1' || address === '::ffff:127.0.0.1'); } else { console.log('host = ' + host + ', remoteAddress = ' + address); - assert.equal(address, '::1'); + assert.strictEqual(address, '::1'); } socket.setEncoding('utf8'); @@ -29,21 +29,21 @@ function pingPongTest(port, host, on_complete) { socket.on('data', function(data) { console.log('server got: ' + JSON.stringify(data)); - assert.equal('open', socket.readyState); - assert.equal(true, count <= N); + assert.strictEqual('open', socket.readyState); + assert.strictEqual(true, count <= N); if (/PING/.exec(data)) { socket.write('PONG'); } }); socket.on('end', function() { - assert.equal('writeOnly', socket.readyState); + assert.strictEqual('writeOnly', socket.readyState); socket.end(); }); socket.on('close', function(had_error) { - assert.equal(false, had_error); - assert.equal('closed', socket.readyState); + assert.strictEqual(false, had_error); + assert.strictEqual('closed', socket.readyState); socket.server.close(); }); }); @@ -54,21 +54,21 @@ function pingPongTest(port, host, on_complete) { client.setEncoding('utf8'); client.on('connect', function() { - assert.equal('open', client.readyState); + assert.strictEqual('open', client.readyState); client.write('PING'); }); client.on('data', function(data) { console.log('client got: ' + data); - assert.equal('PONG', data); + assert.strictEqual('PONG', data); count += 1; if (sent_final_ping) { - assert.equal('readOnly', client.readyState); + assert.strictEqual('readOnly', client.readyState); return; } else { - assert.equal('open', client.readyState); + assert.strictEqual('open', client.readyState); } if (count < N) { @@ -81,8 +81,8 @@ function pingPongTest(port, host, on_complete) { }); client.on('close', function() { - assert.equal(N + 1, count); - assert.equal(true, sent_final_ping); + assert.strictEqual(N + 1, count); + assert.strictEqual(true, sent_final_ping); if (on_complete) on_complete(); tests_run += 1; }); @@ -97,5 +97,5 @@ pingPongTest(common.PORT + 1, null); if (!common.isSunOS) pingPongTest(common.PORT + 2, '::1'); process.on('exit', function() { - assert.equal(common.isSunOS ? 2 : 3, tests_run); + assert.strictEqual(common.isSunOS ? 2 : 3, tests_run); }); diff --git a/test/pummel/test-net-throttle.js b/test/pummel/test-net-throttle.js index 23f05f4d5eaeaa..c222d0bb17ccfa 100644 --- a/test/pummel/test-net-throttle.js +++ b/test/pummel/test-net-throttle.js @@ -16,7 +16,7 @@ console.log('start server on port ' + common.PORT); const server = net.createServer(function(connection) { connection.write(body.slice(0, part_N)); connection.write(body.slice(part_N, 2 * part_N)); - assert.equal(false, connection.write(body.slice(2 * part_N, N))); + assert.strictEqual(false, connection.write(body.slice(2 * part_N, N))); console.log('bufferSize: ' + connection.bufferSize, 'expecting', N); assert.ok(0 <= connection.bufferSize && connection._writableState.length <= N); @@ -37,7 +37,7 @@ server.listen(common.PORT, function() { console.log('pause'); const x = chars_recved; setTimeout(function() { - assert.equal(chars_recved, x); + assert.strictEqual(chars_recved, x); client.resume(); console.log('resume'); paused = false; @@ -53,6 +53,6 @@ server.listen(common.PORT, function() { process.on('exit', function() { - assert.equal(N, chars_recved); - assert.equal(true, npauses > 2); + assert.strictEqual(N, chars_recved); + assert.strictEqual(true, npauses > 2); }); diff --git a/test/pummel/test-net-timeout.js b/test/pummel/test-net-timeout.js index d6dd8e489cc116..faec443a007f20 100644 --- a/test/pummel/test-net-timeout.js +++ b/test/pummel/test-net-timeout.js @@ -45,7 +45,7 @@ echo_server.listen(common.PORT, function() { }); client.on('data', function(chunk) { - assert.equal('hello\r\n', chunk); + assert.strictEqual('hello\r\n', chunk); if (exchanges++ < 5) { setTimeout(function() { console.log('client write "hello"'); diff --git a/test/pummel/test-net-write-callbacks.js b/test/pummel/test-net-write-callbacks.js index 6c3c1f202a81c3..b29ae6ef808292 100644 --- a/test/pummel/test-net-write-callbacks.js +++ b/test/pummel/test-net-write-callbacks.js @@ -45,5 +45,5 @@ server.listen(common.PORT, function() { }); process.on('exit', function() { - assert.equal(N, cbcount); + assert.strictEqual(N, cbcount); }); diff --git a/test/pummel/test-regress-GH-892.js b/test/pummel/test-regress-GH-892.js index 0619fd84de3b5e..3ec44dfa12bb5b 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -42,7 +42,7 @@ function makeRequest() { child.on('exit', function(code) { assert.ok(/DONE/.test(stderrBuffer)); - assert.equal(0, code); + assert.strictEqual(0, code); }); // The following two lines forward the stdio from the child @@ -78,7 +78,7 @@ const server = https.Server(serverOptions, function(req, res) { }); req.on('end', function() { - assert.equal(bytesExpected, uploadCount); + assert.strictEqual(bytesExpected, uploadCount); res.writeHead(200, {'content-type': 'text/plain'}); res.end('successful upload\n'); }); @@ -91,5 +91,5 @@ server.listen(common.PORT, function() { process.on('exit', function() { console.error('got %d bytes', uploadCount); - assert.equal(uploadCount, bytesExpected); + assert.strictEqual(uploadCount, bytesExpected); }); diff --git a/test/pummel/test-stream-pipe-multi.js b/test/pummel/test-stream-pipe-multi.js index e1e5e011020fe2..478b61c822d4e0 100644 --- a/test/pummel/test-stream-pipe-multi.js +++ b/test/pummel/test-stream-pipe-multi.js @@ -45,8 +45,8 @@ FakeStream.prototype.close = function() { // expect all streams to close properly. process.on('exit', function() { - assert.equal(cnt, wclosed, 'writable streams closed'); - assert.equal(cnt, rclosed, 'readable streams closed'); + assert.strictEqual(cnt, wclosed, 'writable streams closed'); + assert.strictEqual(cnt, rclosed, 'readable streams closed'); }); for (let i = 0; i < chunkSize; i++) { diff --git a/test/pummel/test-stream2-basic.js b/test/pummel/test-stream2-basic.js index 073c1d8e35ad36..0e2bf3e8e302ce 100644 --- a/test/pummel/test-stream2-basic.js +++ b/test/pummel/test-stream2-basic.js @@ -87,7 +87,7 @@ function run() { fn({ same: assert.deepStrictEqual, ok: assert, - equal: assert.equal, + equal: assert.strictEqual, end: function() { count--; run(); @@ -97,7 +97,7 @@ function run() { // ensure all tests have run process.on('exit', function() { - assert.equal(count, 0); + assert.strictEqual(count, 0); }); process.nextTick(run); @@ -314,7 +314,7 @@ test('back pressure respected', function(t) { const w1 = new R(); w1.write = function(chunk) { console.error('w1.emit("close")'); - assert.equal(chunk[0], 'one'); + assert.strictEqual(chunk[0], 'one'); w1.emit('close'); process.nextTick(function() { r.pipe(w2); @@ -330,8 +330,8 @@ test('back pressure respected', function(t) { const w2 = new R(); w2.write = function(chunk) { console.error('w2 write', chunk, counter); - assert.equal(chunk[0], expected.shift()); - assert.equal(counter, 0); + assert.strictEqual(chunk[0], expected.shift()); + assert.strictEqual(counter, 0); counter++; @@ -352,8 +352,8 @@ test('back pressure respected', function(t) { const w3 = new R(); w3.write = function(chunk) { console.error('w3 write', chunk, counter); - assert.equal(chunk[0], expected.shift()); - assert.equal(counter, 1); + assert.strictEqual(chunk[0], expected.shift()); + assert.strictEqual(counter, 1); counter++; @@ -370,8 +370,8 @@ test('back pressure respected', function(t) { return false; }; w3.end = function() { - assert.equal(counter, 2); - assert.equal(expected.length, 0); + assert.strictEqual(counter, 2); + assert.strictEqual(expected.length, 0); t.end(); }; }); @@ -387,19 +387,19 @@ test('read(0) for ended streams', function(t) { const v = r.read(0); - assert.equal(v, null); + assert.strictEqual(v, null); const w = new R(); w.write = function(buffer) { written = true; - assert.equal(ended, false); - assert.equal(buffer.toString(), 'foo'); + assert.strictEqual(ended, false); + assert.strictEqual(buffer.toString(), 'foo'); }; w.end = function() { ended = true; - assert.equal(written, true); + assert.strictEqual(written, true); t.end(); }; @@ -420,7 +420,7 @@ test('sync _read ending', function(t) { r.read(); process.nextTick(function() { - assert.equal(called, true); + assert.strictEqual(called, true); t.end(); }); }); diff --git a/test/pummel/test-timers.js b/test/pummel/test-timers.js index 4555582371b9ff..600b7ce35b0913 100644 --- a/test/pummel/test-timers.js +++ b/test/pummel/test-timers.js @@ -10,7 +10,7 @@ let interval_count = 0; clearTimeout(null); clearInterval(null); -assert.equal(true, setTimeout instanceof Function); +assert.strictEqual(true, setTimeout instanceof Function); const starttime = new Date(); setTimeout(common.mustCall(function() { const endtime = new Date(); @@ -19,11 +19,11 @@ setTimeout(common.mustCall(function() { assert.ok(diff > 0); console.error('diff: ' + diff); - assert.equal(true, 1000 - WINDOW < diff && diff < 1000 + WINDOW); + assert.strictEqual(true, 1000 - WINDOW < diff && diff < 1000 + WINDOW); }), 1000); // this timer shouldn't execute -const id = setTimeout(function() { assert.equal(true, false); }, 500); +const id = setTimeout(function() { assert.strictEqual(true, false); }, 500); clearTimeout(id); setInterval(function() { @@ -36,9 +36,9 @@ setInterval(function() { const t = interval_count * 1000; - assert.equal(true, t - WINDOW < diff && diff < t + WINDOW); + assert.strictEqual(true, t - WINDOW < diff && diff < t + WINDOW); - assert.equal(true, interval_count <= 3); + assert.strictEqual(true, interval_count <= 3); if (interval_count === 3) clearInterval(this); }, 1000); @@ -46,13 +46,13 @@ setInterval(function() { // Single param: setTimeout(function(param) { - assert.equal('test param', param); + assert.strictEqual('test param', param); }, 1000, 'test param'); let interval_count2 = 0; setInterval(function(param) { ++interval_count2; - assert.equal('test param', param); + assert.strictEqual('test param', param); if (interval_count2 === 3) clearInterval(this); @@ -61,15 +61,15 @@ setInterval(function(param) { // Multiple param setTimeout(function(param1, param2) { - assert.equal('param1', param1); - assert.equal('param2', param2); + assert.strictEqual('param1', param1); + assert.strictEqual('param2', param2); }, 1000, 'param1', 'param2'); let interval_count3 = 0; setInterval(function(param1, param2) { ++interval_count3; - assert.equal('param1', param1); - assert.equal('param2', param2); + assert.strictEqual('param1', param1); + assert.strictEqual('param2', param2); if (interval_count3 === 3) clearInterval(this); @@ -99,7 +99,8 @@ clearTimeout(y); process.on('exit', function() { - assert.equal(3, interval_count); - assert.equal(11, count4); - assert.equal(0, expectedTimeouts, 'clearTimeout cleared too many timeouts'); + assert.strictEqual(3, interval_count); + assert.strictEqual(11, count4); + assert.strictEqual(0, expectedTimeouts, + 'clearTimeout cleared too many timeouts'); }); diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js index dd2b43ed60278f..9c2d3da5c3f6b1 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -69,7 +69,7 @@ function test(next) { }); child.on('exit', function() { - assert.equal(renegs, tls.CLIENT_RENEG_LIMIT + 1); + assert.strictEqual(renegs, tls.CLIENT_RENEG_LIMIT + 1); server.close(); process.nextTick(next); }); @@ -81,7 +81,7 @@ function test(next) { case 'EPIPE': break; default: - assert.equal(err.code, 'ECONNRESET'); + assert.strictEqual(err.code, 'ECONNRESET'); break; } closed = true; diff --git a/test/pummel/test-tls-securepair-client.js b/test/pummel/test-tls-securepair-client.js index 75e7b400592191..cd9299cb790958 100644 --- a/test/pummel/test-tls-securepair-client.js +++ b/test/pummel/test-tls-securepair-client.js @@ -31,9 +31,10 @@ function test1() { function test2() { function check(pair) { // "TLS Web Client Authentication" - assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage.length, 1); - assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage[0], - '1.3.6.1.5.5.7.3.2'); + assert.strictEqual(pair.cleartext.getPeerCertificate().ext_key_usage.length, + 1); + assert.strictEqual(pair.cleartext.getPeerCertificate().ext_key_usage[0], + '1.3.6.1.5.5.7.3.2'); } test('keys/agent4-key.pem', 'keys/agent4-cert.pem', check); } @@ -158,8 +159,8 @@ function test(keyfn, certfn, check, next) { process.on('exit', function() { - assert.equal(0, serverExitCode); - assert.equal('WAIT-SERVER-CLOSE', state); + assert.strictEqual(0, serverExitCode); + assert.strictEqual('WAIT-SERVER-CLOSE', state); assert.ok(gotWriteCallback); }); } diff --git a/test/pummel/test-tls-server-large-request.js b/test/pummel/test-tls-server-large-request.js index f02eb51a2f6742..41393120fcd1e2 100644 --- a/test/pummel/test-tls-server-large-request.js +++ b/test/pummel/test-tls-server-large-request.js @@ -30,7 +30,7 @@ Mediator.prototype._write = function _write(data, enc, cb) { setTimeout(cb, 0); if (this.buf.length >= request.length) { - assert.equal(this.buf, request.toString()); + assert.strictEqual(this.buf, request.toString()); server.close(); } }; diff --git a/test/pummel/test-tls-throttle.js b/test/pummel/test-tls-throttle.js index 574a83b18f2846..e427e0bf89f877 100644 --- a/test/pummel/test-tls-throttle.js +++ b/test/pummel/test-tls-throttle.js @@ -63,5 +63,5 @@ const timeout = setTimeout(displayCounts, 10 * 1000); process.on('exit', function() { displayCounts(); - assert.equal(body.length, recvCount); + assert.strictEqual(body.length, recvCount); }); diff --git a/test/sequential/test-child-process-fork-getconnections.js b/test/sequential/test-child-process-fork-getconnections.js index 4d6b1a25ef16cc..355a45913c8699 100644 --- a/test/sequential/test-child-process-fork-getconnections.js +++ b/test/sequential/test-child-process-fork-getconnections.js @@ -20,7 +20,7 @@ if (process.argv[2] === 'child') { } if (m.cmd === 'close') { - assert.equal(socket, undefined); + assert.strictEqual(socket, undefined); if (sockets[m.id].destroyed) { // Workaround for https://github.com/nodejs/node/issues/2610 sendClosed(m.id); @@ -92,8 +92,8 @@ if (process.argv[2] === 'child') { server.listen(common.PORT, '127.0.0.1'); process.on('exit', function() { - assert.equal(sent, count); - assert.equal(disconnected, count); + assert.strictEqual(sent, count); + assert.strictEqual(disconnected, count); assert.ok(closeEmitted); console.log('ok'); }); diff --git a/test/sequential/test-deprecation-flags.js b/test/sequential/test-deprecation-flags.js index eb5c1a3ae6261f..3bd2e99033beb1 100644 --- a/test/sequential/test-deprecation-flags.js +++ b/test/sequential/test-deprecation-flags.js @@ -20,24 +20,24 @@ const traceDep = ['--trace-deprecation', depmod]; execFile(node, normal, function(er, stdout, stderr) { console.error('normal: show deprecation warning'); - assert.equal(er, null); - assert.equal(stdout, ''); + assert.strictEqual(er, null); + assert.strictEqual(stdout, ''); assert(/util\.debug is deprecated/.test(stderr)); console.log('normal ok'); }); execFile(node, noDep, function(er, stdout, stderr) { console.error('--no-deprecation: silence deprecations'); - assert.equal(er, null); - assert.equal(stdout, ''); - assert.equal(stderr, 'DEBUG: This is deprecated\n'); + assert.strictEqual(er, null); + assert.strictEqual(stdout, ''); + assert.strictEqual(stderr, 'DEBUG: This is deprecated\n'); console.log('silent ok'); }); execFile(node, traceDep, function(er, stdout, stderr) { console.error('--trace-deprecation: show stack'); - assert.equal(er, null); - assert.equal(stdout, ''); + assert.strictEqual(er, null); + assert.strictEqual(stdout, ''); const stack = stderr.trim().split('\n'); // just check the top and bottom. assert(/util.debug is deprecated. Use console.error instead./.test(stack[1])); @@ -47,8 +47,8 @@ execFile(node, traceDep, function(er, stdout, stderr) { execFile(node, [depUserlandFunction], function(er, stdout, stderr) { console.error('normal: testing deprecated userland function'); - assert.equal(er, null); - assert.equal(stdout, ''); + assert.strictEqual(er, null); + assert.strictEqual(stdout, ''); assert(/deprecatedFunction is deprecated/.test(stderr)); console.error('normal: ok'); }); diff --git a/test/sequential/test-http-regr-gh-2928.js b/test/sequential/test-http-regr-gh-2928.js index 190966083e3f97..55e3a93bc98eaa 100644 --- a/test/sequential/test-http-regr-gh-2928.js +++ b/test/sequential/test-http-regr-gh-2928.js @@ -59,5 +59,5 @@ const server = net.createServer(function(c) { }).listen(common.PORT, execAndClose); process.on('exit', function() { - assert.equal(gotResponses, COUNT); + assert.strictEqual(gotResponses, COUNT); }); diff --git a/test/sequential/test-process-warnings.js b/test/sequential/test-process-warnings.js index 1e8b2b13a20a78..d4894f8bffeb36 100644 --- a/test/sequential/test-process-warnings.js +++ b/test/sequential/test-process-warnings.js @@ -12,22 +12,22 @@ const traceWarn = ['--trace-warnings', warnmod]; execFile(node, normal, function(er, stdout, stderr) { // Show Process Warnings - assert.equal(er, null); - assert.equal(stdout, ''); + assert.strictEqual(er, null); + assert.strictEqual(stdout, ''); assert(/^\(.+\)\sWarning: a bad practice warning/.test(stderr)); }); execFile(node, noWarn, function(er, stdout, stderr) { // Hide Process Warnings - assert.equal(er, null); - assert.equal(stdout, ''); + assert.strictEqual(er, null); + assert.strictEqual(stdout, ''); assert(!/^\(.+\)\sWarning: a bad practice warning/.test(stderr)); }); execFile(node, traceWarn, function(er, stdout, stderr) { // Show Warning Trace - assert.equal(er, null); - assert.equal(stdout, ''); + assert.strictEqual(er, null); + assert.strictEqual(stdout, ''); assert(/^\(.+\)\sWarning: a bad practice warning/.test(stderr)); assert(/at Object\.\s\(.+warnings.js:3:9\)/.test(stderr)); }); diff --git a/test/sequential/test-regress-GH-4027.js b/test/sequential/test-regress-GH-4027.js index 87a8861ac35477..8d9c6bb1ad795a 100644 --- a/test/sequential/test-regress-GH-4027.js +++ b/test/sequential/test-regress-GH-4027.js @@ -11,7 +11,7 @@ fs.writeFileSync(filename, 'quis custodiet ipsos custodes'); setTimeout(fs.unlinkSync, 100, filename); fs.watchFile(filename, { interval: 50 }, common.mustCall(function(curr, prev) { - assert.equal(prev.nlink, 1); - assert.equal(curr.nlink, 0); + assert.strictEqual(prev.nlink, 1); + assert.strictEqual(curr.nlink, 0); fs.unwatchFile(filename); })); diff --git a/test/sequential/test-regress-GH-784.js b/test/sequential/test-regress-GH-784.js index c9b630b0c81755..0bfa407ec10dc3 100644 --- a/test/sequential/test-regress-GH-784.js +++ b/test/sequential/test-regress-GH-784.js @@ -21,7 +21,7 @@ const server = http.createServer(function(req, res) { }); req.on('end', function() { - assert.equal('PING', body); + assert.strictEqual('PING', body); res.writeHead(200); res.end('PONG'); }); @@ -96,7 +96,7 @@ function ping() { }); res.on('end', function() { - assert.equal('PONG', body); + assert.strictEqual('PONG', body); assert.ok(!hadError); gotEnd = true; afterPing('success'); @@ -128,5 +128,5 @@ process.on('exit', function() { console.error("process.on('exit')"); console.error(responses); - assert.equal(8, responses.length); + assert.strictEqual(8, responses.length); }); diff --git a/test/sequential/test-regress-GH-877.js b/test/sequential/test-regress-GH-877.js index 06c839aa483fa8..1a0d7a48e5758c 100644 --- a/test/sequential/test-regress-GH-877.js +++ b/test/sequential/test-regress-GH-877.js @@ -31,7 +31,7 @@ server.listen(common.PORT, '127.0.0.1', function() { res.resume(); }); - assert.equal(req.agent, agent); + assert.strictEqual(req.agent, agent); console.log('Socket: ' + agent.sockets[addrString].length + '/' + agent.maxSockets + ' queued: ' + (agent.requests[addrString] ? diff --git a/test/sequential/test-require-cache-without-stat.js b/test/sequential/test-require-cache-without-stat.js index b591f1746b62d4..d90bbd2b7bb71f 100644 --- a/test/sequential/test-require-cache-without-stat.js +++ b/test/sequential/test-require-cache-without-stat.js @@ -49,4 +49,4 @@ for (let i = 0; i < 100; i++) { console.log('counterAfter = %d', counter); const counterAfter = counter; -assert.equal(counterBefore, counterAfter); +assert.strictEqual(counterBefore, counterAfter); diff --git a/test/sequential/test-stream2-fs.js b/test/sequential/test-stream2-fs.js index 2891335c813562..58a66ef99df9cf 100644 --- a/test/sequential/test-stream2-fs.js +++ b/test/sequential/test-stream2-fs.js @@ -39,7 +39,7 @@ const w = new TestWriter(); w.on('results', function(res) { console.error(res, w.length); - assert.equal(w.length, size); + assert.strictEqual(w.length, size); assert.deepStrictEqual(res.map(function(c) { return c.length; }), expectLengths); diff --git a/test/sequential/test-stream2-stderr-sync.js b/test/sequential/test-stream2-stderr-sync.js index e37a5f2cd1b38e..08f35e597ce357 100644 --- a/test/sequential/test-stream2-stderr-sync.js +++ b/test/sequential/test-stream2-stderr-sync.js @@ -16,7 +16,7 @@ function parent() { }); child.on('close', function() { - assert.equal(err, 'child ' + c + '\nfoo\nbar\nbaz\n'); + assert.strictEqual(err, 'child ' + c + '\nfoo\nbar\nbaz\n'); console.log('ok %d child #%d', ++i, c); if (i === children.length) console.log('1..' + i);