From 10837e33b0ec2730139f579f0af5ad1286f61cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Thu, 27 Nov 2025 10:50:12 +0100 Subject: [PATCH 1/2] lib,test: fix jsdoc comments To prepare for eslint-plugin-jsdoc update. Refs: https://github.com/nodejs/node/pull/60535 PR-URL: https://github.com/nodejs/node/pull/60870 Reviewed-By: Antoine du Hamel Reviewed-By: Chengzhong Wu Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- lib/fs.js | 4 ++-- lib/internal/quic/quic.js | 6 +++--- lib/internal/webstreams/adapters.js | 3 +-- test/common/heap.js | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 773445d4a2c689..cde3a582727f80 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1115,7 +1115,7 @@ function lazyLoadRimraf() { /** * Asynchronously removes a directory. * @param {string | Buffer | URL} path - * @param {{}} [options] + * @param {object} [options] * @param {(err?: Error) => any} callback * @returns {void} */ @@ -1149,7 +1149,7 @@ function rmdir(path, options, callback) { /** * Synchronously removes a directory. * @param {string | Buffer | URL} path - * @param {{}} [options] + * @param {object} [options] * @returns {void} */ function rmdirSync(path, options) { diff --git a/lib/internal/quic/quic.js b/lib/internal/quic/quic.js index 6ad476eed5216f..459906d270dab6 100644 --- a/lib/internal/quic/quic.js +++ b/lib/internal/quic/quic.js @@ -1004,7 +1004,7 @@ class QuicSession { #onstream = undefined; /** @type {OnDatagramCallback|undefined} */ #ondatagram = undefined; - /** @type {{}} */ + /** @type {object|undefined} */ #sessionticket = undefined; static { @@ -1050,7 +1050,7 @@ class QuicSession { /** * Get the session ticket associated with this session, if any. - * @type {any} + * @type {object|undefined} */ get sessionticket() { QuicSession.#assertIsQuicSession(this); @@ -1846,7 +1846,7 @@ class QuicEndpoint { /** * Initiates a session with a remote endpoint. - * @param {{}} address + * @param {object} address * @param {SessionOptions} [options] * @returns {QuicSession} */ diff --git a/lib/internal/webstreams/adapters.js b/lib/internal/webstreams/adapters.js index df374736d25231..7650831da837f7 100644 --- a/lib/internal/webstreams/adapters.js +++ b/lib/internal/webstreams/adapters.js @@ -893,8 +893,7 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options = /** * @typedef {import('./queuingstrategies').QueuingStrategy} QueuingStrategy - * @typedef {{}} StreamBase - * @param {StreamBase} streamBase + * @param {object} streamBase * @param {QueuingStrategy} strategy * @returns {WritableStream} */ diff --git a/test/common/heap.js b/test/common/heap.js index e7969b7c0345e6..df7e2447b87c93 100644 --- a/test/common/heap.js +++ b/test/common/heap.js @@ -327,7 +327,7 @@ function getHeapSnapshotOptionTests() { } /** - * Similar to @see {validateByRetainingPathFromNodes} but creates the snapshot from scratch. + * Similar to {@link validateByRetainingPathFromNodes} but creates the snapshot from scratch. * @returns {object[]} */ function validateByRetainingPath(...args) { From 209a4fe8123848ffcf876ec5914c6114a3e0ded1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Sun, 30 Nov 2025 18:39:38 +0000 Subject: [PATCH 2/2] test: lint more `assert(regexp.test(...))` cases PR-URL: https://github.com/nodejs/node/pull/60878 Refs: https://github.com/nodejs/node/pull/60832 Reviewed-By: Luigi Pinca Reviewed-By: Antoine du Hamel Reviewed-By: Colin Ihrig --- test/eslint.config_partial.mjs | 4 ++-- ...est-promises-warning-on-unhandled-rejection.js | 15 +++------------ test/parallel/test-snapshot-eval.js | 4 ++-- test/parallel/test-tls-no-sslv3.js | 2 +- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/test/eslint.config_partial.mjs b/test/eslint.config_partial.mjs index 6ecb2405547889..e1c728e3b9b362 100644 --- a/test/eslint.config_partial.mjs +++ b/test/eslint.config_partial.mjs @@ -110,11 +110,11 @@ export default [ message: 'Calling `.catch(common.mustNotCall())` will not detect never-settling promises. Use `.then(common.mustCall())` instead.', }, { - selector: 'CallExpression[callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"][arguments.0.type="CallExpression"][arguments.0.callee.type="MemberExpression"][arguments.0.callee.object.regex][arguments.0.callee.property.type="Identifier"][arguments.0.callee.property.name="test"]', + selector: 'CallExpression:matches([callee.type="Identifier"][callee.name="assert"], [callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"])[arguments.0.type="CallExpression"][arguments.0.callee.type="MemberExpression"][arguments.0.callee.object.regex][arguments.0.callee.property.type="Identifier"][arguments.0.callee.property.name="test"]', message: 'Use assert.match instead', }, { - selector: 'CallExpression[callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"][arguments.0.type="UnaryExpression"][arguments.0.operator="!"][arguments.0.argument.type="CallExpression"][arguments.0.argument.callee.type="MemberExpression"][arguments.0.argument.callee.object.regex][arguments.0.argument.callee.property.name="test"]', + selector: 'CallExpression:matches([callee.type="Identifier"][callee.name="assert"], [callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"])[arguments.0.type="UnaryExpression"][arguments.0.operator="!"][arguments.0.argument.type="CallExpression"][arguments.0.argument.callee.type="MemberExpression"][arguments.0.argument.callee.object.regex][arguments.0.argument.callee.property.name="test"]', message: 'Use assert.doesNotMatch instead', }, ], diff --git a/test/parallel/test-promises-warning-on-unhandled-rejection.js b/test/parallel/test-promises-warning-on-unhandled-rejection.js index 0d6a74854217c8..71aeb9bd5c2d50 100644 --- a/test/parallel/test-promises-warning-on-unhandled-rejection.js +++ b/test/parallel/test-promises-warning-on-unhandled-rejection.js @@ -18,11 +18,7 @@ process.on('warning', common.mustCall((warning) => { case 1: // Warning about rejection not being handled (will be next tick) assert.strictEqual(warning.name, 'UnhandledPromiseRejectionWarning'); - assert( - /Unhandled promise rejection/.test(warning.message), - 'Expected warning message to contain "Unhandled promise rejection" ' + - `but did not. Had "${warning.message}" instead.` - ); + assert.match(warning.message, /Unhandled promise rejection/); break; case 2: // Number rejection error displayed. Note it's been stringified @@ -31,17 +27,12 @@ process.on('warning', common.mustCall((warning) => { case 3: // Unhandled rejection warning (won't be handled next tick) assert.strictEqual(warning.name, 'UnhandledPromiseRejectionWarning'); - assert( - /Unhandled promise rejection/.test(warning.message), - 'Expected warning message to contain "Unhandled promise rejection" ' + - `but did not. Had "${warning.message}" instead.` - ); + assert.match(warning.message, /Unhandled promise rejection/); break; case 4: // Rejection handled asynchronously. assert.strictEqual(warning.name, 'PromiseRejectionHandledWarning'); - assert(/Promise rejection was handled asynchronously/ - .test(warning.message)); + assert.match(warning.message, /Promise rejection was handled asynchronously/); } }, 5)); diff --git a/test/parallel/test-snapshot-eval.js b/test/parallel/test-snapshot-eval.js index 6a1b6b4e0197eb..61249cd071cb66 100644 --- a/test/parallel/test-snapshot-eval.js +++ b/test/parallel/test-snapshot-eval.js @@ -49,7 +49,7 @@ const file = fixtures.path('snapshot', 'mutate-fs.js'); console.log(child.stdout.toString()); assert.strictEqual(child.status, 0); } - assert(/I am from the snapshot/.test(child.stdout.toString())); + assert.match(child.stdout.toString(), /I am from the snapshot/); } { @@ -68,5 +68,5 @@ const file = fixtures.path('snapshot', 'mutate-fs.js'); console.log(child.stdout.toString()); assert.strictEqual(child.status, 0); } - assert(/I am from the snapshot/.test(child.stdout.toString())); + assert.match(child.stdout.toString(), /I am from the snapshot/); } diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js index bccc875b22b376..c4a6e1ff7f20bb 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -46,6 +46,6 @@ process.on('exit', function() { common.printSkipMessage('`openssl s_client -ssl3` not supported.'); } else { assert.strictEqual(errors.length, 1); - assert(/:version too low/.test(errors[0].message)); + assert.match(errors[0].message, /:version too low/); } });