-
Notifications
You must be signed in to change notification settings - Fork 634
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
feat(assert): add options
parameter to AssertionError
constructor
#5561
feat(assert): add options
parameter to AssertionError
constructor
#5561
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5561 +/- ##
=======================================
Coverage 96.48% 96.48%
=======================================
Files 465 465
Lines 37772 37772
Branches 5580 5580
=======================================
Hits 36445 36445
Misses 1285 1285
Partials 42 42 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you able to add a test the ensures that the cause
correctly propagates? Also, can you please add an example showing this behavior?
I didn't see a test module for this class, but I'm happy to create one. I'll add an equality test for the error
I'm not sure what you have in mind. Do you essentially want me to copy the body of the test? If not, can you make a suggestion? |
@iuioiua I added tests using actual control flow. As a contrived but simpler alternative, it could look like this: Deno.test("AssertionError", () => {
const originalError = new Error("foo");
const assertionError = new AssertionError("bar", { cause: originalError });
assertStrictEquals(assertionError.message, "bar");
assertStrictEquals(assertionError.cause, originalError);
}); …but that doesn't represent intended usage in exception-handling control flow. With that juxtaposition available, what are your current thoughts about the following?
|
Aside: I'm seeing ci failures in the lint steps (example). They are for the rule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've cleaned up the example and test (they don't have to be too thorough, as this error is used to a large extend throughout testing in the codebase). Now, LGTM! Thanks!
Head branch was pushed to by a user without write access
@iuioiua Ok, sounds good. I did make one more change: using strict equality comparison for the Do you have any thoughts about #5561 (comment)? |
Yes please. |
Ref: