1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:38:10 +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:
Ali Mohammad Pur 2022-02-22 07:47:48 +03:30 committed by Ali Mohammad Pur
parent 6bb0c09bc1
commit 0fe97cdfe4

View file

@ -280,7 +280,13 @@ class ExpectationError extends Error {
toEqual(value) {
this.__doMatcher(() => {
this.__expect(deepEquals(this.target, value));
this.__expect(
deepEquals(this.target, value),
() =>
`Expected _${valueToString(value)}_, but got _${valueToString(
this.target
)}_`
);
});
}