diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-03-19 22:24:21 +0330 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-03-20 10:44:32 +0330 |
commit | a5958b5f45bcaab7e63b9ffdba681dcb9474237d (patch) | |
tree | 5a802ee619f96589ed5d5ced22794488733290d9 /Userland/Libraries/LibJS | |
parent | 1d95745901aced2f272cdf3c2a05d0deea3d91a3 (diff) | |
download | serenity-a5958b5f45bcaab7e63b9ffdba681dcb9474237d.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/Tests/test-common.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Tests/test-common.js b/Userland/Libraries/LibJS/Tests/test-common.js index bbdc80fc9b..3f5e51d24b 100644 --- a/Userland/Libraries/LibJS/Tests/test-common.js +++ b/Userland/Libraries/LibJS/Tests/test-common.js @@ -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(); } |