run_covr_skip_runit_nstf: Run coverage with skip detection for RUnit and Bioconductor...

View source: R/run_covr_skip_runit_nstf.R

run_covr_skip_runit_nstfR Documentation

Run coverage with skip detection for RUnit and Bioconductor RUnit-based packages

Description

'run_covr_skip_runit_nstf()' orchestrates coverage for packages using the Bioconductor **RUnit** layout, such as **BiocGenerics** and packages that store tests in 'inst/unitTests' or ship a 'tests/run_unitTests.R' wrapper.

Usage

run_covr_skip_runit_nstf(
  pkg_source_path,
  test_pkg_data,
  cov_env,
  framework = NULL
)

Arguments

pkg_source_path

Character scalar. Path to the root of the package source.

test_pkg_data

A list or environment with test metadata (e.g., fields like 'bioc_run_ut_path' (path to 'tests/run_unitTests.R', if present), 'has_BioG_test' (logical flag), etc.).

cov_env

Environment that holds the temporary coverage workspace and shared state for the run.

framework

Optional character. When provided (e.g. from run_one_framework), restricts test paths to the framework-specific directory. Use when a package has multiple frameworks (e.g. testthat + testit) to avoid mixing paths across frameworks.

Details

The function: 1. Builds a source-to-test mapping (using your existing 'get_source_test_mapping_nstf()'). 2. Removes any 'run_unitTests.R' wrapper from the mapping (via 'remove_run_unitTests_mapping()'). 3. Prepares a development environment **before** running RUnit tests: - Detaches commonly attached BioC infrastructure packages ('IRanges', 'S4Vectors', 'BiocGenerics') to avoid namespace/shim conflicts. - Calls 'pkgload::load_all()' to load the package under test. - Clears 'R_TESTS' to avoid R CMD check harness interference when running RUnit programmatically. 4. Identifies problem/skip-able tests via your RUnit-aware 'check_covr_skip_nstf()' (which should use 'RUnit::runTestFile()' + 'RUnit::getErrors()' per file). 5. Builds a list of test files **under 'inst/unitTests'** excluding any that should be skipped. 6. Runs coverage with 'covr::environment_coverage()': tries 'tests/doRUnit.R' first when present (matches R CMD check for CRAN RUnit packages); falls back to a custom runner that calls 'RUnit::runTestFile()' on each test file if doRUnit.R fails or is absent.

Use this function **only** for packages that follow the Bioconductor RUnit layout: - tests are located in 'inst/unitTests/', and/or - a 'tests/run_unitTests.R' wrapper exists that calls an internal '.test()' / 'testPackage()' runner.

Value

A 'covr' coverage object on success; 'NULL' on failure (via 'cleanup_and_return_null()').

A covr coverage object, or NULL on failure.


test.assessr documentation built on July 16, 2026, 5:07 p.m.