From 52c3cba3589663123263ddb01eb30454547569a9 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Sun, 27 Sep 2026 12:25:51 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Don=E2=80=99t=20use=20Test.Runner.getFailur?= =?UTF-8?q?eReason=20internally?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Test/Html/Query/Internal.elm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Test/Html/Query/Internal.elm b/src/Test/Html/Query/Internal.elm index a1f42856..193d43e6 100644 --- a/src/Test/Html/Query/Internal.elm +++ b/src/Test/Html/Query/Internal.elm @@ -2,12 +2,12 @@ module Test.Html.Query.Internal exposing (Multiple(..), Query(..), QueryError, S import Expect exposing (Expectation) import MicroListExtra as List +import Test.Expectation import Test.Html.Descendant as Descendant import Test.Html.Internal.ElmHtml.InternalTypes as InternalTypes exposing (ElmHtml(..)) import Test.Html.Internal.ElmHtml.ToString exposing (nodeToStringWithOptions) import Test.Html.Internal.Inert as Inert import Test.Html.Selector.Internal as InternalSelector exposing (Selector, selectorToString) -import Test.Runner {-| Note: the selectors are stored in reverse order for better prepending perf. @@ -453,8 +453,8 @@ expectAllHelp successes check list = |> Single False |> check in - case Test.Runner.getFailureReason expectation of - Just { description } -> + case expectation of + Test.Expectation.Fail { failData } -> let prefix = if successes > 0 then @@ -463,11 +463,11 @@ expectAllHelp successes check list = else "The first element failed this test:" in - [ prefix, description ] + [ prefix, failData.description ] |> String.join "\n\n" |> Expect.fail - Nothing -> + Test.Expectation.Pass _ -> expectAllHelp (successes + 1) check rest @@ -617,11 +617,11 @@ showSelectorOutcomeInverse elmHtmlList selector = failWithQuery : Bool -> String -> Query msg -> Expectation -> Expectation failWithQuery showTrace queryName query expectation = - case Test.Runner.getFailureReason expectation of - Just { description } -> + case expectation of + Test.Expectation.Fail { failData } -> let lines = - toLines { showQueryError = not showTrace } description query queryName + toLines { showQueryError = not showTrace } failData.description query queryName |> List.map prefixOutputLine tracedLines = @@ -635,7 +635,7 @@ failWithQuery showTrace queryName query expectation = |> String.join "\n\n\n" |> Expect.fail - Nothing -> + Test.Expectation.Pass _ -> expectation From eb0786712a1eab1d351413a83dc860244d0a6774 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Mon, 28 Sep 2026 22:48:26 +0200 Subject: [PATCH 2/2] Simplify `onFail` to use `fail` --- src/Expect.elm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Expect.elm b/src/Expect.elm index ad9547f7..d30eac0c 100644 --- a/src/Expect.elm +++ b/src/Expect.elm @@ -638,15 +638,8 @@ onFail str expectation = Test.Expectation.Pass _ -> expectation - Test.Expectation.Fail failure -> - Test.Expectation.Fail - { given = failure.given - , failData = - { description = str - , reason = Custom - } - , distributionReport = failure.distributionReport - } + Test.Expectation.Fail _ -> + fail str {-| Passes if all given expectations pass.