mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-18 08:20:44 +00:00
LibJS: Print the expected and received value on expect.toEqual() failure
'ExpectationError' is hardly an actionable error message.
This commit is contained in:
parent
6bb0c09bc1
commit
0fe97cdfe4
Notes:
sideshowbarker
2024-07-17 18:24:21 +09:00
Author: https://github.com/alimpfard
Commit: 0fe97cdfe4
Pull-request: https://github.com/SerenityOS/serenity/pull/12719
Reviewed-by: https://github.com/DavidLindbom
Reviewed-by: https://github.com/linusg
1 changed files with 7 additions and 1 deletions
|
@ -280,7 +280,13 @@ class ExpectationError extends Error {
|
||||||
|
|
||||||
toEqual(value) {
|
toEqual(value) {
|
||||||
this.__doMatcher(() => {
|
this.__doMatcher(() => {
|
||||||
this.__expect(deepEquals(this.target, value));
|
this.__expect(
|
||||||
|
deepEquals(this.target, value),
|
||||||
|
() =>
|
||||||
|
`Expected _${valueToString(value)}_, but got _${valueToString(
|
||||||
|
this.target
|
||||||
|
)}_`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue