From 0de910784e498594f99017880b914b4cc2d4ad42 Mon Sep 17 00:00:00 2001 From: rmg-x Date: Wed, 15 Jan 2025 19:12:56 -0600 Subject: [PATCH] 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. --- Tests/LibWeb/Text/input/include.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tests/LibWeb/Text/input/include.js b/Tests/LibWeb/Text/input/include.js index 946b6613a98..d50a932ed67 100644 --- a/Tests/LibWeb/Text/input/include.js +++ b/Tests/LibWeb/Text/input/include.js @@ -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(); + }); }); }