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

Import .coverdata after test run and improve documentation #309

Merged
merged 3 commits into from
Aug 9, 2023

Conversation

zachallaun
Copy link
Contributor

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.

  • .coverdata is now imported just before ExCoveralls.execute/3, instead of during ExCoveralls.start/2. This allows coverage data generated during the test run to be included in the final report.
  • Fixed a small error in documentation: --import_cover -> --import-cover
  • Added a new section to the README with additional explanation and an example of --import-cover usage.

/cc @albertored, who first introduced this feature

@zachallaun
Copy link
Contributor Author

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 zachallaun force-pushed the import-coverdata-improvements branch from fba79d2 to f9409da Compare April 14, 2023 15:35
README.md Outdated Show resolved Hide resolved
Co-authored-by: Alberto Sartori <alberto.sartori.as@gmail.com>
@zachallaun
Copy link
Contributor Author

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
Copy link
Owner

parroty commented Aug 9, 2023

Thank you for the follow-up 🙇 .

@parroty parroty merged commit ead9d5a into parroty:master Aug 9, 2023
@zachallaun
Copy link
Contributor Author

And thank you for the work you do!

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.

None yet

3 participants