Skip to content

Commit 70cb708

Browse files
tniessenBethGriggs
authored andcommittedDec 8, 2020
test: add common.mustSucceed
PR-URL: #35086 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 6c4e697 commit 70cb708

File tree

140 files changed

+522
-782
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+522
-782
lines changed
 

‎doc/guides/writing-tests.md

+5
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ const server = http.createServer(common.mustCall((req, res) => {
209209

210210
```
211211

212+
**Note:** Many functions invoke their callback with an `err` value as the first
213+
argument. It is not a good idea to simply pass `common.mustCall()` to those
214+
because `common.mustCall()` will ignore the error. Use `common.mustSucceed()`
215+
instead.
216+
212217
#### Countdown Module
213218

214219
The common [Countdown module](https://github.com/nodejs/node/tree/master/test/common#countdown-module)

‎test/.eslintrc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ rules:
5050
node-core/prefer-assert-iferror: error
5151
node-core/prefer-assert-methods: error
5252
node-core/prefer-common-mustnotcall: error
53+
node-core/prefer-common-mustsucceed: error
5354
node-core/crypto-check: error
5455
node-core/eslint-check: error
5556
node-core/inspector-check: error

0 commit comments

Comments
 (0)
Please sign in to comment.