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
Notes: sideshowbarker 2024-07-17 18:24:21 +09:00

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
)}_`
);
});
}