Closed jfmengels closed 4 years ago
I consider the elm-test
behaviour to be wrong here. For reference, elm install
does the same thing here - it ignores whatever is in test-dependencies
because the information there should not be relevant to building your app.
In fact, the behaviour you describe was the one that elm-json
exhibited at first, but I changed it to match the more logically consistent behaviour of elm install
, even if that means giving up some compatibility with elm-test
. Some discussion here: https://github.com/elm/compiler/issues/1860#issue-384836248
Long story short: dependencies
should list everything needed to build the application, which in this case includes elm-explorations/test
.
That sounds right :+1:
I'll delete the indirect dependency manually for now and open an issue in rtfeldman/node-test-runner
when I have time.
Thank you for the insight :)
This was a really well written, clearly illustrated issue, so thank you for that!
Summary
When you install things using
elm-json --test
you do not get the same results aselm-test install
orelm-test init
when the dependency to be installed is already in the indirect dependencies.Explanation
In
elm-review
, when you runelm-review init
we generate the following empty JSONthen run
(thanks again for implementing the
@major
version a few months ago! :heart: )and that gives us
Notice :arrow_up: that
"elm-explorations/test": "1.2.2"
has been added to indirect dependencies. That is becausejfmengels/elm-review
provides test helpers and aselm-explorations/test
as a dependency.Because I wanted to make it as easy as possible to get started writing tests for
elm-review
rules (things that you make with the library), I pre-addelm-explorations/test
usingand that gives the following
elm.json
So everything looks good, except that
elm-explorations/test
is still in the indirect dependencies, and also in the direct dependencies, whichelm-test
doesn't like when it is running.When you run
elm-test init
,elm-test
removeselm-explorations/test
from the indirect dependencies and adds it to the direct devDependencies. Then, running tests work.You get the following
elm.json
: