| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| 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 | |
|---|---|---|---|
@@ -91,6 +91,10 @@ export default [ | |||
| 91 | 91 | selector: "ExpressionStatement>CallExpression:matches([callee.name='rejects'], [callee.object.name='assert'][callee.property.name='rejects'])", | |
| 92 | 92 | message: 'Calling `assert.rejects` without `await` or `.then(common.mustCall())` will not detect never-settling promises.', | |
| 93 | 93 | }, | |
| 94 | + { | ||
| 95 | + selector: 'CallExpression[callee.property.name="catch"]>:first-child:matches(CallExpression[callee.object.name="common"][callee.property.name="mustNotCall"], CallExpression[callee.name="mustNotCall"])', | ||
| 96 | + message: 'Calling `.catch(common.mustNotCall())` will not detect never-settling promises. Use `.then(common.mustCall())` instead.', | ||
| 97 | + }, | ||
| 94 | 98 | ], | |
| 95 | 99 | ||
| 96 | 100 | // 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 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,7 +53,7 @@ async function promise() { | |||
| 53 | 53 | await (await fs.promises.open(__filename, 'r')).close(); | |
| 54 | 54 | } | |
| 55 | 55 | ||
| 56 | - promise().then(common.mustCall()).catch(common.mustNotCall()); | ||
| 56 | + promise().then(common.mustCall()); | ||
| 57 | 57 | ||
| 58 | 58 | assert.throws( | |
| 59 | 59 | () => fs.open(__filename, 'r', 'boom', common.mustNotCall()), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -690,7 +690,7 @@ async function tests() { | |||
| 690 | 690 | const it = r[Symbol.asyncIterator](); | |
| 691 | 691 | const p = it.return(); | |
| 692 | 692 | r.emit('close'); | |
| 693 | - p.then(common.mustCall()).catch(common.mustNotCall()); | ||
| 693 | + p.then(common.mustCall()); | ||
| 694 | 694 | } | |
| 695 | 695 | ||
| 696 | 696 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments