diff --git a/test/es-module/test-import-module-retry-require-errored.js b/test/es-module/test-import-module-retry-require-errored.js index 79afa20aa70cb5..96203722f6c604 100644 --- a/test/es-module/test-import-module-retry-require-errored.js +++ b/test/es-module/test-import-module-retry-require-errored.js @@ -14,4 +14,4 @@ const assert = require('assert'); }, { message: 'test', }); -})().catch(common.mustNotCall()); +})().then(common.mustCall()); diff --git a/test/es-module/test-require-module-retry-import-errored-2.js b/test/es-module/test-require-module-retry-import-errored-2.js index 3504d9932c61af..34e743a7c6bc78 100644 --- a/test/es-module/test-require-module-retry-import-errored-2.js +++ b/test/es-module/test-require-module-retry-import-errored-2.js @@ -13,4 +13,4 @@ assert.throws(() => { assert.rejects(import('../fixtures/es-modules/throw-error.mjs'), { message: 'test', -}).catch(common.mustNotCall()); +}).then(common.mustCall()); diff --git a/test/es-module/test-require-module-tla-retry-import-2.js b/test/es-module/test-require-module-tla-retry-import-2.js index aa9c344dd398d7..2ca8e07449c2fa 100644 --- a/test/es-module/test-require-module-tla-retry-import-2.js +++ b/test/es-module/test-require-module-tla-retry-import-2.js @@ -23,4 +23,4 @@ async function test() { } // Run the test twice to check consistency after caching. -test().then(common.mustCall(test)).catch(common.mustNotCall()); +test().then(common.mustCall(test)); diff --git a/test/es-module/test-require-module-tla-retry-import.js b/test/es-module/test-require-module-tla-retry-import.js index 70f918fa4f463f..80b289fdfc8c43 100644 --- a/test/es-module/test-require-module-tla-retry-import.js +++ b/test/es-module/test-require-module-tla-retry-import.js @@ -22,4 +22,4 @@ async function test() { } // Run the test twice to check consistency after caching. -test().then(common.mustCall(test)).catch(common.mustNotCall()); +test().then(common.mustCall(test)); diff --git a/test/es-module/test-vm-main-context-default-loader-eval.js b/test/es-module/test-vm-main-context-default-loader-eval.js index 3226c3512f4887..7bde86ba551b6c 100644 --- a/test/es-module/test-vm-main-context-default-loader-eval.js +++ b/test/es-module/test-vm-main-context-default-loader-eval.js @@ -70,4 +70,4 @@ async function main() { } } -main().catch(common.mustNotCall()); +main().then(common.mustCall()); diff --git a/test/es-module/test-vm-main-context-default-loader.js b/test/es-module/test-vm-main-context-default-loader.js index 9e45bbd9a12a4e..d2ac6021df3837 100644 --- a/test/es-module/test-vm-main-context-default-loader.js +++ b/test/es-module/test-vm-main-context-default-loader.js @@ -116,4 +116,4 @@ async function main() { } } -main().catch(common.mustNotCall()); +main().then(common.mustCall()); diff --git a/test/eslint.config_partial.mjs b/test/eslint.config_partial.mjs index 418b2d0c3c8fdc..889d2f5cddd978 100644 --- a/test/eslint.config_partial.mjs +++ b/test/eslint.config_partial.mjs @@ -92,6 +92,10 @@ export default [ selector: "ExpressionStatement>CallExpression:matches([callee.name='rejects'], [callee.object.name='assert'][callee.property.name='rejects'])", message: 'Calling `assert.rejects` without `await` or `.then(common.mustCall())` will not detect never-settling promises.', }, + { + selector: 'CallExpression[callee.property.name="catch"]>:first-child:matches(CallExpression[callee.object.name="common"][callee.property.name="mustNotCall"], CallExpression[callee.name="mustNotCall"])', + message: 'Calling `.catch(common.mustNotCall())` will not detect never-settling promises. Use `.then(common.mustCall())` instead.', + }, ], // Stylistic rules. diff --git a/test/module-hooks/test-module-hooks-load-esm-mock.js b/test/module-hooks/test-module-hooks-load-esm-mock.js index 88941b5d685f07..26bb01385014f7 100644 --- a/test/module-hooks/test-module-hooks-load-esm-mock.js +++ b/test/module-hooks/test-module-hooks-load-esm-mock.js @@ -48,4 +48,4 @@ function hook(code, filename) { assert.deepStrictEqual({ ...bar }, { $key: 'bar-esm' }); } -})().catch(common.mustNotCall()); +})().then(common.mustCall()); diff --git a/test/module-hooks/test-module-hooks-load-esm.js b/test/module-hooks/test-module-hooks-load-esm.js index 88941b5d685f07..26bb01385014f7 100644 --- a/test/module-hooks/test-module-hooks-load-esm.js +++ b/test/module-hooks/test-module-hooks-load-esm.js @@ -48,4 +48,4 @@ function hook(code, filename) { assert.deepStrictEqual({ ...bar }, { $key: 'bar-esm' }); } -})().catch(common.mustNotCall()); +})().then(common.mustCall()); diff --git a/test/parallel/test-crypto-async-sign-verify.js b/test/parallel/test-crypto-async-sign-verify.js index 64ffc65b133b3c..d385926e994305 100644 --- a/test/parallel/test-crypto-async-sign-verify.js +++ b/test/parallel/test-crypto-async-sign-verify.js @@ -138,9 +138,9 @@ test('dsa_public.pem', 'dsa_private.pem', 'sha256', false, verify('sha256', data, publicKey, signature), verify('sha256', data, publicKey, signature), verify('sha256', data, publicKey, signature), - ]).then(common.mustCall()); + ]); }) - .catch(common.mustNotCall()); + .then(common.mustCall()); } { diff --git a/test/parallel/test-fs-open.js b/test/parallel/test-fs-open.js index 56157b0183de63..2d9243955e662d 100644 --- a/test/parallel/test-fs-open.js +++ b/test/parallel/test-fs-open.js @@ -53,7 +53,7 @@ async function promise() { await (await fs.promises.open(__filename, 'r')).close(); } -promise().then(common.mustCall()).catch(common.mustNotCall()); +promise().then(common.mustCall()); assert.throws( () => fs.open(__filename, 'r', 'boom', common.mustNotCall()), diff --git a/test/parallel/test-stream-readable-async-iterators.js b/test/parallel/test-stream-readable-async-iterators.js index 28975de405133f..beece038772a34 100644 --- a/test/parallel/test-stream-readable-async-iterators.js +++ b/test/parallel/test-stream-readable-async-iterators.js @@ -690,7 +690,7 @@ async function tests() { const it = r[Symbol.asyncIterator](); const p = it.return(); r.emit('close'); - p.then(common.mustCall()).catch(common.mustNotCall()); + p.then(common.mustCall()); } { diff --git a/test/parallel/test-vm-context-dont-contextify.js b/test/parallel/test-vm-context-dont-contextify.js index d75fc1438d364a..ae9fb676067999 100644 --- a/test/parallel/test-vm-context-dont-contextify.js +++ b/test/parallel/test-vm-context-dont-contextify.js @@ -182,4 +182,4 @@ function checkFrozen(context) { const promise = script.runInContext(context); assert.strictEqual(await promise, namespace); } -})().catch(common.mustNotCall()); +})().then(common.mustCall());