LibJS: Allow 'expect().fail("some random string")' in test-js
Previously fail() wanted the fail object to be a callable, allow it to be a string also.
This commit is contained in:
parent
1d95745901
commit
a5958b5f45
Notes:
sideshowbarker
2024-07-17 18:13:59 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/a5958b5f45 Pull-request: https://github.com/SerenityOS/serenity/pull/13142 Reviewed-by: https://github.com/ADKaster
1 changed files with 2 additions and 1 deletions
|
@ -512,7 +512,8 @@ class ExpectationError extends Error {
|
|||
__expect(value, details) {
|
||||
if (value !== true) {
|
||||
if (details !== undefined) {
|
||||
throw new ExpectationError(details());
|
||||
if (details instanceof Function) throw new ExpectationError(details());
|
||||
else throw new ExpectationError(details);
|
||||
} else {
|
||||
throw new ExpectationError();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue