-
Notifications
You must be signed in to change notification settings - Fork 0
Run local tests #1
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
Conversation
elm/core is special because the compiler always inserts an implicit dependency on it. therefore it's impossible to have the tests integrated in the elm/core project in the normal way -- if we try to symlink out from $ELM_HOME to our project's source in the way that was done for 0.18, the compiler gets into a deadlock. other approaches cause it to find two copies of all the code in elm/core and refuse to proceed. instead, this approach creates a logically independent project, with no real code, only tests.
these are no longer required by the new version of elm-test
* Date is no longer part of elm/core; remove tests for it * need to import Debug.toString to test it now * 0.19 limited tuple size, so reduce test to match * use new modBy and remainderBy functions * 0.19 removed flip, curry, and uncurry; so, remove tests for those * updates for elm-test: * remove a duplicate test * use Expect.within with floats
* expose Array module contents w/o prefix rather than Maybe * use modBy instead of (%) * remove test for Array.toString, removed in 0.19
* shadowing is no longer allowed by the compiler; remove test for it
* elm-test now requires tests to have unique names
* update import syntax * use String.fromInt, modBy, and Tuple.pair rather than toString, (%), and (,) * inline our own version of flip, as it was removed in 0.19 * remove test for scanl, which was removed in 0.19
* use modBy rather than (%) * String.toInt now returns a Maybe rather than a Result, so implement our own local version of the old behaviour, so the andThen tests can continue to build upon it.
* String.toInt and String.toFloat now return Maybe * String.toInt no longer parses hex literals in 0.19
these are no longer required by the new version of elm-test
* Date is no longer part of elm/core; remove tests for it * need to import Debug.toString to test it now * 0.19 limited tuple size, so reduce test to match * use new modBy and remainderBy functions * 0.19 removed flip, curry, and uncurry; so, remove tests for those * updates for elm-test: * remove a duplicate test * use Expect.within with floats
* expose Array module contents w/o prefix rather than Maybe * use modBy instead of (%) * remove test for Array.toString, removed in 0.19
* shadowing is no longer allowed by the compiler; remove test for it
* elm-test now requires tests to have unique names
* update import syntax * use String.fromInt, modBy, and Tuple.pair rather than toString, (%), and (,) * inline our own version of flip, as it was removed in 0.19 * remove test for scanl, which was removed in 0.19
* use modBy rather than (%) * String.toInt now returns a Maybe rather than a Result, so implement our own local version of the old behaviour, so the andThen tests can continue to build upon it.
* String.toInt and String.toFloat now return Maybe * String.toInt no longer parses hex literals in 0.19
This will allow us to run tests on local elm/core.
This commit makes the tests into a mock package called `elm/core-tests`. This stops the compiler complaining about kernel code and allows the tests to run localy. `elm-test` does not allow such a hack so the tests have to be run locally. When building a package, elm expects absolutely all source files to be in the `src` directory. Therefore, before running the tests some copying and pasting is required.
9f4f578
to
6eadaf5
Compare
I think that your solution could well be better here, it allows the tests to be run using the node test runner which creates much nicer output to the terminal. |
Thanks for lending a hand! I refined my approach a bit, and will probably However, I'm far from an expert on how this really ought to be done -- I just wanted to get something working so I could test my fix to elm#1011. :) I am planning to open a PR for my approach, but I'll certainly link back here so Evan et al. can pick whichever approach they prefer. |
I prefer your approach 👍 |
Hi I saw https://discourse.elm-lang.org/t/running-tests-for-elm-core/3073/4 and thought I would have a go at running the local tests and this is what I came up with!
I see that since I started this work you have also looked at running local tests (via
run_tests.sh
) but I think that as my approach is slightly different you may be interested in it.I make the
tests
directory into an elm package and copy the core modules, tests and some runner code into thetests/src
directory. I can then run elm make (the compiler does not complain about kernel code because the package is calledelm/core
) to build the tests.Would be interested to hear what you think about this approach!