Skip to content

feat(forge): --exclude-tests option from coverage #10807

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

Merged
merged 1 commit into from
Jun 19, 2025

Conversation

grandizzy
Copy link
Collaborator

Motivation

  • add option to exclude tests from generated coverage report
  • keep default behavior, no breaking
  • e.g. for morpho blue running without flag
    image

vs running with --exclude-tests
image

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@grandizzy grandizzy changed the title feat: exclude tests option from coverage feat: --exclude-tests option from coverage Jun 19, 2025
@grandizzy grandizzy changed the title feat: --exclude-tests option from coverage feat(forge): --exclude-tests option from coverage Jun 19, 2025
@grandizzy grandizzy marked this pull request as ready for review June 19, 2025 08:18
@grandizzy grandizzy merged commit 8e66fd1 into foundry-rs:master Jun 19, 2025
42 of 44 checks passed
@grandizzy grandizzy deleted the coverage-exclude-tests branch June 19, 2025 08:39
@github-project-automation github-project-automation bot moved this to Done in Foundry Jun 19, 2025
@zerosnacks
Copy link
Member

Hmm.. wasn't this already achievable through the forge coverage --no-match-coverage "(script|test|Foo|Bar)" filter introduced in #8321?

@grandizzy
Copy link
Collaborator Author

grandizzy commented Jun 19, 2025

Hmm.. wasn't this already achievable through the forge coverage --no-match-coverage "(script|test|Foo|Bar)" filter introduced in #8321?

Yeah, but no-match-coverage happens only after the coverage / tests completed (so it basically collect source files / ast for test contracts as well and only after report is generated they're filtered out). With this PR the test sources are not processed / analyzed which should result in lower mem print and faster execution (didn't benchmark though)
I think both have they're own value, this new one for totally ignoring test contracts and no-match-coverage to customize the report (e.g. show only selected from src or test)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants