From af47a1c342fa8689400c787483841bb725a6640b Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 21 Nov 2022 12:43:47 -0500 Subject: [PATCH] test: add trailing commas in async-hooks tests (#45549) PR-URL: https://github.com/nodejs/node/pull/45549 Reviewed-By: Daeyeon Jeong Reviewed-By: Rich Trott Reviewed-By: Moshe Atlow Reviewed-By: Darshan Sen Reviewed-By: Yagiz Nizipli --- test/.eslintrc.yaml | 1 - test/async-hooks/hook-checks.js | 2 +- test/async-hooks/init-hooks.js | 10 +++++----- test/async-hooks/test-async-await.js | 2 +- .../async-hooks/test-async-exec-resource-http-32060.js | 2 +- test/async-hooks/test-async-exec-resource-http.js | 2 +- test/async-hooks/test-async-exec-resource-match.js | 4 ++-- .../async-hooks/test-async-local-storage-http-agent.js | 2 +- .../test-async-local-storage-stop-propagation.js | 6 +++--- test/async-hooks/test-async-local-storage-thenable.js | 2 +- test/async-hooks/test-async-local-storage-tlssocket.js | 2 +- test/async-hooks/test-callback-error.js | 6 +++--- test/async-hooks/test-destroy-not-blocked.js | 10 +++++----- test/async-hooks/test-disable-in-init.js | 4 ++-- .../test-embedder.api.async-resource-no-type.js | 2 +- test/async-hooks/test-embedder.api.async-resource.js | 2 +- test/async-hooks/test-emit-after-on-destroyed.js | 2 +- test/async-hooks/test-emit-before-after.js | 2 +- test/async-hooks/test-emit-before-on-destroyed.js | 2 +- test/async-hooks/test-emit-init.js | 4 ++-- test/async-hooks/test-enable-in-init.js | 4 ++-- test/async-hooks/test-filehandle-no-reuse.js | 4 ++-- test/async-hooks/test-graph.fsreq-readFile.js | 2 +- test/async-hooks/test-graph.http.js | 4 ++-- test/async-hooks/test-graph.intervals.js | 2 +- test/async-hooks/test-graph.pipe.js | 2 +- test/async-hooks/test-graph.pipeconnect.js | 2 +- test/async-hooks/test-graph.shutdown.js | 2 +- test/async-hooks/test-graph.signal.js | 2 +- test/async-hooks/test-graph.statwatcher.js | 2 +- test/async-hooks/test-graph.tcp.js | 2 +- test/async-hooks/test-graph.timeouts.js | 2 +- test/async-hooks/test-graph.tls-write.js | 4 ++-- .../test-http-agent-handle-reuse-parallel.js | 6 +++--- .../async-hooks/test-http-agent-handle-reuse-serial.js | 8 ++++---- test/async-hooks/test-httpparser-reuse.js | 4 ++-- test/async-hooks/test-httpparser.request.js | 2 +- test/async-hooks/test-httpparser.response.js | 2 +- test/async-hooks/test-improper-order.js | 2 +- test/async-hooks/test-improper-unwind.js | 2 +- test/async-hooks/test-late-hook-enable.js | 2 +- test/async-hooks/test-nexttick-default-trigger.js | 2 +- test/async-hooks/test-pipewrap.js | 2 +- test/async-hooks/test-queue-microtask.js | 2 +- test/async-hooks/test-tlswrap.js | 2 +- test/async-hooks/test-ttywrap.readstream.js | 2 +- test/async-hooks/test-unhandled-rejection-context.js | 2 +- test/async-hooks/test-zlib.zlib-binding.deflate.js | 4 ++-- test/async-hooks/verify-graph.js | 10 +++++----- 49 files changed, 78 insertions(+), 79 deletions(-) diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 1589547b525736..b0a648738eb086 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -72,7 +72,6 @@ globals: overrides: - files: - - async-hooks/*.js - es-module/*.js - es-module/*.mjs - internet/*.js diff --git a/test/async-hooks/hook-checks.js b/test/async-hooks/hook-checks.js index e1328810f58982..6ad79bc68e8ac1 100644 --- a/test/async-hooks/hook-checks.js +++ b/test/async-hooks/hook-checks.js @@ -21,7 +21,7 @@ exports.checkInvocations = function checkInvocations(activity, hooks, stage) { assert.ok(activity != null, `${stageInfo} Trying to check invocation for an activity, ` + - 'but it was empty/undefined.' + 'but it was empty/undefined.', ); // Check that actual invocations for all hooks match the expected invocations diff --git a/test/async-hooks/init-hooks.js b/test/async-hooks/init-hooks.js index 5d697036602902..2c5167156b615d 100644 --- a/test/async-hooks/init-hooks.js +++ b/test/async-hooks/init-hooks.js @@ -27,7 +27,7 @@ class ActivityCollector { ondestroy, onpromiseResolve, logid = null, - logtype = null + logtype = null, } = {}) { this._start = start; this._allowNoInit = allowNoInit; @@ -49,7 +49,7 @@ class ActivityCollector { before: this._before.bind(this), after: this._after.bind(this), destroy: this._destroy.bind(this), - promiseResolve: this._promiseResolve.bind(this) + promiseResolve: this._promiseResolve.bind(this), }); } @@ -181,7 +181,7 @@ class ActivityCollector { // In some cases (e.g. Timeout) the handle is a function, thus the usual // `typeof handle === 'object' && handle !== null` check can't be used. handleIsObject: handle instanceof Object, - handle + handle, }; this._stamp(activity, 'init'); this._activities.set(uid, activity); @@ -233,7 +233,7 @@ exports = module.exports = function initHooks({ onpromiseResolve, allowNoInit, logid, - logtype + logtype, } = {}) { return new ActivityCollector(process.hrtime(), { oninit, @@ -243,6 +243,6 @@ exports = module.exports = function initHooks({ onpromiseResolve, allowNoInit, logid, - logtype + logtype, }); }; diff --git a/test/async-hooks/test-async-await.js b/test/async-hooks/test-async-await.js index 19a22d3076b8c0..4fd698c8e98197 100644 --- a/test/async-hooks/test-async-await.js +++ b/test/async-hooks/test-async-await.js @@ -22,7 +22,7 @@ const hooks = initHooks({ onbefore, onafter, ondestroy: null, // Intentionally not tested, since it will be removed soon - onpromiseResolve + onpromiseResolve, }); hooks.enable(); diff --git a/test/async-hooks/test-async-exec-resource-http-32060.js b/test/async-hooks/test-async-exec-resource-http-32060.js index 0ff68aa1070e19..1423179d4215bd 100644 --- a/test/async-hooks/test-async-exec-resource-http-32060.js +++ b/test/async-hooks/test-async-exec-resource-http-32060.js @@ -12,7 +12,7 @@ const hooked = {}; createHook({ init(asyncId, type, triggerAsyncId, resource) { hooked[asyncId] = resource; - } + }, }).enable(); const server = http.createServer((req, res) => { diff --git a/test/async-hooks/test-async-exec-resource-http.js b/test/async-hooks/test-async-exec-resource-http.js index ecc654bea0ab79..844720250d4195 100644 --- a/test/async-hooks/test-async-exec-resource-http.js +++ b/test/async-hooks/test-async-exec-resource-http.js @@ -13,7 +13,7 @@ const hooked = {}; createHook({ init(asyncId, type, triggerAsyncId, resource) { hooked[asyncId] = resource; - } + }, }).enable(); const server = http.createServer((req, res) => { diff --git a/test/async-hooks/test-async-exec-resource-match.js b/test/async-hooks/test-async-exec-resource-match.js index f5ea2c2b13965a..6174768ba76877 100644 --- a/test/async-hooks/test-async-exec-resource-match.js +++ b/test/async-hooks/test-async-exec-resource-match.js @@ -6,7 +6,7 @@ const { readFile } = require('fs'); const { createHook, executionAsyncResource, - AsyncResource + AsyncResource, } = require('async_hooks'); // Ignore any asyncIds created before our hook is active. @@ -32,7 +32,7 @@ createHook({ if (asyncId >= firstSeenAsyncId) { afterHook(asyncId); } - } + }, }).enable(); const beforeHook = common.mustCallAtLeast( diff --git a/test/async-hooks/test-async-local-storage-http-agent.js b/test/async-hooks/test-async-local-storage-http-agent.js index 1de535aa709687..54c8a585a5ba1c 100644 --- a/test/async-hooks/test-async-local-storage-http-agent.js +++ b/test/async-hooks/test-async-local-storage-http-agent.js @@ -7,7 +7,7 @@ const http = require('http'); const asyncLocalStorage = new AsyncLocalStorage(); const agent = new http.Agent({ - maxSockets: 1 + maxSockets: 1, }); const N = 3; diff --git a/test/async-hooks/test-async-local-storage-stop-propagation.js b/test/async-hooks/test-async-local-storage-stop-propagation.js index 3b63da71cb15b6..0480bd4be7f918 100644 --- a/test/async-hooks/test-async-local-storage-stop-propagation.js +++ b/test/async-hooks/test-async-local-storage-stop-propagation.js @@ -18,7 +18,7 @@ function onPropagate(type, store) { } const als = new AsyncLocalStorage({ - onPropagate: common.mustCall(onPropagate, 2) + onPropagate: common.mustCall(onPropagate, 2), }); const myStore = {}; @@ -40,11 +40,11 @@ als.run(myStore, common.mustCall(() => { assert.throws(() => new AsyncLocalStorage(15), { message: 'The "options" argument must be of type object. Received type number (15)', code: 'ERR_INVALID_ARG_TYPE', - name: 'TypeError' + name: 'TypeError', }); assert.throws(() => new AsyncLocalStorage({ onPropagate: 'bar' }), { message: 'The "options.onPropagate" property must be of type function. Received type string (\'bar\')', code: 'ERR_INVALID_ARG_TYPE', - name: 'TypeError' + name: 'TypeError', }); diff --git a/test/async-hooks/test-async-local-storage-thenable.js b/test/async-hooks/test-async-local-storage-thenable.js index 1f947fa9345491..3dc6841ac9838e 100644 --- a/test/async-hooks/test-async-local-storage-thenable.js +++ b/test/async-hooks/test-async-local-storage-thenable.js @@ -17,7 +17,7 @@ const then = common.mustCall((cb) => { function thenable() { return { - then + then, }; } diff --git a/test/async-hooks/test-async-local-storage-tlssocket.js b/test/async-hooks/test-async-local-storage-tlssocket.js index 34ea4c068253cb..09da3ac735ac20 100644 --- a/test/async-hooks/test-async-local-storage-tlssocket.js +++ b/test/async-hooks/test-async-local-storage-tlssocket.js @@ -14,7 +14,7 @@ const { AsyncLocalStorage } = require('async_hooks'); const options = { cert: fixtures.readKey('rsa_cert.crt'), key: fixtures.readKey('rsa_private.pem'), - rejectUnauthorized: false + rejectUnauthorized: false, }; tls diff --git a/test/async-hooks/test-callback-error.js b/test/async-hooks/test-callback-error.js index 5665464c2d3921..f6af8e0018d534 100644 --- a/test/async-hooks/test-callback-error.js +++ b/test/async-hooks/test-callback-error.js @@ -9,14 +9,14 @@ const arg = process.argv[2]; switch (arg) { case 'test_init_callback': initHooks({ - oninit: common.mustCall(() => { throw new Error(arg); }) + oninit: common.mustCall(() => { throw new Error(arg); }), }).enable(); new async_hooks.AsyncResource(`${arg}_type`); return; case 'test_callback': { initHooks({ - onbefore: common.mustCall(() => { throw new Error(arg); }) + onbefore: common.mustCall(() => { throw new Error(arg); }), }).enable(); const resource = new async_hooks.AsyncResource(`${arg}_type`); resource.runInAsyncScope(() => {}); @@ -25,7 +25,7 @@ switch (arg) { case 'test_callback_abort': initHooks({ - oninit: common.mustCall(() => { throw new Error(arg); }) + oninit: common.mustCall(() => { throw new Error(arg); }), }).enable(); new async_hooks.AsyncResource(`${arg}_type`); return; diff --git a/test/async-hooks/test-destroy-not-blocked.js b/test/async-hooks/test-destroy-not-blocked.js index aa467f30143806..b9a314072483f2 100644 --- a/test/async-hooks/test-destroy-not-blocked.js +++ b/test/async-hooks/test-destroy-not-blocked.js @@ -23,7 +23,7 @@ createHook({ if (activeId === id) { activeId = -1; } - } + }, }).enable(); function testNextTick() { @@ -33,7 +33,7 @@ function testNextTick() { res.emitDestroy(); // nextTick has higher prio than emit destroy process.nextTick(common.mustCall(() => - assert.strictEqual(activeId, res.asyncId())) + assert.strictEqual(activeId, res.asyncId())), ); } @@ -44,7 +44,7 @@ function testQueueMicrotask() { res.emitDestroy(); // queueMicrotask has higher prio than emit destroy queueMicrotask(common.mustCall(() => - assert.strictEqual(activeId, res.asyncId())) + assert.strictEqual(activeId, res.asyncId())), ); } @@ -54,7 +54,7 @@ function testImmediate() { assert.strictEqual(activeId, res.asyncId()); res.emitDestroy(); setImmediate(common.mustCall(() => - assert.strictEqual(activeId, -1)) + assert.strictEqual(activeId, -1)), ); } @@ -65,7 +65,7 @@ function testPromise() { res.emitDestroy(); // Promise has higher prio than emit destroy Promise.resolve().then(common.mustCall(() => - assert.strictEqual(activeId, res.asyncId())) + assert.strictEqual(activeId, res.asyncId())), ); } diff --git a/test/async-hooks/test-disable-in-init.js b/test/async-hooks/test-disable-in-init.js index 17537c62f30885..f810dfca3b9605 100644 --- a/test/async-hooks/test-disable-in-init.js +++ b/test/async-hooks/test-disable-in-init.js @@ -13,11 +13,11 @@ async_hooks.createHook({ nestedCall = true; fs.access(__filename, common.mustCall()); } - }, 2) + }, 2), }).enable(); const nestedHook = async_hooks.createHook({ - init: common.mustCall(2) + init: common.mustCall(2), }).enable(); fs.access(__filename, common.mustCall()); diff --git a/test/async-hooks/test-embedder.api.async-resource-no-type.js b/test/async-hooks/test-embedder.api.async-resource-no-type.js index 2600325e1ed6be..e21c5458df8614 100644 --- a/test/async-hooks/test-embedder.api.async-resource-no-type.js +++ b/test/async-hooks/test-embedder.api.async-resource-no-type.js @@ -20,7 +20,7 @@ if (process.argv[2] === 'child') { [null, undefined, 1, Date, {}, []].forEach((i) => { assert.throws(() => new Foo(i), { code: 'ERR_INVALID_ARG_TYPE', - name: 'TypeError' + name: 'TypeError', }); }); diff --git a/test/async-hooks/test-embedder.api.async-resource.js b/test/async-hooks/test-embedder.api.async-resource.js index c53590393af89f..d60c03fb87b2ea 100644 --- a/test/async-hooks/test-embedder.api.async-resource.js +++ b/test/async-hooks/test-embedder.api.async-resource.js @@ -26,7 +26,7 @@ assert.throws(() => { assert.strictEqual( new AsyncResource('default_trigger_id').triggerAsyncId(), - async_hooks.executionAsyncId() + async_hooks.executionAsyncId(), ); // Create first custom event 'alcazares' with triggerAsyncId derived diff --git a/test/async-hooks/test-emit-after-on-destroyed.js b/test/async-hooks/test-emit-after-on-destroyed.js index 37c54b1c9e0a20..1a10a1dfc74a74 100644 --- a/test/async-hooks/test-emit-after-on-destroyed.js +++ b/test/async-hooks/test-emit-after-on-destroyed.js @@ -10,7 +10,7 @@ const heartbeatMsg = /heartbeat: still alive/; const { newAsyncId, getDefaultTriggerAsyncId, - emitInit, emitBefore, emitAfter, emitDestroy + emitInit, emitBefore, emitAfter, emitDestroy, } = internal_async_hooks; const initHooks = require('./init-hooks'); diff --git a/test/async-hooks/test-emit-before-after.js b/test/async-hooks/test-emit-before-after.js index 2ad98b993efd5b..561004cac2f012 100644 --- a/test/async-hooks/test-emit-before-after.js +++ b/test/async-hooks/test-emit-before-after.js @@ -30,7 +30,7 @@ const checkOnce = (fn) => { initHooks({ onbefore: checkOnce(chkBefore), onafter: checkOnce(chkAfter), - allowNoInit: true + allowNoInit: true, }).enable(); async_hooks.emitInit(expectedId, expectedType, expectedTriggerId); diff --git a/test/async-hooks/test-emit-before-on-destroyed.js b/test/async-hooks/test-emit-before-on-destroyed.js index 7b56eeeb63d4d2..ca0553e53348be 100644 --- a/test/async-hooks/test-emit-before-on-destroyed.js +++ b/test/async-hooks/test-emit-before-on-destroyed.js @@ -10,7 +10,7 @@ const heartbeatMsg = /heartbeat: still alive/; const { newAsyncId, getDefaultTriggerAsyncId, - emitInit, emitBefore, emitAfter, emitDestroy + emitInit, emitBefore, emitAfter, emitDestroy, } = internal_async_hooks; const initHooks = require('./init-hooks'); diff --git a/test/async-hooks/test-emit-init.js b/test/async-hooks/test-emit-init.js index bc1cd49cba2824..8994943b472931 100644 --- a/test/async-hooks/test-emit-init.js +++ b/test/async-hooks/test-emit-init.js @@ -17,7 +17,7 @@ const hooks1 = initHooks({ assert.strictEqual(type, expectedType); assert.strictEqual(triggerAsyncId, expectedTriggerId); assert.strictEqual(resource.key, expectedResource.key); - }) + }), }); hooks1.enable(); @@ -33,7 +33,7 @@ initHooks({ assert.strictEqual(type, expectedType); assert.notStrictEqual(triggerAsyncId, expectedTriggerId); assert.strictEqual(resource.key, expectedResource.key); - }) + }), }).enable(); async_hooks.emitInit(expectedId, expectedType, null, expectedResource); diff --git a/test/async-hooks/test-enable-in-init.js b/test/async-hooks/test-enable-in-init.js index 7bc70994e1fa7d..e710657a340440 100644 --- a/test/async-hooks/test-enable-in-init.js +++ b/test/async-hooks/test-enable-in-init.js @@ -5,7 +5,7 @@ const async_hooks = require('async_hooks'); const fs = require('fs'); const nestedHook = async_hooks.createHook({ - init: common.mustNotCall() + init: common.mustNotCall(), }); let nestedCall = false; @@ -16,7 +16,7 @@ async_hooks.createHook({ nestedCall = true; fs.access(__filename, common.mustCall()); } - }, 2) + }, 2), }).enable(); fs.access(__filename, common.mustCall()); diff --git a/test/async-hooks/test-filehandle-no-reuse.js b/test/async-hooks/test-filehandle-no-reuse.js index 7cd3322c1906fd..34921471e48c77 100644 --- a/test/async-hooks/test-filehandle-no-reuse.js +++ b/test/async-hooks/test-filehandle-no-reuse.js @@ -17,7 +17,7 @@ const hooks = initHooks(); hooks.enable(); const { - HTTP2_HEADER_CONTENT_TYPE + HTTP2_HEADER_CONTENT_TYPE, } = http2.constants; // Use large fixture to get several file operations. @@ -27,7 +27,7 @@ const fd = fs.openSync(fname, 'r'); const server = http2.createServer(); server.on('stream', (stream) => { stream.respondWithFD(fd, { - [HTTP2_HEADER_CONTENT_TYPE]: 'text/plain' + [HTTP2_HEADER_CONTENT_TYPE]: 'text/plain', }); }); server.on('close', common.mustCall(() => fs.closeSync(fd))); diff --git a/test/async-hooks/test-graph.fsreq-readFile.js b/test/async-hooks/test-graph.fsreq-readFile.js index 0a310ed5774a67..543ce68aa73622 100644 --- a/test/async-hooks/test-graph.fsreq-readFile.js +++ b/test/async-hooks/test-graph.fsreq-readFile.js @@ -21,6 +21,6 @@ function onexit() { [ { type: 'FSREQCALLBACK', id: 'fsreq:1', triggerAsyncId: null }, { type: 'FSREQCALLBACK', id: 'fsreq:2', triggerAsyncId: 'fsreq:1' }, { type: 'FSREQCALLBACK', id: 'fsreq:3', triggerAsyncId: 'fsreq:2' }, - { type: 'FSREQCALLBACK', id: 'fsreq:4', triggerAsyncId: 'fsreq:3' } ] + { type: 'FSREQCALLBACK', id: 'fsreq:4', triggerAsyncId: 'fsreq:3' } ], ); } diff --git a/test/async-hooks/test-graph.http.js b/test/async-hooks/test-graph.http.js index 0a003427f9e133..9bfdd47f914e0a 100644 --- a/test/async-hooks/test-graph.http.js +++ b/test/async-hooks/test-graph.http.js @@ -19,7 +19,7 @@ server.listen(0, common.mustCall(() => { http.get({ host: '::1', family: 6, - port: server.address().port + port: server.address().port, }, common.mustCall()); })); @@ -47,6 +47,6 @@ process.on('exit', () => { triggerAsyncId: null }, { type: 'SHUTDOWNWRAP', id: 'shutdown:1', - triggerAsyncId: 'tcp:2' } ] + triggerAsyncId: 'tcp:2' } ], ); }); diff --git a/test/async-hooks/test-graph.intervals.js b/test/async-hooks/test-graph.intervals.js index 8aa46ab07b5471..9e626951a14bbf 100644 --- a/test/async-hooks/test-graph.intervals.js +++ b/test/async-hooks/test-graph.intervals.js @@ -30,6 +30,6 @@ function onexit() { verifyGraph( hooks, [ { type: 'Timeout', id: 'timeout:1', triggerAsyncId: null }, - { type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' }] + { type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' }], ); } diff --git a/test/async-hooks/test-graph.pipe.js b/test/async-hooks/test-graph.pipe.js index 162fb3639bfbfc..abf8a98ff00e62 100644 --- a/test/async-hooks/test-graph.pipe.js +++ b/test/async-hooks/test-graph.pipe.js @@ -27,6 +27,6 @@ function onexit() { [ { type: 'PROCESSWRAP', id: 'process:1', triggerAsyncId: null }, { type: 'PIPEWRAP', id: 'pipe:1', triggerAsyncId: null }, { type: 'PIPEWRAP', id: 'pipe:2', triggerAsyncId: null }, - { type: 'PIPEWRAP', id: 'pipe:3', triggerAsyncId: null } ] + { type: 'PIPEWRAP', id: 'pipe:3', triggerAsyncId: null } ], ); } diff --git a/test/async-hooks/test-graph.pipeconnect.js b/test/async-hooks/test-graph.pipeconnect.js index 440ea906a17c4d..db237ff6b2d0ab 100644 --- a/test/async-hooks/test-graph.pipeconnect.js +++ b/test/async-hooks/test-graph.pipeconnect.js @@ -34,6 +34,6 @@ function onexit() { { type: 'PIPECONNECTWRAP', id: 'pipeconnect:1', triggerAsyncId: 'pipe:1' }, { type: 'PIPEWRAP', id: 'pipe:2', triggerAsyncId: 'pipeserver:1' }, - { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'pipe:2' } ] + { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'pipe:2' } ], ); } diff --git a/test/async-hooks/test-graph.shutdown.js b/test/async-hooks/test-graph.shutdown.js index f4f077c0dd1c83..0f633787e5e59d 100644 --- a/test/async-hooks/test-graph.shutdown.js +++ b/test/async-hooks/test-graph.shutdown.js @@ -41,6 +41,6 @@ function onexit() { { type: 'TCPCONNECTWRAP', id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' }, { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' }, - { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ] + { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ], ); } diff --git a/test/async-hooks/test-graph.signal.js b/test/async-hooks/test-graph.signal.js index b0a45ddf67765a..f87b1215b523b9 100644 --- a/test/async-hooks/test-graph.signal.js +++ b/test/async-hooks/test-graph.signal.js @@ -61,6 +61,6 @@ function onexit() { { type: 'PROCESSWRAP', id: 'process:3', triggerAsyncId: 'signal:1' }, { type: 'PIPEWRAP', id: 'pipe:7', triggerAsyncId: 'signal:1' }, { type: 'PIPEWRAP', id: 'pipe:8', triggerAsyncId: 'signal:1' }, - { type: 'PIPEWRAP', id: 'pipe:9', triggerAsyncId: 'signal:1' } ] + { type: 'PIPEWRAP', id: 'pipe:9', triggerAsyncId: 'signal:1' } ], ); } diff --git a/test/async-hooks/test-graph.statwatcher.js b/test/async-hooks/test-graph.statwatcher.js index 96376926a67450..f960ffebd3eb70 100644 --- a/test/async-hooks/test-graph.statwatcher.js +++ b/test/async-hooks/test-graph.statwatcher.js @@ -29,6 +29,6 @@ function onexit() { verifyGraph( hooks, [ { type: 'STATWATCHER', id: 'statwatcher:1', triggerAsyncId: null }, - { type: 'STATWATCHER', id: 'statwatcher:2', triggerAsyncId: null } ] + { type: 'STATWATCHER', id: 'statwatcher:2', triggerAsyncId: null } ], ); } diff --git a/test/async-hooks/test-graph.tcp.js b/test/async-hooks/test-graph.tcp.js index c2253486ee651e..6f8db20add682c 100644 --- a/test/async-hooks/test-graph.tcp.js +++ b/test/async-hooks/test-graph.tcp.js @@ -43,6 +43,6 @@ function onexit() { { type: 'TCPCONNECTWRAP', id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' }, { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' }, - { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ] + { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ], ); } diff --git a/test/async-hooks/test-graph.timeouts.js b/test/async-hooks/test-graph.timeouts.js index 2ec1420f0c03b1..88350db2bae8ee 100644 --- a/test/async-hooks/test-graph.timeouts.js +++ b/test/async-hooks/test-graph.timeouts.js @@ -27,6 +27,6 @@ function onexit() { hooks, [ { type: 'Timeout', id: 'timeout:1', triggerAsyncId: null }, { type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' }, - { type: 'Timeout', id: 'timeout:3', triggerAsyncId: 'timeout:2' }] + { type: 'Timeout', id: 'timeout:3', triggerAsyncId: 'timeout:2' }], ); } diff --git a/test/async-hooks/test-graph.tls-write.js b/test/async-hooks/test-graph.tls-write.js index b493ac819dfbcd..243039e01d116f 100644 --- a/test/async-hooks/test-graph.tls-write.js +++ b/test/async-hooks/test-graph.tls-write.js @@ -21,7 +21,7 @@ hooks.enable(); const server = tls .createServer({ cert: fixtures.readKey('rsa_cert.crt'), - key: fixtures.readKey('rsa_private.pem') + key: fixtures.readKey('rsa_private.pem'), }) .on('listening', common.mustCall(onlistening)) .on('secureConnection', common.mustCall(onsecureConnection)) @@ -66,6 +66,6 @@ function onexit() { id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' }, { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' }, { type: 'TLSWRAP', id: 'tls:2', triggerAsyncId: 'tcpserver:1' }, - ] + ], ); } diff --git a/test/async-hooks/test-http-agent-handle-reuse-parallel.js b/test/async-hooks/test-http-agent-handle-reuse-parallel.js index 844ba1e9f9bf78..f60369a8b55321 100644 --- a/test/async-hooks/test-http-agent-handle-reuse-parallel.js +++ b/test/async-hooks/test-http-agent-handle-reuse-parallel.js @@ -21,7 +21,7 @@ let responses = 0; const agent = new http.Agent({ keepAlive: true, keepAliveMsecs: Infinity, - maxSockets: 1 + maxSockets: 1, }); const verifyRequest = (idx) => (res) => { @@ -58,13 +58,13 @@ const server = http.createServer(common.mustCall((req, res) => { // First request. const r1 = http.request({ - agent, port, method: 'POST' + agent, port, method: 'POST', }, common.mustCall(verifyRequest(0))); r1.end(payload); // Second request. Sent in parallel with the first one. const r2 = http.request({ - agent, port, method: 'POST' + agent, port, method: 'POST', }, common.mustCall(verifyRequest(1))); r2.end(payload); })); diff --git a/test/async-hooks/test-http-agent-handle-reuse-serial.js b/test/async-hooks/test-http-agent-handle-reuse-serial.js index fbd1d43378555e..bae0698a0a6b5b 100644 --- a/test/async-hooks/test-http-agent-handle-reuse-serial.js +++ b/test/async-hooks/test-http-agent-handle-reuse-serial.js @@ -20,7 +20,7 @@ let asyncIdAtSecondReq; const agent = new http.Agent({ keepAlive: true, keepAliveMsecs: Infinity, - maxSockets: 1 + maxSockets: 1, }); const server = http.createServer(common.mustCall((req, res) => { @@ -38,7 +38,7 @@ const server = http.createServer(common.mustCall((req, res) => { // First request. This is useless except for adding a socket to the // agent’s pool for reuse. const r1 = http.request({ - agent, port, method: 'POST' + agent, port, method: 'POST', }, common.mustCall((res) => { // Remember which socket we used. const socket = res.socket; @@ -60,8 +60,8 @@ const server = http.createServer(common.mustCall((req, res) => { // response header has already been received. const r2 = http.request({ agent, port, method: 'POST', headers: { - 'Content-Length': payload.length - } + 'Content-Length': payload.length, + }, }, common.mustCall((res) => { asyncIdAtSecondReq = res.socket[async_id_symbol]; assert.ok(asyncIdAtSecondReq > 0, `${asyncIdAtSecondReq} > 0`); diff --git a/test/async-hooks/test-httpparser-reuse.js b/test/async-hooks/test-httpparser-reuse.js index 70248970df364c..f7ce2cd876220e 100644 --- a/test/async-hooks/test-httpparser-reuse.js +++ b/test/async-hooks/test-httpparser-reuse.js @@ -29,7 +29,7 @@ createHook({ if (resource[reused]) { reusedParser.push( - `resource reused: ${asyncId}, ${triggerAsyncId}, ${type}` + `resource reused: ${asyncId}, ${triggerAsyncId}, ${type}`, ); } resource[reused] = true; @@ -40,7 +40,7 @@ createHook({ } else { destroyed.push(asyncId); } - } + }, }).enable(); const server = http.createServer((req, res) => { diff --git a/test/async-hooks/test-httpparser.request.js b/test/async-hooks/test-httpparser.request.js index cd61aa25e3f6e7..40c01bc8177d6e 100644 --- a/test/async-hooks/test-httpparser.request.js +++ b/test/async-hooks/test-httpparser.request.js @@ -16,7 +16,7 @@ const REQUEST = HTTPParser.REQUEST; const kOnHeadersComplete = HTTPParser.kOnHeadersComplete | 0; const request = Buffer.from( - 'GET /hello HTTP/1.1\r\n\r\n' + 'GET /hello HTTP/1.1\r\n\r\n', ); const parser = new HTTPParser(); diff --git a/test/async-hooks/test-httpparser.response.js b/test/async-hooks/test-httpparser.response.js index d6625661eb7407..64f0893c5a9aa8 100644 --- a/test/async-hooks/test-httpparser.response.js +++ b/test/async-hooks/test-httpparser.response.js @@ -21,7 +21,7 @@ const request = Buffer.from( 'Content-Type: text/plain\r\n' + 'Content-Length: 4\r\n' + '\r\n' + - 'pong' + 'pong', ); const parser = new HTTPParser(); diff --git a/test/async-hooks/test-improper-order.js b/test/async-hooks/test-improper-order.js index 800c7422b42e31..5452e2c6e05030 100644 --- a/test/async-hooks/test-improper-order.js +++ b/test/async-hooks/test-improper-order.js @@ -10,7 +10,7 @@ const heartbeatMsg = /heartbeat: still alive/; const { newAsyncId, getDefaultTriggerAsyncId, - emitInit, emitBefore, emitAfter + emitInit, emitBefore, emitAfter, } = internal_async_hooks; const initHooks = require('./init-hooks'); diff --git a/test/async-hooks/test-improper-unwind.js b/test/async-hooks/test-improper-unwind.js index f2fbef2dbcc469..ea0eee025d7fd3 100644 --- a/test/async-hooks/test-improper-unwind.js +++ b/test/async-hooks/test-improper-unwind.js @@ -10,7 +10,7 @@ const heartbeatMsg = /heartbeat: still alive/; const { newAsyncId, getDefaultTriggerAsyncId, - emitInit, emitBefore, emitAfter + emitInit, emitBefore, emitAfter, } = internal_async_hooks; const initHooks = require('./init-hooks'); diff --git a/test/async-hooks/test-late-hook-enable.js b/test/async-hooks/test-late-hook-enable.js index 7ee1323adbdbcc..8512ed993d507f 100644 --- a/test/async-hooks/test-late-hook-enable.js +++ b/test/async-hooks/test-late-hook-enable.js @@ -37,7 +37,7 @@ const hook = async_hooks.createHook({ destroy: common.mustCall(() => { hook.disable(); nextTest(); - }, 3) + }, 3), }); nextTest(); diff --git a/test/async-hooks/test-nexttick-default-trigger.js b/test/async-hooks/test-nexttick-default-trigger.js index 7d6d98c9abc902..fa1ad2c561ce6f 100644 --- a/test/async-hooks/test-nexttick-default-trigger.js +++ b/test/async-hooks/test-nexttick-default-trigger.js @@ -23,6 +23,6 @@ process.on('exit', () => { const as = hooks.activitiesOfTypes('TickObject'); checkInvocations(as[0], { - init: 1, before: 1, after: 1, destroy: 1 + init: 1, before: 1, after: 1, destroy: 1, }, 'when process exits'); }); diff --git a/test/async-hooks/test-pipewrap.js b/test/async-hooks/test-pipewrap.js index 0a4d082856df22..2d42e769cfd1f3 100644 --- a/test/async-hooks/test-pipewrap.js +++ b/test/async-hooks/test-pipewrap.js @@ -55,7 +55,7 @@ function onsleepClose() { checkInvocations( processwrap, { init: 1, before: 1, after: 1 }, - 'processwrap while in onsleepClose callback') + 'processwrap while in onsleepClose callback'), ); } diff --git a/test/async-hooks/test-queue-microtask.js b/test/async-hooks/test-queue-microtask.js index 1e2029efe4ad0e..01200d45423929 100644 --- a/test/async-hooks/test-queue-microtask.js +++ b/test/async-hooks/test-queue-microtask.js @@ -20,6 +20,6 @@ process.on('exit', () => { const as = hooks.activitiesOfTypes('Microtask'); checkInvocations(as[0], { - init: 1, before: 1, after: 1, destroy: 1 + init: 1, before: 1, after: 1, destroy: 1, }, 'when process exits'); }); diff --git a/test/async-hooks/test-tlswrap.js b/test/async-hooks/test-tlswrap.js index 65a4087d1659c6..6a8996e00f2b71 100644 --- a/test/async-hooks/test-tlswrap.js +++ b/test/async-hooks/test-tlswrap.js @@ -25,7 +25,7 @@ tls.DEFAULT_MAX_VERSION = 'TLSv1.2'; const server = tls .createServer({ cert: fixtures.readKey('rsa_cert.crt'), - key: fixtures.readKey('rsa_private.pem') + key: fixtures.readKey('rsa_private.pem'), }) .on('listening', common.mustCall(onlistening)) .on('secureConnection', common.mustCall(onsecureConnection)) diff --git a/test/async-hooks/test-ttywrap.readstream.js b/test/async-hooks/test-ttywrap.readstream.js index e6fb3cdc28a4fe..7e27ffc5bfb2a2 100644 --- a/test/async-hooks/test-ttywrap.readstream.js +++ b/test/async-hooks/test-ttywrap.readstream.js @@ -35,7 +35,7 @@ const delayedOnCloseHandler = common.mustCall(() => { }); process.stdin.on('error', (err) => assert.fail(err)); process.stdin.on('close', common.mustCall(() => - tick(2, delayedOnCloseHandler) + tick(2, delayedOnCloseHandler), )); process.stdin.destroy(); checkInvocations(tty, checkInitOpts, 'when tty.end() was invoked'); diff --git a/test/async-hooks/test-unhandled-rejection-context.js b/test/async-hooks/test-unhandled-rejection-context.js index b70d97f99fd441..8404cf71f0db6f 100644 --- a/test/async-hooks/test-unhandled-rejection-context.js +++ b/test/async-hooks/test-unhandled-rejection-context.js @@ -15,7 +15,7 @@ const hooks = initHooks({ if (type === 'PROMISE') { promiseAsyncIds.push(asyncId); } - } + }, }); hooks.enable(); diff --git a/test/async-hooks/test-zlib.zlib-binding.deflate.js b/test/async-hooks/test-zlib.zlib-binding.deflate.js index 16d9b3f3ebd7d5..802f09eb306cf9 100644 --- a/test/async-hooks/test-zlib.zlib-binding.deflate.js +++ b/test/async-hooks/test-zlib.zlib-binding.deflate.js @@ -29,7 +29,7 @@ const buffers = { writeResult: new Uint32Array(2), dictionary: new Uint8Array(0), inBuf: new Uint8Array([0x78]), - outBuf: new Uint8Array(1) + outBuf: new Uint8Array(1), }; handle.init( @@ -39,7 +39,7 @@ handle.init( constants.Z_DEFAULT_STRATEGY, buffers.writeResult, function processCallback() { this.cb(); }, - buffers.dictionary + buffers.dictionary, ); checkInvocations(hdl, { init: 1 }, 'when initialized handle'); diff --git a/test/async-hooks/verify-graph.js b/test/async-hooks/verify-graph.js index 638edd03a4ab24..61d1849f21ef48 100644 --- a/test/async-hooks/verify-graph.js +++ b/test/async-hooks/verify-graph.js @@ -20,7 +20,7 @@ function pruneTickObjects(activities) { const tickObject = { found: true, index: null, - data: null + data: null, }; if (!Array.isArray(activities)) @@ -42,7 +42,7 @@ function pruneTickObjects(activities) { tickObject.data = activities[tickObject.index]; const triggerId = { new: tickObject.data.triggerAsyncId, - old: tickObject.data.uid + old: tickObject.data.uid, }; activities.forEach(function repointTriggerId(x) { @@ -85,7 +85,7 @@ module.exports = function verifyGraph(hooks, graph) { errors.push({ id: node.id, expectedTid: node.triggerAsyncId, - actualTid: uidtoid[x.triggerAsyncId] + actualTid: uidtoid[x.triggerAsyncId], }); } @@ -93,8 +93,8 @@ module.exports = function verifyGraph(hooks, graph) { errors.forEach((x) => console.error( `'${x.id}' expected to be triggered by '${x.expectedTid}', ` + - `but was triggered by '${x.actualTid}' instead.` - ) + `but was triggered by '${x.actualTid}' instead.`, + ), ); } assert.strictEqual(errors.length, 0);