mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibJS/Tests: Add details for toThrowWithMessage() expectation error
This commit is contained in:
parent
ce86026ac6
commit
431782bcd6
1 changed files with 12 additions and 2 deletions
|
@ -298,8 +298,18 @@ class ExpectationError extends Error {
|
|||
this.target();
|
||||
this.__expect(false);
|
||||
} catch (e) {
|
||||
this.__expect(e instanceof class_);
|
||||
this.__expect(e.message.includes(message));
|
||||
this.__expect(
|
||||
e instanceof class_,
|
||||
() =>
|
||||
`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
|
||||
)}_`
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue