binhonglee / coco

Code coverage for Nim lang (CLI + library)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

option for specifying which files end up in coverage report

timotheecour opened this issue · comments

prerequisite: #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

commented

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:

  • target: glob - defines the folders and files to compile and run in coverage mode
  • cov: glob - defines the files that will end up in the coverage report
# !tests/ exclude folder tests from the coverage report
nimcoverage --target:'tests/**/*.' --cov:'./,!tests/'
commented

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