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
commit 5b18bce23c
Notes: sideshowbarker 2024-07-18 18:11:42 +09:00

View file

@ -301,14 +301,16 @@ class ExpectationError extends Error {
this.__expect( this.__expect(
e instanceof class_, 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( this.__expect(
e.message.includes(message), e.message.includes(message),
() => () =>
`Expected error message to include _${String(message)}_, got _${String( `toThrowWithMessage: expected error message to include _${String(
e.message message
)}_` )}_, got _${String(e.message)}_`
); );
} }
}); });