binhonglee / coco

Code coverage for Nim lang (CLI + library)
MIT License
46 stars 3 forks source link

option for specifying which files end up in coverage report #4

Closed timotheecour closed 5 years ago

timotheecour commented 5 years ago

prerequisite: https://github.com/samuelroy/nim-coverage/issues/2

eg usage

# this will run coverage only on specified globs
# !std/this_will_be_ignored/**` could be used to ignore patterns (just like in ripgrep ignore patterns or gitignore)
coverage --cov:modules:'std/**,pkg/regex/bar/*,mylocaldir/src/subdir/foo/**/*.nim,!std/this_will_be_ignored/**'

https://github.com/citycide/glob can be used for parsing globs /cc @citycide

samuelroy commented 5 years ago

There's 2 different things here:

  1. target directories/files that we need to compile and run in coverage mode
  2. cleaning up lcov.info by removing unwanted data (like coverage on .nimble pkgs)

We could end up with the following arguments:

# !tests/ exclude folder tests from the coverage report
nimcoverage --target:'tests/**/*.' --cov:'./,!tests/'
samuelroy commented 5 years ago

Use the flag --cov to include and exclude path from the code coverage report. See the latest readme.