Open Bug 1731094 Opened 3 years ago

Consider changing browser.test.assertThrow/assertRejects to match an expected string value with the entire error value converted into a string

Categories

(WebExtensions :: General, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: rpl, Unassigned)

References

Details

While working on Bug 1724183 and implement browser.test.assertThrows/assertRejects to work also when called from the MV3 background service worker we did notice that, unlike similar assertion methods provided by other JS test frameworks, our implementation of these assertions methods is comparing an expected string value with the error message instead of the entire error object converted into a string (which will also include the Error constructor name).

Given that for matching partially an error the caller can use a regexp as the expected value, it may be reasonable to change these assertion methods to compare the stringified error object instead of the message.

You need to log in before you can comment on or make changes to this bug.