Elm-test error with directory name/structure

I have installed elm-test, initialised a test in my project, but when I run I get this error:

I am getting confused when I try to compile this file:

    /home/lars/bdrp/elm-db/tests/Example.elm

I always check if files appear in any of the "source-directories" listed in your
elm.json to see if there might be some cached information about them. That can
help me compile faster! But in this case, it looks like this file may be in
either of these directories:

    /home/lars/bdrp/elm-db
    /home/lars/bdrp/elm-db/tests

Try to make it so no source directory contains another source directory!

Compilation failed while attempting to build /home/lars/bdrp/elm-db/tests/Example.elm

It seems it’s because elm-test wants to spell “tests” with a small “t”, while an elm project structure demands that all directory names have capitalised initials, i.e. “Tests”.

Since nobody else seems to have this problem, I guess the solution is simple, but I don’t see it.

I believe this is because you have "source-directories": ["."] in your elm.json? (I recently improved the error message for that, which will be out in the next version.)

Yes, seems you’re right. But now I get another error:

INFO: Running elmi-to-json for the first time; downloading the actual binary

I keep getting this message, but nothing else happens.

And now after testing, The source-directories thing is needed, otherwise nothing compiles.

"source-directories" is required by Elm to be a non-empty array, so you have to put something in there. "." is valid, but not supported by elm-test if you want to use the tests/ folder. I’d suggest using "source-directories": ["src"] and move all your source code to src/.

1 Like

I had the same issue. Solved it by installing elmi-to-json using yarn. (I tried installing it with npm but got some error, if you can do it with npm it should work too.)

$ [sudo] yarn global add elmi-to-json

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.