From b221cad659eeb2da723d7dc16e8d6cee0c4a56c2 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 13 May 2021 23:34:03 +0100 Subject: [PATCH] LibJS/Tests: Add details for toBeTrue() / toBeFalse() expectation error --- Userland/Libraries/LibJS/Tests/test-common.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibJS/Tests/test-common.js b/Userland/Libraries/LibJS/Tests/test-common.js index 4d9ae071c9..0bc84cf4c6 100644 --- a/Userland/Libraries/LibJS/Tests/test-common.js +++ b/Userland/Libraries/LibJS/Tests/test-common.js @@ -174,13 +174,19 @@ class ExpectationError extends Error { toBeTrue() { this.__doMatcher(() => { - this.__expect(this.target === true); + this.__expect( + this.target === true, + () => `toBeTrue: expected target to be true, got _${String(this.target)}_` + ); }); } toBeFalse() { this.__doMatcher(() => { - this.__expect(this.target === false); + this.__expect( + this.target === false, + () => `toBeTrue: expected target to be false, got _${String(this.target)}_` + ); }); }