mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +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:
parent
53664787fb
commit
5b18bce23c
1 changed files with 6 additions and 4 deletions
|
@ -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)}_`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue