Skip to content

Report all failures from Expect.all - #282

Draft
lydell wants to merge 1 commit into
elm-explorations:masterfrom
lydell:expect-all-multiple
Draft

lydell wants to merge 1 commit into
elm-explorations:masterfrom
lydell:expect-all-multiple

Conversation

@lydell

@lydell lydell commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Expect.all currently stops at the first failing expectation. This PR uses the Multiple reason from #126 (added for Expect.oneOf) to report all failing expectations in one go.

Unfortunately, the flattening from commit 59f6117 assumes that Multiple is only used for Expect.oneOf, despite being named generically. I modified the existing test case to use a mix of oneOf and all:

Expect.oneOf
    [ 1 |> Expect.equal 2
    , Expect.all
        [ 2 |> Expect.equal 3
        , 3 |> Expect.equal 4
        ]
    , 4 |> Expect.equal 5
    ]

The failure from the above is:

{ description = "Expect.oneOf: none of the expectations passed."
, given = Nothing
, reason =
    Multiple
        [ { description = "Expect.equal", given = Nothing, reason = Equality "2" "1" }
        , { description = "Expect.equal", given = Nothing, reason = Equality "3" "2" }
        , { description = "Expect.equal", given = Nothing, reason = Equality "4" "3" }
        , { description = "Expect.equal", given = Nothing, reason = Equality "5" "4" }
        ]
}
  • The "Expect.all: some of the expectations failed." description is missing.
  • The failure makes it look like fixing any of the sub-failures will make the test pass, but that’s not true: The two middle ones need to both be fixed together, since they are in an Expect.all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant