1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/test.R
3\name{test}
4\alias{test}
5\alias{test_active_file}
6\alias{test_coverage}
7\alias{test_coverage_active_file}
8\title{Execute testthat tests in a package}
9\usage{
10test(pkg = ".", filter = NULL, stop_on_failure = FALSE, export_all = TRUE, ...)
11
12test_active_file(file = find_active_file(), ...)
13
14test_coverage(pkg = ".", show_report = interactive(), ...)
15
16test_coverage_active_file(
17  file = find_active_file(),
18  filter = TRUE,
19  show_report = interactive(),
20  export_all = TRUE,
21  ...
22)
23}
24\arguments{
25\item{pkg}{The package to use, can be a file path to the package or a
26package object.  See \code{\link[=as.package]{as.package()}} for more information.}
27
28\item{filter}{If not \code{NULL}, only tests with file names matching this
29regular expression will be executed. Matching is performed on the file
30name after it's stripped of \code{"test-"} and \code{".R"}.}
31
32\item{stop_on_failure}{If \code{TRUE}, throw an error if any tests fail.}
33
34\item{export_all}{If \code{TRUE} (the default), export all objects.
35If \code{FALSE}, export only the objects that are listed as exports
36in the NAMESPACE file.}
37
38\item{...}{additional arguments passed to wrapped functions.}
39
40\item{file}{One or more source or test files. If a source file the
41corresponding test file will be run. The default is to use the active file
42in RStudio (if available).}
43
44\item{show_report}{Show the test coverage report.}
45}
46\description{
47\itemize{
48\item \code{test()} runs all tests in a package. It's a shortcut for
49\code{\link[testthat:test_dir]{testthat::test_dir()}}
50\item \code{test_active_file()} runs \code{test()} on the active file.
51\item \code{test_coverage()} computes test coverage for your package. It's a
52shortcut for \code{\link[covr:package_coverage]{covr::package_coverage()}} plus \code{\link[covr:report]{covr::report()}}.
53\item \code{test_coverage_active_file()} computes test coverage for the active file. It's a
54shortcut for \code{\link[covr:file_coverage]{covr::file_coverage()}} plus \code{\link[covr:report]{covr::report()}}.
55}
56}
57