covr tracks and reports code coverage for your package and (optionally) upload the results to a coverage service like 'Codecov' https://about.codecov.io or 'Coveralls' https://coveralls.io. Code coverage is a measure of the amount of code being exercised by a set of tests. It is an indirect measure of test quality and completeness. This package is compatible with any testing methodology or framework and tracks coverage of both R code and compiled C/C++/FORTRAN code.
A coverage report can be used to inspect coverage for each line in your
package. Using report()
requires the additional dependencies DT
and htmltools
.
# If run with no arguments `report()` implicitly calls `package_coverage()`
report()
covr
uses the following options()
to configure behaviour:
covr.covrignore
: A filename to use as an ignore file,
listing glob-style wildcarded paths of files to ignore for coverage
calculations. Defaults to the value of environment variable
COVR_COVRIGNORE
, or ".covrignore"
if the neither the option nor the
environment variable are set.
covr.exclude_end
: Used along with covr.exclude_start
, an optional
regular expression which ends a line-exclusion region. For more
details, see ?exclusions
.
covr.exclude_pattern
: An optional line-exclusion pattern. Lines
which match the pattern will be excluded from coverage. For more details,
see ?exclusions
.
covr.exclude_start
: Used along with covr.exclude_end
, an optional
regular expression which starts a line-exclusion region. For more
details, see ?exclusions
.
covr.filter_non_package
: If TRUE
(the default behavior), coverage
of files outside the target package are filtered from coverage output.
covr.fix_parallel_mcexit
:
covr.flags
:
covr.gcov
: If the appropriate gcov version is not on your path you
can use this option to set the appropriate location. If set to "" it will
turn off coverage of compiled code.
covr.gcov_additional_paths
:
covr.gcov_args
:
covr.icov
:
covr.icov_args
:
covr.icov_flags
:
covr.icov_prof
:
covr.rstudio_source_markers
: A logical value. If TRUE
(the
default behavior), source markers are displayed within the RStudio IDE
when using zero_coverage
.
covr.record_tests
: If TRUE
(default NULL
), record a listing of
top level test expressions and associate tests with covr
traces
evaluated during the test's execution. For more details, see
?covr.record_tests
.
covr.showCfunctions
:
Useful links: