Skip to content
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

Add test coverage measuring #40

Merged
merged 2 commits into from
Jul 18, 2024
Merged

Add test coverage measuring #40

merged 2 commits into from
Jul 18, 2024

Conversation

tpendragon
Copy link
Contributor

@tpendragon tpendragon commented Jul 16, 2024

This adds excoveralls (which is the state of the art coverage tool) and a mix spec command which will run the whole suite with an HTML export of coverage and fail if the coverage is less than 100%.

I decided on excoveralls based on the HTML view of mix test --cover not having a table of contents to see all coverage in one place. Read on https://elixirforum.com/t/code-coverage-tools-for-elixir/18102 that excoveralls was the best option, and it seems well maintained.

Closes #37

This adds excoveralls (which is the state of the art coverage tool) and
a `mix spec` command which will run the whole suite with an HTML export
of coverage.

Closes #37
@tpendragon tpendragon marked this pull request as ready for review July 16, 2024 21:56
Copy link
Member

@hackartisan hackartisan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I tried it, it doesn't seem to print out the coverage when you run mix test -- is it determined separately / statically? mix coveralls seems to work, but I'm not sure where to see the html view you referenced. Can you add to the readme instructions for how to run / view coverage?

@@ -9,7 +9,16 @@ defmodule DpulCollections.MixProject do
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
deps: deps(),
test_coverage: [tool: ExCoveralls],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i guess this makes mix test --cover use excoveralls

@tpendragon
Copy link
Contributor Author

@hackartisan Mix spec or mix coveralls.html should generate the html page.

@hackartisan
Copy link
Member

@tpendragon can you add that to the readme

@tpendragon
Copy link
Contributor Author

@tpendragon can you add that to the readme

Yup!

@hackartisan hackartisan merged commit 39975c6 into main Jul 18, 2024
1 check passed
@hackartisan hackartisan deleted the 37-coverage branch July 18, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Measure Test Coverage
2 participants