Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't have describe with same value as module name #501

Open
yonigibbs opened this issue Mar 24, 2021 · 2 comments
Open

Can't have describe with same value as module name #501

yonigibbs opened this issue Mar 24, 2021 · 2 comments
Labels

Comments

@yonigibbs
Copy link

If you have a test module called Foo you can't use Foo as the string argument to describe. And, if you do, you get a misleading error message: "The test 'Foo' contains a child test of the same name. Let's rename them so we know which is which"

Sample code:

module Foo exposing (..)

import Expect exposing (Expectation)
import Test exposing (..)

suite : Test
suite =
    describe "Foo"
        [ test "t1" (\_ -> 1 + 1 |> Expect.equal 2)
        ]

This is also discussed in #493.

@harrysarson
Copy link
Collaborator

The "bug" here is that the error message is really bad.
I think I am happy that this combination of module name and describe label is not allowed (although happy to hear other opinions).

@yonigibbs
Copy link
Author

As a user of elm-test it's not immediately clear to me why such a combination should be invalid. In my case I happened to have a test module called Json and a describe of Json, because this was just for a very brief demo of some Elm stuff to someone. However, if there are technical reasons why such a combination is invalid then I think that would be fine as long as it's documented, and the error message is better, like you say. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants