mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibJS/Tests: Catch exceptions in describe() itself
Otherwise exceptions thrown in that state would simply terminate the test.
This commit is contained in:
parent
d7ba15371b
commit
09cf1040ef
1 changed files with 9 additions and 1 deletions
|
@ -441,7 +441,15 @@ class ExpectationError extends Error {
|
|||
|
||||
describe = (message, callback) => {
|
||||
suiteMessage = message;
|
||||
callback();
|
||||
if (!__TestResults__[suiteMessage]) __TestResults__[suiteMessage] = {};
|
||||
try {
|
||||
callback();
|
||||
} catch (e) {
|
||||
__TestResults__[suiteMessage][defaultSuiteMessage] = {
|
||||
result: "fail",
|
||||
details: String(e),
|
||||
};
|
||||
}
|
||||
suiteMessage = defaultSuiteMessage;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue