Open
Bug 1480075
Opened 6 years ago
Updated 1 year ago
Should Assert.rejects reject or report a test error when the exception is incorrect
Categories
(Testing :: General, enhancement, P3)
Testing
General
Tracking
(Not tracked)
ASSIGNED
People
(Reporter: jdescottes, Assigned: jdescottes)
References
Details
Attachments
(2 files)
Currently, if the exception thrown by the code tested by Assert.rejects is not the expected one, the exception is just bubbled up and shows up in the test logs as
FAIL Uncaught exception - ${Stringified version of the error}
If the error message is very different from the expected one, or worst if the error is an object (FAIL Uncaught exception [Object object]), it is difficult to realize that the code is already being checked in an Assert.rejects.
It would be nice if we could have an additional failure report, that logs the failure message provided by the caller.
The relevant code is at https://searchfox.org/mozilla-central/rev/196560b95f191b48ff7cba7c2ba9237bba6b5b6a/testing/modules/Assert.jsm#425-428
We could either report and reject, or only report.
Assignee | ||
Comment 1•6 years ago
|
||
Mark, any reason why we just reject the error at the moment?
Flags: needinfo?(standard8)
Assignee | ||
Comment 2•6 years ago
|
||
Since we have unit tests checking that the original exception is still thrown, I suppose doing both is the only viable option.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=636c396124b4bf1a0e7b3bc09e05b5801dc3732b
Comment 3•6 years ago
|
||
This definitely seems a reasonable thing to do. Mike is probably a bit more of an expert in this area though.
Flags: needinfo?(standard8) → needinfo?(mdeboer)
Updated•6 years ago
|
Priority: -- → P3
Assignee | ||
Comment 5•4 years ago
|
||
Assignee | ||
Comment 6•4 years ago
|
||
Depends on D96772
Updated•4 years ago
|
Attachment #9187264 -
Attachment description: Bug 1480075 - Report a meaningful failure wheen Assert.reject catches an incorrect exception → Bug 1480075 - Report a meaningful failure when Assert.reject catches an incorrect exception
Updated•4 years ago
|
Assignee: nobody → jdescottes
Attachment #9187264 -
Attachment description: Bug 1480075 - Report a meaningful failure when Assert.reject catches an incorrect exception → Bug 1480075 - Report a meaningful failure when Assert.rejects catches an incorrect exception
Status: NEW → ASSIGNED
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•