From 936ac681b2f5cf58cd2f1069ccc1720c7981e00e Mon Sep 17 00:00:00 2001 From: "ivan.filenko" Date: Mon, 15 Oct 2018 20:04:29 +0300 Subject: [PATCH 1/2] test: use assert.strictEqual instead of assert.equal PR-URL: https://github.com/nodejs/node/pull/23673 Reviewed-By: Ruben Bridgewater Reviewed-By: Refael Ackermann --- test/pseudo-tty/test-tty-get-color-depth.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pseudo-tty/test-tty-get-color-depth.js b/test/pseudo-tty/test-tty-get-color-depth.js index d802add1189db2..e735f4c286aeb3 100644 --- a/test/pseudo-tty/test-tty-get-color-depth.js +++ b/test/pseudo-tty/test-tty-get-color-depth.js @@ -10,7 +10,7 @@ const writeStream = new WriteStream(fd); { const depth = writeStream.getColorDepth(); - assert.equal(typeof depth, 'number'); + assert.strictEqual(typeof depth, 'number'); assert(depth >= 1 && depth <= 24); } @@ -44,7 +44,7 @@ const writeStream = new WriteStream(fd); [{ TERM: 'dumb', COLORTERM: '1' }, 4], ].forEach(([env, depth], i) => { const actual = writeStream.getColorDepth(env); - assert.equal( + assert.strictEqual( actual, depth, `i: ${i}, expected: ${depth}, actual: ${actual}, env: ${env}` @@ -57,8 +57,8 @@ const writeStream = new WriteStream(fd); const [ value, depth1, depth2 ] = process.platform !== 'win32' ? ['win32', 1, 4] : ['linux', 4, 1]; - assert.equal(writeStream.getColorDepth({}), depth1); + assert.strictEqual(writeStream.getColorDepth({}), depth1); Object.defineProperty(process, 'platform', { value }); - assert.equal(writeStream.getColorDepth({}), depth2); + assert.strictEqual(writeStream.getColorDepth({}), depth2); Object.defineProperty(process, 'platform', platform); } From 53d424a3289d7dcd5b7671ac112810b3a51a3df1 Mon Sep 17 00:00:00 2001 From: "ivan.filenko" Date: Mon, 15 Oct 2018 20:32:30 +0300 Subject: [PATCH 2/2] test: fix uses of deprecated assert.fail with multiple args PR-URL: https://github.com/nodejs/node/pull/23673 Reviewed-By: Ruben Bridgewater Reviewed-By: Refael Ackermann --- test/async-hooks/init-hooks.js | 3 +-- test/parallel/test-net-connect-options-fd.js | 4 ++-- test/parallel/test-string-decoder.js | 2 +- test/pseudo-tty/test-tty-get-color-depth.js | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/async-hooks/init-hooks.js b/test/async-hooks/init-hooks.js index 14969d8e753b68..817b2db0c781b4 100644 --- a/test/async-hooks/init-hooks.js +++ b/test/async-hooks/init-hooks.js @@ -120,8 +120,7 @@ class ActivityCollector { } if (violations.length) { console.error(violations.join('\n\n') + '\n'); - assert.fail(violations.length, 0, - `${violations.length} failed sanity checks`); + assert.fail(`${violations.length} failed sanity checks`); } } diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index 468e230ec7370a..94b831bf5d2ac3 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -70,7 +70,7 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); }) .on('error', function(err) { console.error(err); - assert.fail(null, null, `[Pipe server]${err}`); + assert.fail(`[Pipe server]${err}`); }) .listen({ path: serverPath }, common.mustCall(function serverOnListen() { const getSocketOpt = (index) => { @@ -94,7 +94,7 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); console.error(`[Pipe]Sending data through fd ${oldHandle.fd}`); this.on('error', function(err) { console.error(err); - assert.fail(null, null, `[Pipe Client]${err}`); + assert.fail(`[Pipe Client]${err}`); }); }); diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js index 04e1d8c8fe2849..c043795fc6ee5e 100644 --- a/test/parallel/test-string-decoder.js +++ b/test/parallel/test-string-decoder.js @@ -228,7 +228,7 @@ function test(encoding, input, expected, singleSequence) { `input: ${input.toString('hex').match(hexNumberRE)}\n` + `Write sequence: ${JSON.stringify(sequence)}\n` + `Full Decoder State: ${inspect(decoder)}`; - assert.fail(output, expected, message); + assert.fail(message); } }); } diff --git a/test/pseudo-tty/test-tty-get-color-depth.js b/test/pseudo-tty/test-tty-get-color-depth.js index e735f4c286aeb3..d4062f5fdb6d39 100644 --- a/test/pseudo-tty/test-tty-get-color-depth.js +++ b/test/pseudo-tty/test-tty-get-color-depth.js @@ -2,7 +2,6 @@ const common = require('../common'); const assert = require('assert').strict; -/* eslint-disable no-restricted-properties */ const { WriteStream } = require('tty'); const fd = common.getTTYfd();