From 6114e69a53b7cf476cb2cae1a814f6718be3dacd Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 14 Oct 2024 14:44:57 +0100 Subject: [PATCH] headless-browser: Early-out with an error if no tests are found Previously this would just hang - I assume because the `all_tests_complete` promise could never get resolved without any tests running. --- Ladybird/Headless/Test.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Ladybird/Headless/Test.cpp b/Ladybird/Headless/Test.cpp index e12b074ab76..93d4713b7bb 100644 --- a/Ladybird/Headless/Test.cpp +++ b/Ladybird/Headless/Test.cpp @@ -392,6 +392,12 @@ ErrorOr run_tests(Core::AnonymousBuffer const& theme, Gfx::IntSize window_ return {}; } + if (tests.is_empty()) { + if (app.test_glob.is_empty()) + return Error::from_string_literal("No tests found"); + return Error::from_string_literal("No tests found matching filter"); + } + auto concurrency = min(app.test_concurrency, tests.size()); size_t loaded_web_views = 0;