mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +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) => {
|
describe = (message, callback) => {
|
||||||
suiteMessage = message;
|
suiteMessage = message;
|
||||||
callback();
|
if (!__TestResults__[suiteMessage]) __TestResults__[suiteMessage] = {};
|
||||||
|
try {
|
||||||
|
callback();
|
||||||
|
} catch (e) {
|
||||||
|
__TestResults__[suiteMessage][defaultSuiteMessage] = {
|
||||||
|
result: "fail",
|
||||||
|
details: String(e),
|
||||||
|
};
|
||||||
|
}
|
||||||
suiteMessage = defaultSuiteMessage;
|
suiteMessage = defaultSuiteMessage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue