View source: R/run_covr_modes.R
| run_covr_modes | R Documentation |
This function inspects the test configuration of an R package and runs code coverage analysis using any available testing framework, including 'testthat', 'testit', base R test scripts, or Bioconductor-style tests. If no recognised testing configuration is found, a default zero‑coverage result is returned.
run_covr_modes(pkg_source_path, covr_timeout = 60)
pkg_source_path |
Character. Path to the root directory of the package source. |
covr_timeout |
Numeric. Timeout in seconds for running coverage analysis. Default is 60. |
A named list containing coverage results, package metadata, and test configuration details. The returned list includes (but is not limited to):
Character. Package name extracted from the DESCRIPTION file.
Character. Package version.
Timestamp of when the analysis was run.
User or environment running the analysis.
System metadata.
R version used during analysis.
Character. Detected testing framework type.
A nested list containing:
Numeric. Aggregated coverage percentage.
File‑level and line‑level coverage details.
Any warnings or notes detected during testing.
A list describing the test configuration of the package (presence of testthat, testit, base tests, snapshots, etc.).
This function always returns a value. When no supported testing framework is detected, a default object with zero coverage and diagnostic information is returned.
dp <- system.file("test-data",
"test.package.0001_0.1.0.tar.gz",
package = "test.assessr")
# set up package
install_list <- set_up_pkg(dp)
package_installed <- install_list$package_installed
pkg_source_path <- install_list$pkg_source_path
# install package locally to ensure test works
package_installed <- install_package_local(pkg_source_path)
package_installed <- TRUE
covr_mode_list <- run_covr_modes(pkg_source_path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.