1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibJS/Tests: Add prefix to toThrowWithMessage expectation error details

This way we get some more information about where things went wrong.
This commit is contained in:
Linus Groh 2021-05-13 23:30:50 +01:00
parent 53664787fb
commit 5b18bce23c

View file

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