zwilias / elm-coverage

Explorations
BSD 3-Clause "New" or "Revised" License
60 stars 13 forks source link

[Feature Request] elm 0.19 support #12

Closed mariohuizar closed 5 years ago

mariohuizar commented 5 years ago

Any plans to update for elm0.19?

RavenDream commented 5 years ago

@zwilias My plan is to modify elm-coverage in 4 ways:

  1. Copy the ./elm.json file to .coverage/instrumented/elm.json
    • Convert the source directory paths into absolute paths except for the src folder that elm-instrument modified
    • copy the ./tests folder into `.coverage/instrumented/tests
    • Add the Coverage.elm file to the elm.json source directories, stop using native code and return () instead of never
  2. Add a fake-elm script to the elm coverage package that passes arguments along to elm make. When elm-coverage invokes elm-test I will add the argument --compiler=fake-elm. The fake elm script will call elm make normally, then after elm make finishes successfully, look at the --output flag passed to elm make to modify the generated js code (In the current version of elm-test this file is called elmTestOutput.js). I will insert the old Native.Coverage.js impl by regex replacing the JS function definition corresponding to Coverage.track.
  3. Run elm-test in the .coverage/instrumented directory instead of project root.
  4. Read the generated coverage log files from the .coverage/instrumented/ directory instead of from .coverage.
zwilias commented 5 years ago

@RavenDream Awesome, that would be really cool. Some questions, though!

copy the ./tests folder into `.coverage/instrumented/tests

Any particular reason this would be required?

Run elm-test in the .coverage/instrumented directory instead of project root.

I think this already happens, doesn't it?

Read the generated coverage log files from the .coverage/instrumented/ directory instead of from .coverage.

Is there a specific reason for wanting to do this?

zwilias commented 5 years ago

Elm 0.19 support was just released as a beta - npm i elm-coverage@beta should get you the goods.

Some notes!