parroty / excoveralls

Coverage report tool for Elixir with coveralls.io integration.
MIT License
820 stars 178 forks source link

Import `.coverdata` after test run and improve documentation #309

Closed zachallaun closed 1 year ago

zachallaun commented 1 year ago

Hi friends! Thanks for such a great tool.

This PR adds additional documentation/usage for the --import-cover flag and makes a change that improves the ergonomics of integration test coverage.

/cc @albertored, who first introduced this feature

zachallaun commented 1 year ago

Additional context for my own use-case:

I'm working on a library that modifies the behavior of mix test. To do end-to-end integration testing, some test modules are dynamically generated, saved to a temp directory, and run using a shell command to mix test.

test_command = """
echo "#{test.test_input}" | \
  CI=false mix test #{file_path} \
    --seed 0
"""

task = Task.async(System, :shell, [test_command])

This change allows me to save out the coverage data from those tests and include them in the final coverage report, all within the same test run:

test_command = """
echo "#{test.test_input}" | \
  CI=false mix test #{file_path} \
    --seed 0 \
    --cover \
    --export-coverage #{test.name}
"""

task = Task.async(System, :shell, [test_command])

Now I can run the following:

$ mix coveralls --import-cover cover
zachallaun commented 1 year ago

Just wanted to bump this in case it can sneak into the release you mentioned might be later today, @parroty! No worries if not :)

parroty commented 1 year ago

Thank you for the follow-up 🙇 .

zachallaun commented 1 year ago

And thank you for the work you do!