elm-explorations / test

Write unit and fuzz tests for Elm code.
https://package.elm-lang.org/packages/elm-explorations/test/latest
BSD 3-Clause "New" or "Revised" License
237 stars 39 forks source link

"Contains multiple tests named myFirstTest" error #108

Open glasserc opened 5 years ago

glasserc commented 5 years ago

I recently spent quite a few minutes struggling with this error:

The tests 'Tests' contain multiple tests named 'my first test'. Let's rename them so we know which is which.

The reason is because elm-test init initializes your test module with module Tests exposing (..) and an example suite, and I had modified the suite to be concat [ myFirstTest ]. Because elm-test generates code that imports every exported Test, the generated code looked like describe "Tests" [ suite, myFirstTest ], so myFirstTest was getting included and run twice without my understanding.

I think it would be nice if https://package.elm-lang.org/packages/elm-explorations/test/latest explained that every exported Test in your module will be run. Alternately, perhaps the first test could have a name other than suite so as to promote the idea that you need not group everything under a single toplevel suite.