diff --git a/test/message/error_exit.js b/test/message/error_exit.js index e33e5d6929f501..057a371df24851 100644 --- a/test/message/error_exit.js +++ b/test/message/error_exit.js @@ -24,7 +24,7 @@ require('../common'); const assert = require('assert'); process.on('exit', function(code) { - console.error('Exiting with code=%d', code); + console.error(`Exiting with code=${code}`); }); assert.strictEqual(1, 2); diff --git a/test/message/max_tick_depth.js b/test/message/max_tick_depth.js index 89dcf398f65d4c..15462157d2160d 100644 --- a/test/message/max_tick_depth.js +++ b/test/message/max_tick_depth.js @@ -25,7 +25,7 @@ require('../common'); process.maxTickDepth = 10; let i = 20; process.nextTick(function f() { - console.error('tick %d', i); + console.error(`tick ${i}`); if (i-- > 0) process.nextTick(f); }); diff --git a/test/parallel/test-cluster-net-send.js b/test/parallel/test-cluster-net-send.js index bf0ee4e4f47f37..14ce58474f128e 100644 --- a/test/parallel/test-cluster-net-send.js +++ b/test/parallel/test-cluster-net-send.js @@ -26,7 +26,7 @@ const fork = require('child_process').fork; const net = require('net'); if (process.argv[2] !== 'child') { - console.error('[%d] master', process.pid); + console.error(`[${process.pid}] master`); const worker = fork(__filename, ['child']); let called = false; @@ -50,7 +50,7 @@ if (process.argv[2] !== 'child') { assert.ok(called); }); } else { - console.error('[%d] worker', process.pid); + console.error(`[${process.pid}] worker`); let socket; let cbcalls = 0; diff --git a/test/parallel/test-domain-http-server.js b/test/parallel/test-domain-http-server.js index 43b8d5d3809e17..47e87b34be5bb3 100644 --- a/test/parallel/test-domain-http-server.js +++ b/test/parallel/test-domain-http-server.js @@ -62,7 +62,7 @@ server.listen(0, next); function next() { const port = this.address().port; - console.log('listening on localhost:%d', port); + console.log(`listening on localhost:${port}`); let requests = 0; let responses = 0; @@ -87,7 +87,7 @@ function next() { dom.add(req); req.on('response', function(res) { responses++; - console.error('requests=%d responses=%d', requests, responses); + console.error(`requests=${requests} responses=${responses}`); if (responses === requests) { console.error('done, closing server'); // no more coming. diff --git a/test/parallel/test-file-write-stream2.js b/test/parallel/test-file-write-stream2.js index 757d9d91b31041..1f838f0869260a 100644 --- a/test/parallel/test-file-write-stream2.js +++ b/test/parallel/test-file-write-stream2.js @@ -41,8 +41,8 @@ process.on('exit', function() { removeTestFile(); if (cb_occurred !== cb_expected) { console.log(' Test callback events missing or out of order:'); - console.log(' expected: %j', cb_expected); - console.log(' occurred: %j', cb_occurred); + console.log(` expected: ${cb_expected}`); + console.log(` occurred: ${cb_occurred}`); assert.strictEqual( cb_occurred, cb_expected, `events missing or out of order: "${cb_occurred}" !== "${cb_expected}"`); @@ -78,7 +78,7 @@ file.on('drain', function() { if (countDrains === 1) { console.error('drain=1, write again'); assert.strictEqual(fs.readFileSync(filepath, 'utf8'), EXPECTED); - console.error('ondrain write ret=%j', file.write(EXPECTED)); + console.error(`ondrain write ret= ${file.write(EXPECTED)}`); cb_occurred += 'write '; } else if (countDrains === 2) { console.error('second drain, end'); @@ -102,7 +102,7 @@ file.on('error', function(err) { for (let i = 0; i < 11; i++) { const ret = file.write(String(i)); - console.error('%d %j', i, ret); + console.error(`${i} ${ret}`); // return false when i hits 10 assert.strictEqual(ret, i !== 10); diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js index 4bf7b88ff1667f..d62e9d5d3c9730 100644 --- a/test/parallel/test-file-write-stream3.js +++ b/test/parallel/test-file-write-stream3.js @@ -42,8 +42,8 @@ const fileDataExpected_3 = 'abcdefghij\u2026\u2026qrstuvwxyz'; process.on('exit', function() { if (cb_occurred !== cb_expected) { console.log(' Test callback events missing or out of order:'); - console.log(' expected: %j', cb_expected); - console.log(' occurred: %j', cb_occurred); + console.log(` expected: ${cb_expected}`); + console.log(` occurred: ${cb_occurred}`); assert.strictEqual( cb_occurred, cb_expected, `events missing or out of order: "${cb_occurred}" !== "${cb_expected}"`); diff --git a/test/parallel/test-fs-read-stream-fd-leak.js b/test/parallel/test-fs-read-stream-fd-leak.js index 28ec7b91b4c35b..5bf0157ff4e7ae 100644 --- a/test/parallel/test-fs-read-stream-fd-leak.js +++ b/test/parallel/test-fs-read-stream-fd-leak.js @@ -24,7 +24,7 @@ fs.close = function() { }; function testLeak(endFn, callback) { - console.log('testing for leaks from fs.createReadStream().%s()...', endFn); + console.log(`testing for leaks from fs.createReadStream().${endFn}()...`); let i = 0; let check = 0; diff --git a/test/parallel/test-fs-write-string-coerce.js b/test/parallel/test-fs-write-string-coerce.js index 1af93ff269219e..9356bc71850303 100644 --- a/test/parallel/test-fs-write-string-coerce.js +++ b/test/parallel/test-fs-write-string-coerce.js @@ -19,8 +19,8 @@ fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) { assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); const found = fs.readFileSync(fn, 'utf8'); - console.log('expected: "%s"', expected); - console.log('found: "%s"', found); + console.log(`expected: "${expected}"`); + console.log(`found: "${found}"`); fs.unlinkSync(fn); assert.strictEqual(expected, found); })); diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js index 641de122d57abd..2779c21394ae44 100644 --- a/test/parallel/test-http-client-timeout-agent.js +++ b/test/parallel/test-http-client-timeout-agent.js @@ -90,7 +90,7 @@ server.listen(0, options.host, function() { }); process.on('exit', function() { - console.error('done=%j sent=%j', requests_done, requests_sent); + console.error(`done=${requests_done} sent=${requests_sent}`); assert.strictEqual(requests_done, requests_sent, 'timeout on http request called too much'); }); diff --git a/test/parallel/test-http-outgoing-finish.js b/test/parallel/test-http-outgoing-finish.js index a242a4728e24eb..c805a89cc165f2 100644 --- a/test/parallel/test-http-outgoing-finish.js +++ b/test/parallel/test-http-outgoing-finish.js @@ -58,19 +58,19 @@ function write(out) { // that 'finish' isn't emitted until the stream is fully flushed. out.on('finish', function() { finishEvent = true; - console.error('%s finish event', name); + console.error(`${name} finish event`); process.nextTick(function() { assert(endCb, `${name} got finish event before endcb!`); - console.log('ok - %s finishEvent', name); + console.log(`ok - ${name} finishEvent`); }); }); out.end(buf, function() { endCb = true; - console.error('%s endCb', name); + console.error(`${name} endCb`); process.nextTick(function() { assert(finishEvent, `${name} got endCb event before finishEvent!`); - console.log('ok - %s endCb', name); + console.log(`ok - ${name} endCb`); }); }); } diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index 4f74a5b22d6eb8..da8abd868300e3 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -85,7 +85,7 @@ function test(cb) { conn.end('hello from parent\n'); }).listen(0, function() { const port = this.address().port; - console.error('server listening on %d', port); + console.error(`server listening on ${port}`); const spawn = require('child_process').spawn; const master = spawn(process.execPath, [__filename, 'master'], { diff --git a/test/parallel/test-net-server-max-connections.js b/test/parallel/test-net-server-max-connections.js index cfe4fa999dc8ff..c73efb3c1ef406 100644 --- a/test/parallel/test-net-server-max-connections.js +++ b/test/parallel/test-net-server-max-connections.js @@ -55,7 +55,7 @@ function makeConnection(index) { } c.on('close', function() { - console.error('closed %d', index); + console.error(`closed ${index}`); closes++; if (closes < N / 2) { @@ -97,7 +97,7 @@ function makeConnection(index) { if (common.isSunOS && (e.code === 'ECONNREFUSED')) { c.connect(server.address().port); } - console.error('error %d: %s', index, e); + console.error(`error ${index}: ${e}`); }); } diff --git a/test/parallel/test-process-exit-code.js b/test/parallel/test-process-exit-code.js index 55120f66926374..f5f8099c8d2439 100644 --- a/test/parallel/test-process-exit-code.js +++ b/test/parallel/test-process-exit-code.js @@ -93,7 +93,7 @@ function parent() { assert.strictEqual( code, exit, `wrong exit for ${arg}\nexpected:${exit} but got:${code}`); - console.log('ok - %s exited with %d', arg, exit); + console.log(`ok - ${arg} exited with ${exit}`); }); }; diff --git a/test/parallel/test-punycode.js b/test/parallel/test-punycode.js index 334fceadbe9983..9f7f772e17b0fe 100644 --- a/test/parallel/test-punycode.js +++ b/test/parallel/test-punycode.js @@ -200,10 +200,7 @@ const tests = [ let errors = 0; const handleError = (error, name) => { console.error( - 'FAIL: %s expected %j, got %j', - name, - error.expected, - error.actual + `FAIL: ${name} expected ${error.expected}, got ${error.actual}` ); errors++; }; diff --git a/test/parallel/test-repl-syntax-error-handling.js b/test/parallel/test-repl-syntax-error-handling.js index 67bf5f6038bf63..f61ab077eb638c 100644 --- a/test/parallel/test-repl-syntax-error-handling.js +++ b/test/parallel/test-repl-syntax-error-handling.js @@ -38,7 +38,7 @@ function parent() { child.stderr.setEncoding('utf8'); child.stderr.on('data', function(c) { - console.error('%j', c); + console.error(`${c}`); throw new Error('should not get stderr data'); }); diff --git a/test/parallel/test-stream-unshift-read-race.js b/test/parallel/test-stream-unshift-read-race.js index cfa90c7f2bff1c..f2977b285f4db3 100644 --- a/test/parallel/test-stream-unshift-read-race.js +++ b/test/parallel/test-stream-unshift-read-race.js @@ -111,9 +111,9 @@ w.on('finish', common.mustCall(function() { // lacking that piece. assert.strictEqual(written[0], 'asdfasdfas'); let asdf = 'd'; - console.error('0: %s', written[0]); + console.error(`0: ${written[0]}`); for (let i = 1; i < written.length; i++) { - console.error('%s: %s', i.toString(32), written[i]); + console.error(`${i.toString(32)}: ${written[i]}`); assert.strictEqual(written[i].slice(0, 4), '1234'); for (let j = 4; j < written[i].length; j++) { const c = written[i].charAt(j); diff --git a/test/parallel/test-stream-writev.js b/test/parallel/test-stream-writev.js index 654b46254d8ee7..a0d344440ee7bb 100644 --- a/test/parallel/test-stream-writev.js +++ b/test/parallel/test-stream-writev.js @@ -45,7 +45,7 @@ function run() { } function test(decode, uncork, multi, next) { - console.log('# decode=%j uncork=%j multi=%j', decode, uncork, multi); + console.log(`# decode=${decode} uncork=${uncork} multi=${multi}`); let counter = 0; let expectCount = 0; function cnt(msg) { diff --git a/test/parallel/test-stream2-large-read-stall.js b/test/parallel/test-stream2-large-read-stall.js index 92c35e35413240..2d44bb7f783b9d 100644 --- a/test/parallel/test-stream2-large-read-stall.js +++ b/test/parallel/test-stream2-large-read-stall.js @@ -43,9 +43,9 @@ r.on('readable', function() { console.error('>> readable'); let ret; do { - console.error(' > read(%d)', READSIZE); + console.error(` > read(${READSIZE})`); ret = r.read(READSIZE); - console.error(' < %j (%d remain)', ret && ret.length, rs.length); + console.error(` < ${ret && ret.length} (${rs.length} remain)`); } while (ret && ret.length === READSIZE); console.error('<< after read()', @@ -68,7 +68,7 @@ function push() { return r.push(null); } - console.error(' push #%d', pushes); + console.error(` push #${pushes}`); if (r.push(Buffer.allocUnsafe(PUSHSIZE))) setTimeout(push, 1); } diff --git a/test/parallel/test-stream2-push.js b/test/parallel/test-stream2-push.js index cc4dce4a871344..33645df8a5541c 100644 --- a/test/parallel/test-stream2-push.js +++ b/test/parallel/test-stream2-push.js @@ -89,7 +89,7 @@ const expectWritten = 'asdfgasdfgasdfgasdfg' ]; writer._write = function(chunk, encoding, cb) { - console.error('WRITE %s', chunk); + console.error(`WRITE ${chunk}`); written.push(chunk); process.nextTick(cb); }; diff --git a/test/parallel/test-stream2-readable-non-empty-end.js b/test/parallel/test-stream2-readable-non-empty-end.js index 4299f31ea12986..3c0b5eb4085e2e 100644 --- a/test/parallel/test-stream2-readable-non-empty-end.js +++ b/test/parallel/test-stream2-readable-non-empty-end.js @@ -51,7 +51,7 @@ test.on('readable', function() { const res = test.read(b); if (res) { bytesread += res.length; - console.error('br=%d len=%d', bytesread, len); + console.error(`br=${bytesread} len=${len}`); setTimeout(next, 1); } test.read(0); diff --git a/test/parallel/test-stream3-pause-then-read.js b/test/parallel/test-stream3-pause-then-read.js index f7bfadaf9d124c..4e1b71d74df10b 100644 --- a/test/parallel/test-stream3-pause-then-read.js +++ b/test/parallel/test-stream3-pause-then-read.js @@ -60,7 +60,7 @@ function read100() { } function readn(n, then) { - console.error('read %d', n); + console.error(`read ${n}`); expectEndingData -= n; (function read() { const c = r.read(n); diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js index 0f28bdcd0f454f..83b9142dea9266 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.js @@ -142,6 +142,6 @@ runTest(0); process.on('exit', function() { - console.log('successful tests: %d', successfulTests); + console.log(`successful tests: ${successfulTests}`); assert.strictEqual(successfulTests, testCases.length); }); diff --git a/test/parallel/test-tls-pause.js b/test/parallel/test-tls-pause.js index 1572bd2288d421..75c2832f7332f8 100644 --- a/test/parallel/test-tls-pause.js +++ b/test/parallel/test-tls-pause.js @@ -57,7 +57,7 @@ server.listen(0, function() { function send() { console.error('sending'); const ret = client.write(Buffer.allocUnsafe(bufSize)); - console.error('write => %j', ret); + console.error(`write => ${ret}`); if (false !== ret) { console.error('write again'); sent += bufSize; diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index 69378aab94e4b3..ffd47d444f5575 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -259,7 +259,7 @@ function runTest(port, testIndex) { const tcase = testCases[testIndex]; if (!tcase) return; - console.error(`${prefix}Running '%s'`, tcase.title); + console.error(`${prefix}Running '${tcase.title}'`); const cas = tcase.CAs.map(loadPEM); diff --git a/test/pummel/test-exec.js b/test/pummel/test-exec.js index e6e88f53e1f623..92b5cb64ec67e3 100644 --- a/test/pummel/test-exec.js +++ b/test/pummel/test-exec.js @@ -79,7 +79,7 @@ exec('thisisnotavalidcommand', function(err, stdout, stderr) { const sleeperStart = new Date(); exec(SLEEP3_COMMAND, { timeout: 50 }, function(err, stdout, stderr) { const diff = (new Date()) - sleeperStart; - console.log('\'sleep 3\' with timeout 50 took %d ms', diff); + console.log(`'sleep 3' with timeout 50 took ${diff} ms`); assert.ok(diff < 500); assert.ok(err); assert.ok(err.killed); @@ -94,7 +94,7 @@ const killMeTwice = exec(SLEEP3_COMMAND, { timeout: 1000 }, killMeTwiceCallback); process.nextTick(function() { - console.log('kill pid %d', killMeTwice.pid); + console.log(`kill pid ${killMeTwice.pid}`); // make sure there is no race condition in starting the process // the PID SHOULD exist directly following the exec() call. assert.strictEqual('number', typeof killMeTwice._handle.pid); @@ -113,7 +113,7 @@ function killMeTwiceCallback(err, stdout, stderr) { assert.strictEqual(stderr, ''); // the timeout should still be in effect - console.log('\'sleep 3\' was already killed. Took %d ms', diff); + console.log(`'sleep 3' was already killed. Took ${diff} ms`); assert.ok(diff < 1500); } diff --git a/test/pummel/test-net-write-callbacks.js b/test/pummel/test-net-write-callbacks.js index 10aff090583cea..a4a6096d633165 100644 --- a/test/pummel/test-net-write-callbacks.js +++ b/test/pummel/test-net-write-callbacks.js @@ -29,7 +29,7 @@ const N = 500000; const server = net.Server(function(socket) { socket.on('data', function(d) { - console.error('got %d bytes', d.length); + console.error(`got ${d.length} bytes`); }); socket.on('end', function() { diff --git a/test/pummel/test-regress-GH-892.js b/test/pummel/test-regress-GH-892.js index 05e27628b14388..4021a53736421b 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -102,11 +102,11 @@ const server = https.Server(serverOptions, function(req, res) { }); server.listen(common.PORT, function() { - console.log('expecting %d bytes', bytesExpected); + console.log(`expecting ${bytesExpected} bytes`); makeRequest(); }); process.on('exit', function() { - console.error('got %d bytes', uploadCount); + console.error(`got ${uploadCount} bytes`); assert.strictEqual(uploadCount, bytesExpected); }); diff --git a/test/pummel/test-tls-throttle.js b/test/pummel/test-tls-throttle.js index 3e18c4cff43a75..af588dfa91fb94 100644 --- a/test/pummel/test-tls-throttle.js +++ b/test/pummel/test-tls-throttle.js @@ -72,8 +72,8 @@ server.listen(common.PORT, function() { function displayCounts() { - console.log('body.length: %d', body.length); - console.log(' recvCount: %d', recvCount); + console.log(`body.length: ${body.length}`); + console.log(` recvCount: ${recvCount}`); } diff --git a/test/pummel/test-vm-memleak.js b/test/pummel/test-vm-memleak.js index 601781fec2a5d6..cb96512d384556 100644 --- a/test/pummel/test-vm-memleak.js +++ b/test/pummel/test-vm-memleak.js @@ -57,6 +57,6 @@ function testContextLeak() { } process.on('exit', function() { - console.error('max mem: %dmb', Math.round(maxMem / (1024 * 1024))); + console.error(`max mem: ${Math.round(maxMem / (1024 * 1024))}mb`); assert.ok(maxMem < 64 * 1024 * 1024); }); diff --git a/test/sequential/test-require-cache-without-stat.js b/test/sequential/test-require-cache-without-stat.js index 41d2980dcd8021..3064bf3f3dda12 100644 --- a/test/sequential/test-require-cache-without-stat.js +++ b/test/sequential/test-require-cache-without-stat.js @@ -52,7 +52,7 @@ require('../fixtures/a.js'); require('./../fixtures/a.js'); require('http'); -console.log('counterBefore = %d', counter); +console.log(`counterBefore = ${counter}`); const counterBefore = counter; // Now load the module a bunch of times with equivalent paths. @@ -68,7 +68,7 @@ for (let i = 0; i < 100; i++) { require('http'); } -console.log('counterAfter = %d', counter); +console.log(`counterAfter = ${counter}`); const counterAfter = counter; assert.strictEqual(counterBefore, counterAfter); diff --git a/test/sequential/test-stream2-stderr-sync.js b/test/sequential/test-stream2-stderr-sync.js index 6eff05513fbec7..40995394ac5530 100644 --- a/test/sequential/test-stream2-stderr-sync.js +++ b/test/sequential/test-stream2-stderr-sync.js @@ -38,7 +38,7 @@ function parent() { child.on('close', function() { assert.strictEqual(err, `child ${c}\nfoo\nbar\nbaz\n`); - console.log('ok %d child #%d', ++i, c); + console.log(`ok ${++i} child #${c}`); if (i === children.length) console.log(`1..${i}`); });