assert: validate the block return type#19886
Closed
BridgeAR wants to merge 2 commits intonodejs:masterfrom
Closed
Conversation
jasnell
approved these changes
Apr 9, 2018
targos
reviewed
Apr 9, 2018
.eslintrc.js
Outdated
Member
Author
There was a problem hiding this comment.
This is a change from #19885 that I plan on removing in here as soon as that lands. I already fixed that in there though.
4 tasks
This makes sure the returned value when calling `block` is actually of type promise in case `assert.rejects` or `assert.doesNotReject` is called.
8fdc532 to
386f664
Compare
Member
Author
Member
Author
|
Rebased. This is unblocked and should now be looked at. |
Member
Author
|
@targos PTAL |
targos
approved these changes
Apr 19, 2018
doc/api/assert.md
Outdated
| rejected Promise with an [`ERR_INVALID_RETURN_VALUE`][] error. In both cases | ||
| without checking the error handler. | ||
|
|
||
| If `block` is a function and it does not return a promise, an |
Member
There was a problem hiding this comment.
Isn't this redundant with the previous paragraph?
doc/api/errors.md
Outdated
| <a id="ERR_INVALID_RETURN_VALUE"></a> | ||
| ### ERR_INVALID_RETURN_VALUE | ||
|
|
||
| Thrown in case a function option does not return a expected value on execution. |
doc/api/assert.md
Outdated
| `assert.doesNotReject()` will return a rejected Promise with that error. If the | ||
| function does not return a promise, `assert.doesNotReject()` will return a | ||
| rejected Promise with an [`ERR_INVALID_RETURN_VALUE`][] error. In both cases | ||
| without checking the error handler. |
Contributor
There was a problem hiding this comment.
This sentence fragment seems a bit unexpected. Should we add a verb to it?
doc/api/assert.md
Outdated
| `assert.rejects()` will return a rejected Promise with that error without | ||
| `assert.rejects()` will return a rejected Promise with that error. If the | ||
| function does not return a promise, `assert.rejects()` will return a rejected | ||
| Promise with an [`ERR_INVALID_RETURN_VALUE`][] error. In both cases without |
Member
Author
|
Comments addressed. |
Member
Author
|
@vsemozhetbyt @targos PTAL. This should be ready to land otherwise. |
BridgeAR
added a commit
to BridgeAR/node
that referenced
this pull request
Apr 19, 2018
This makes sure the returned value when calling `block` is actually of type promise in case `assert.rejects` or `assert.doesNotReject` is called. PR-URL: nodejs#19886 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Member
Author
|
Landed in 7007eee |
jasnell
pushed a commit
that referenced
this pull request
Apr 20, 2018
This makes sure the returned value when calling `block` is actually of type promise in case `assert.rejects` or `assert.doesNotReject` is called. PR-URL: #19886 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes sure the returned value when calling
blockis actuallyof type promise in case
assert.rejectsorassert.doesNotRejectis called.
This currently relies on #19885 and I am going to rebase as soon as that lands / changes. Marking as blocked in the meanwhile.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes