mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
Tests/LibWeb: Finish async test when an error is caught
This catches errors that occur within async tests so that we fail faster rather than timing out due to `done()` not being called. We use `Promise.resolve()` because `f` isn't guaranteed to be an async function.
This commit is contained in:
@@ -86,7 +86,10 @@ function asyncTest(f) {
|
||||
__finishTest();
|
||||
};
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
f(done);
|
||||
Promise.resolve(f(done)).catch(error => {
|
||||
println(`Caught error while running async test: ${error}`);
|
||||
done();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user