Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/Expect.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions src/Test/Html/Query/Internal.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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


Expand Down Expand Up @@ -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 =
Expand All @@ -635,7 +635,7 @@ failWithQuery showTrace queryName query expectation =
|> String.join "\n\n\n"
|> Expect.fail

Nothing ->
Test.Expectation.Pass _ ->
expectation


Expand Down
Loading