1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/covr.R
\name{package_coverage}
\alias{package_coverage}
\title{Calculate test coverage for a package}
\usage{
package_coverage(
path = ".",
type = c("tests", "vignettes", "examples", "all", "none"),
combine_types = TRUE,
relative_path = TRUE,
quiet = TRUE,
clean = TRUE,
line_exclusions = NULL,
function_exclusions = NULL,
code = character(),
install_path = temp_file("R_LIBS"),
...,
exclusions,
pre_clean = TRUE
)
}
\arguments{
\item{path}{file path to the package.}
\item{type}{run the package \sQuote{tests}, \sQuote{vignettes},
\sQuote{examples}, \sQuote{all}, or \sQuote{none}. The default is
\sQuote{tests}.}
\item{combine_types}{If \code{TRUE} (the default) the coverage for all types
is simply summed into one coverage object. If \code{FALSE} separate objects
are used for each type of coverage.}
\item{relative_path}{whether to output the paths as relative or absolute
paths. If a string, it is interpreted as a root path and all paths will be
relative to that root.}
\item{quiet}{whether to load and compile the package quietly, useful for
debugging errors.}
\item{clean}{whether to clean temporary output files after running, mainly
useful for debugging errors.}
\item{line_exclusions}{a named list of files with the lines to exclude from
each file.}
\item{function_exclusions}{a vector of regular expressions matching function
names to exclude. Example \verb{print\\\\\\.} to match print methods.}
\item{code}{A character vector of additional test code to run.}
\item{install_path}{The path the instrumented package will be installed to
and tests run in. By default it is a path in the R sessions temporary
directory. It can sometimes be useful to set this (along with \code{clean = FALSE}) to help debug test failures.}
\item{...}{Additional arguments passed to \code{\link[tools:testInstalledPackage]{tools::testInstalledPackage()}}.}
\item{exclusions}{\sQuote{Deprecated}, please use \sQuote{line_exclusions} instead.}
\item{pre_clean}{whether to delete all objects present in the src directory before recompiling}
}
\description{
This function calculates the test coverage for a development package on the
\code{path}. By default it runs only the package tests, but it can also run
vignette and example code.
}
\details{
This function uses \code{\link[tools:testInstalledPackage]{tools::testInstalledPackage()}} to run the
code, if you would like to test your package in another way you can set
\code{type = "none"} and pass the code to run as a character vector to the
\code{code} parameter.
#ifdef unix
Parallelized code using \pkg{parallel}'s \code{\link[=mcparallel]{mcparallel()}} needs to
use a patched \code{parallel:::mcexit}. This is done automatically if the
package depends on \pkg{parallel}, but can also be explicitly set using the
environment variable \code{COVR_FIX_PARALLEL_MCEXIT} or the global option
\code{covr.fix_parallel_mcexit}.
#endif
}
\seealso{
\code{\link[=exclusions]{exclusions()}} For details on excluding parts of the
package from the coverage calculations.
}
|