-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
assert: provide extra context in case of failed error validation checks #28263
assert: provide extra context in case of failed error validation checks #28263
Commits on Jun 15, 2019
-
assert: improve class instance errors
This improves `assert.throws()` and `assert.rejects()` in case error classes are used as validation for the expected error. In case of a failure it will now throw an `AssertionError` instead of the received error if the check fails. That error has the received error as actual property and the expected property is set to the expected error class. The error message should help users to identify the problem faster than before by providing extra context what went wrong.
Configuration menu - View commit details
-
Copy full SHA for 75e5ba1 - Browse repository at this point
Copy the full SHA 75e5ba1View commit details -
assert: fix generatedMessage property
This makes sure the `generatedMessage` property is always set as expected. This was not the case some `assert.throws` and `assert.rejects` calls.
Configuration menu - View commit details
-
Copy full SHA for f90cfca - Browse repository at this point
Copy the full SHA f90cfcaView commit details -
assert: wrap validation function errors
This makes sure that validation function used by `assert.throws` and `assert.rejects` always throw validatin errors instead of rethrowing the received error. That should improve the debugging experience for developers since they have a better context where the error is coming from and they also get to know what triggered it.
Configuration menu - View commit details
-
Copy full SHA for 4d29fd1 - Browse repository at this point
Copy the full SHA 4d29fd1View commit details -
This refactors some code for less duplication.
Configuration menu - View commit details
-
Copy full SHA for 1563d9d - Browse repository at this point
Copy the full SHA 1563d9dView commit details -
assert: add more information to AssertionErrors
This adds information about the actual thrown error to the AssertionError's message property. It also improves the logged error instances error name by using the constructors name, if available.
Configuration menu - View commit details
-
Copy full SHA for 9d7d103 - Browse repository at this point
Copy the full SHA 9d7d103View commit details -
assert: special handle identical error names in instance checks
This makes sure that using `assert.throws()` or `assert.rejects()` in combination with Error classes log appropriate error messages in case the expected and received constructor name are identical but not part of the same prototype chain.
Configuration menu - View commit details
-
Copy full SHA for adb44d3 - Browse repository at this point
Copy the full SHA adb44d3View commit details
Commits on Jun 17, 2019
-
doc: update assert.throws() examples
This updates two outdated examples to the current implementation.
Configuration menu - View commit details
-
Copy full SHA for e096890 - Browse repository at this point
Copy the full SHA e096890View commit details -
doc: update assert.throws example
This makes sure the current validation function example reflects the current implementation.
Configuration menu - View commit details
-
Copy full SHA for fa0f3f1 - Browse repository at this point
Copy the full SHA fa0f3f1View commit details
Commits on Jun 20, 2019
-
doc: make
AssertionError
a linkThis makes sure that `AssertionError` links to the correct place in the assert documentation.
Configuration menu - View commit details
-
Copy full SHA for 683e311 - Browse repository at this point
Copy the full SHA 683e311View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9832d3d - Browse repository at this point
Copy the full SHA 9832d3dView commit details