elm-coverage icon indicating copy to clipboard operation
elm-coverage copied to clipboard

Support custom tests location

Open robyoder opened this issue 3 years ago • 1 comments

The docs indicate that a custom tests location is supported using the --tests arg, but as shown in #44, this doesn't actually work.

Resolves #44

The fix was a single line change, but there was a bit of work to do to add a test project to show the issue. I've split the commits into semantic chunks that should tell a pretty clear story:

  1. Fix local elm make in test project — when I was looking to add a new test project I started by trying to build and run the tests in the existing one. elm make failed there with some concerns about elm.json. Even though elm-test worked fine, I figured it was worth improving the integrity of the test project.

  2. Ignore generated coverage files — running elm-coverage in the test project generated coverage files that were not ignored.

  3. Support multiple test projects — the existing tests had simple hardcoded throughout, so to avoid duplicating them all, I refactored them into a loop that could be extended with additional test projects.

  4. Add (failing) tests for custom tests location — this is a copy of the simple case, adjusted to showcase the issue outlined in #44. I committed this alone so it would be easy to verify the failure and the coming fix.

  5. Fix issue with custom tests location — the one-line fix: wherever the tests were before, they should still be in the instrumented directory so that the elm.json file remains accurate.

  6. Remove unused lines — tiny cleanup of unused lines that distracted me when I was reading lib/runner.js.

robyoder avatar Jan 27 '22 05:01 robyoder

Hey, @zwilias, can you take a look?

robyoder avatar Jan 25 '23 04:01 robyoder