View source: R/run_covr_skip_nstf.R
| create_tinytest_coverage | R Documentation |
Instruments the package **namespace** with covr, runs all
tinytest files in inst/tinytest, and returns a covr coverage
object together with the tinytest results. This mirrors tinytest's execution
model (expectation helpers available; tests run from each file's directory)
while ensuring calls into the package namespace are traced.
create_tinytest_coverage(
pkg_source_path,
pkg_name,
tiny_dir = file.path(pkg_source_path, "inst", "tinytest"),
at_home = TRUE,
color = FALSE
)
pkg_source_path |
Character scalar. Path to the package source root. |
pkg_name |
Character scalar. Package name (as in |
tiny_dir |
Optional override for the tinytest directory. Defaults
to |
at_home |
Logical; passed to |
color |
Logical; color output from tinytest. Defaults to |
Intended for **source-tree** coverage of tinytest suites:
The package namespace is traced via covr::trace_environment()
so that calls made by tests to package functions are recorded
for coverage.
NOT_CRAN is set to "true" during the run (restored on exit)
so tinytest at_home() logic treats the run as local.
Test files are driven by tinytest::run_test_dir() from
file.path(pkg_source_path, "inst", "tinytest").
Coverage is built from covr's counters using covr::as_coverage().
Preconditions
The package under test should already be loaded (e.g.,
pkgload::load_all(pkg_source_path)), so that
asNamespace(pkg_name) exists and reflects the current source.
The directory inst/tinytest must exist and contain test files.
A list with components:
An object of class "coverage" (from covr).
The tinytests object returned by tinytest.
Other nstf_utility:
check_covr_skip_testit(),
create_base_tests_coverage(),
create_nstf_covr_list(),
get_nstf_test_path(),
get_source_test_mapping_nstf(),
restrict_test_paths_to_framework(),
run_covr_skip_nstf()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.