View source: R/run_covr_skip_stf.R
| run_covr_skip_stf | R Documentation |
This function runs testthat-based test execution and code coverage while identifying and skipping failing tests. It is designed for use with standard testing frameworks (STF), primarily 'testthat', and supports automated skip mapping to enable coverage calculation even when some tests fail.
run_covr_skip_stf(pkg_source_path, test_pkg_data, cov_env)
pkg_source_path |
Character. Path to the root directory of the package source. |
test_pkg_data |
List. Output from
|
cov_env |
Environment that holds the temporary coverage workspace and shared state for the run. This must be an environment created by 'initialise_covr_env()', which sets 'cov_env$work_dir' to a unique subdirectory under 'tempdir()'. 'run_covr_skip_stf()' will not create or modify 'cov_env' beyond reading helpers into it; all file outputs produced by downstream helpers are expected to be written under ‘cov_env$work_dir' (never to the package directory or the user’s home). The caller is responsible for lifecycle management; register 'on.exit(cleanup_and_return_null(env = cov_env), add = TRUE)' in the calling scope to ensure bindings and the temporary workspace are cleaned up even on error. |
The function:
executes tests and collects detailed test results,
identifies failing, erroring, or skipped tests,
constructs skip maps to temporarily comment out failing test lines,
computes coverage on the remaining tests, and
returns a combined object containing coverage and test summaries.
A named list containing coverage results and test diagnostics. The structure includes:
Numeric. Overall coverage percentage.
A nested list with file-level coverage, errors, and notes.
Long-format test results including PASS/FAIL/ERROR/SKIPPED.
A data frame describing test lines skipped during coverage, if applicable.
If no tests fail, the returned list describes full coverage based on
unskipped tests. If no valid STF test directory is found, an empty coverage
object is returned via create_empty_covr_list().
Other stf_utility:
create_coverage_skip_stf(),
map_test(),
map_tests_stf(),
nest_test()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.