Work in progress - Code coverage tooling for Elm
elm-coverage is a tool for calculating code coverage for Elm code tested with
The goal of the reports generated by
elm-coverage is to help you visualize
what parts of your code are being evaluated when running your tests, and to try
and guide you towards writing tests that focus specifically on the more complex
functions in your codebase.
The goal is not to condense that information down into a single metric. It is too easy to write tests that don't make meaningful assertions about your code and its behaviour, but only serve to increase the coverage.
The only thing worse than having no tests is having tests that provide a false sense of security.
For further reading, please direct yourself to https://elm-coverage.readthedocs.io
elm-coverage works much the same way as installing other tools in
the Elm ecosystem:
npm i -g elm-coverage
The simplest invocation of
elm-coverage is to simply invoke
the root of your project:
elm-coverage assumes that your sources exist in a separate
directory, that you have
elm-test installed globally, and that
needs no further, special flags.
You can specify an alternative path to crawl for sources to instrument:
If you don't want to use a globally installed
elm-test, you can specify the
path to an
elm-coverage --elm-test ./node_modules/.bin/elm-test
-- are passed through to
elm-test, for example to
specify the initial
seed and number of
elm-coverage -- --seed 12345 --fuzz 99
elm-coverage will write an HTML report to
.coverage/coverage.html. It is not
recommended to version control this directory. In order to open the report once
it is generated, you can specify the
elm-coverage is licensed under the BSD-3 license.
licensed under the BSD-3 license.