| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,4 +14,4 @@ const assert = require('assert'); | |||
| 14 | 14 | }, { | |
| 15 | 15 | message: 'test', | |
| 16 | 16 | }); | |
| 17 | - })().catch(common.mustNotCall()); | ||
| 17 | + })().then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,4 +13,4 @@ assert.throws(() => { | |||
| 13 | 13 | ||
| 14 | 14 | assert.rejects(import('../fixtures/es-modules/throw-error.mjs'), { | |
| 15 | 15 | message: 'test', | |
| 16 | - }).catch(common.mustNotCall()); | ||
| 16 | + }).then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,4 +23,4 @@ async function test() { | |||
| 23 | 23 | } | |
| 24 | 24 | ||
| 25 | 25 | // Run the test twice to check consistency after caching. | |
| 26 | - test().then(common.mustCall(test)).catch(common.mustNotCall()); | ||
| 26 | + test().then(common.mustCall(test)); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,4 +22,4 @@ async function test() { | |||
| 22 | 22 | } | |
| 23 | 23 | ||
| 24 | 24 | // Run the test twice to check consistency after caching. | |
| 25 | - test().then(common.mustCall(test)).catch(common.mustNotCall()); | ||
| 25 | + test().then(common.mustCall(test)); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,4 +70,4 @@ async function main() { | |||
| 70 | 70 | } | |
| 71 | 71 | } | |
| 72 | 72 | ||
| 73 | - main().catch(common.mustNotCall()); | ||
| 73 | + main().then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,4 +116,4 @@ async function main() { | |||
| 116 | 116 | } | |
| 117 | 117 | } | |
| 118 | 118 | ||
| 119 | - main().catch(common.mustNotCall()); | ||
| 119 | + main().then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -92,6 +92,10 @@ export default [ | |||
| 92 | 92 | selector: "ExpressionStatement>CallExpression:matches([callee.name='rejects'], [callee.object.name='assert'][callee.property.name='rejects'])", | |
| 93 | 93 | message: 'Calling `assert.rejects` without `await` or `.then(common.mustCall())` will not detect never-settling promises.', | |
| 94 | 94 | }, | |
| 95 | + { | ||
| 96 | + selector: 'CallExpression[callee.property.name="catch"]>:first-child:matches(CallExpression[callee.object.name="common"][callee.property.name="mustNotCall"], CallExpression[callee.name="mustNotCall"])', | ||
| 97 | + message: 'Calling `.catch(common.mustNotCall())` will not detect never-settling promises. Use `.then(common.mustCall())` instead.', | ||
| 98 | + }, | ||
| 95 | 99 | ], | |
| 96 | 100 | ||
| 97 | 101 | // Stylistic rules. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,4 +48,4 @@ function hook(code, filename) { | |||
| 48 | 48 | assert.deepStrictEqual({ ...bar }, { $key: 'bar-esm' }); | |
| 49 | 49 | } | |
| 50 | 50 | ||
| 51 | - })().catch(common.mustNotCall()); | ||
| 51 | + })().then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,4 +48,4 @@ function hook(code, filename) { | |||
| 48 | 48 | assert.deepStrictEqual({ ...bar }, { $key: 'bar-esm' }); | |
| 49 | 49 | } | |
| 50 | 50 | ||
| 51 | - })().catch(common.mustNotCall()); | ||
| 51 | + })().then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -138,9 +138,9 @@ test('dsa_public.pem', 'dsa_private.pem', 'sha256', false, | |||
| 138 | 138 | verify('sha256', data, publicKey, signature), | |
| 139 | 139 | verify('sha256', data, publicKey, signature), | |
| 140 | 140 | verify('sha256', data, publicKey, signature), | |
| 141 | - ]).then(common.mustCall()); | ||
| 141 | + ]); | ||
| 142 | 142 | }) | |
| 143 | - .catch(common.mustNotCall()); | ||
| 143 | + .then(common.mustCall()); | ||
| 144 | 144 | } | |
| 145 | 145 | ||
| 146 | 146 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments