View source: R/run_covr_skip_stf.R
| create_coverage_skip_stf | R Documentation |
This function runs coverage analysis using 'covr' while temporarily commenting out known failing tests. It is intended for situations where specific tests must be skipped (e.g., due to upstream bugs or known failures) so that coverage can still be computed on remaining tests.
create_coverage_skip_stf(
pkg_source_path,
pkg,
test_path = "tests/testthat",
test_skip,
test_map,
cov_env
)
pkg_source_path |
Character. Path to the root of the package source. |
pkg |
Character. Name of the package being tested. |
test_path |
Character. Path to the test directory. Defaults to ''tests/testthat''. |
test_skip |
Data frame. Mapping of failing tests, typically containing columns 'file', 'line1', and 'line2'. Each row describes a span of lines that should be commented out before running coverage. |
test_map |
Data frame. Mapping of all tests within the package (used for diagnostic messaging and consistency checks). |
cov_env |
Environment that holds the temporary coverage workspace and shared state for the run. |
The function:
sets up a temporary coverage environment,
identifies lines to skip based on 'test_skip',
comments out those test lines,
runs 'covr::environment_coverage()', and
restores the original test files on exit.
If 'test_skip' is 'NULL', failing tests must be detected elsewhere before calling this function. This function does not perform test detection; it only applies the skip mappings supplied in 'test_skip'.
A coverage object (a list) returned by 'covr::environment_coverage()', filtered to remove problematic entries. If coverage fails, the function returns 'NULL'.
The returned structure typically contains:
Name of the file being measured.
Function-level coverage information.
Line-by-line execution counts.
Source references extracted for coverage.
test_dir,
package_coverage,
environment_coverage
Other stf_utility:
map_test(),
map_tests_stf(),
nest_test(),
run_covr_skip_stf()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.