From 5b18bce23c054763eab976cc892694fc34c4db2c Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 13 May 2021 23:30:50 +0100 Subject: [PATCH] LibJS/Tests: Add prefix to toThrowWithMessage expectation error details This way we get some more information about where things went wrong. --- Userland/Libraries/LibJS/Tests/test-common.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Tests/test-common.js b/Userland/Libraries/LibJS/Tests/test-common.js index 64e1051889..6473f38b7c 100644 --- a/Userland/Libraries/LibJS/Tests/test-common.js +++ b/Userland/Libraries/LibJS/Tests/test-common.js @@ -301,14 +301,16 @@ class ExpectationError extends Error { this.__expect( e instanceof class_, () => - `Expected error to be instance of ${class_.name}, got ${String(e.name)}` + `toThrowWithMessage: expected error to be instance of ${ + class_.name + }, got ${String(e.name)}` ); this.__expect( e.message.includes(message), () => - `Expected error message to include _${String(message)}_, got _${String( - e.message - )}_` + `toThrowWithMessage: expected error message to include _${String( + message + )}_, got _${String(e.message)}_` ); } });