-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: refactor common.expectsError #31092
Closed
BridgeAR
wants to merge
2
commits into
nodejs:master
from
BridgeAR:2019-12-25-refactor-common-expects-error
Closed
test: refactor common.expectsError #31092
BridgeAR
wants to merge
2
commits into
nodejs:master
from
BridgeAR:2019-12-25-refactor-common-expects-error
Conversation
This file contains 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
This completely refactors the `expectsError` behavior: so far it's almost identical to `assert.throws(fn, object)` in case it was used with a function as first argument. It had a magical property check that allowed to verify a functions `type` in case `type` was passed used in the validation object. This pattern is now completely removed and `assert.throws()` should be used instead. The main intent for `common.expectsError()` is to verify error cases for callback based APIs. This is now more flexible by accepting all validation possibilites that `assert.throws()` accepts as well. No magical properties exist anymore. This reduces surprising behavior for developers who are not used to the Node.js core code base. This has the side effect that `common` is used significantly less frequent.
nodejs-github-bot
added
addons
Issues and PRs related to native addons.
async_hooks
Issues and PRs related to the async hooks subsystem.
test
Issues and PRs related to the tests.
labels
Dec 25, 2019
BridgeAR
removed
addons
Issues and PRs related to native addons.
async_hooks
Issues and PRs related to the async hooks subsystem.
labels
Dec 25, 2019
Trott
approved these changes
Dec 26, 2019
jasnell
approved these changes
Dec 26, 2019
BridgeAR
added
the
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
label
Dec 27, 2019
trivikr
approved these changes
Dec 29, 2019
BridgeAR
added a commit
that referenced
this pull request
Dec 31, 2019
This completely refactors the `expectsError` behavior: so far it's almost identical to `assert.throws(fn, object)` in case it was used with a function as first argument. It had a magical property check that allowed to verify a functions `type` in case `type` was passed used in the validation object. This pattern is now completely removed and `assert.throws()` should be used instead. The main intent for `common.expectsError()` is to verify error cases for callback based APIs. This is now more flexible by accepting all validation possibilites that `assert.throws()` accepts as well. No magical properties exist anymore. This reduces surprising behavior for developers who are not used to the Node.js core code base. This has the side effect that `common` is used significantly less frequent. PR-URL: #31092 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Landed in e038d6a 🎉 |
cjihrig
added a commit
to cjihrig/node
that referenced
this pull request
Dec 31, 2019
This custom ESLint rule is unused since nodejs#31092. This commit removes it.
2 tasks
Trott
pushed a commit
that referenced
this pull request
Jan 2, 2020
This custom ESLint rule is unused since #31092. This commit removes it. PR-URL: #31147 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: James M Snell <[email protected]>
BridgeAR
added a commit
that referenced
this pull request
Jan 3, 2020
This completely refactors the `expectsError` behavior: so far it's almost identical to `assert.throws(fn, object)` in case it was used with a function as first argument. It had a magical property check that allowed to verify a functions `type` in case `type` was passed used in the validation object. This pattern is now completely removed and `assert.throws()` should be used instead. The main intent for `common.expectsError()` is to verify error cases for callback based APIs. This is now more flexible by accepting all validation possibilites that `assert.throws()` accepts as well. No magical properties exist anymore. This reduces surprising behavior for developers who are not used to the Node.js core code base. This has the side effect that `common` is used significantly less frequent. PR-URL: #31092 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
BridgeAR
pushed a commit
that referenced
this pull request
Jan 3, 2020
This custom ESLint rule is unused since #31092. This commit removes it. PR-URL: #31147 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: James M Snell <[email protected]>
Merged
This needs a backport or other previous PRs to be backported in order to land on v12.x-staging. |
MylesBorins
pushed a commit
to sxa/node
that referenced
this pull request
Apr 1, 2020
This completely refactors the `expectsError` behavior: so far it's almost identical to `assert.throws(fn, object)` in case it was used with a function as first argument. It had a magical property check that allowed to verify a functions `type` in case `type` was passed used in the validation object. This pattern is now completely removed and `assert.throws()` should be used instead. The main intent for `common.expectsError()` is to verify error cases for callback based APIs. This is now more flexible by accepting all validation possibilites that `assert.throws()` accepts as well. No magical properties exist anymore. This reduces surprising behavior for developers who are not used to the Node.js core code base. This has the side effect that `common` is used significantly less frequent. Backport-PR-URL: nodejs#31449 PR-URL: nodejs#31092 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
MylesBorins
pushed a commit
that referenced
this pull request
Apr 1, 2020
This completely refactors the `expectsError` behavior: so far it's almost identical to `assert.throws(fn, object)` in case it was used with a function as first argument. It had a magical property check that allowed to verify a functions `type` in case `type` was passed used in the validation object. This pattern is now completely removed and `assert.throws()` should be used instead. The main intent for `common.expectsError()` is to verify error cases for callback based APIs. This is now more flexible by accepting all validation possibilites that `assert.throws()` accepts as well. No magical properties exist anymore. This reduces surprising behavior for developers who are not used to the Node.js core code base. This has the side effect that `common` is used significantly less frequent. Backport-PR-URL: #31449 PR-URL: #31092 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Merged
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
This custom ESLint rule is unused since nodejs#31092. This commit removes it. PR-URL: nodejs#31147 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: James M Snell <[email protected]>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
This custom ESLint rule is unused since #31092. This commit removes it. PR-URL: #31147 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: James M Snell <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
test
Issues and PRs related to the tests.
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 completely refactors the
expectsError
behavior: so far it'salmost identical to
assert.throws(fn, object)
in case it was usedwith a function as first argument. It had a magical property check
that allowed to verify a functions
type
in case thetype
propertywas set. This pattern is now completely removed and
assert.throws()
should be used instead.
The main intent for
common.expectsError()
is to verify error casesfor callback based APIs. This is now more flexible by accepting all
validation possibilities that
assert.throws()
accepts. Nomagical properties exist anymore. This reduces surprising behavior
for developers who are not used to the Node.js core code base.
The custom
prefer-common-expectserror
eslint rule comes obsolete withthis change and
common
us used significantly less frequent.Refs: #30186 (comment)
Most changes are trivial and it should be possible to skim through
most of them.
Files that have been changed more "significantly":
test/parallel/test-crypto.js
test/common/index.js
test/common/README.md
test/parallel/test-eslint-prefer-common-expectserror.js
(removed)test/parallel/test-http-invalid-path-chars.js
test/parallel/test-net-better-error-messages-port-hostname.js
test/parallel/test-net-connect-immediate-finish.js
test/parallel/test-stream-writable-change-default-encoding.js
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes