covr icon indicating copy to clipboard operation
covr copied to clipboard

covr file_coverage with testthat expect_snapshot

Open sclewis23 opened this issue 4 years ago • 0 comments

I'm trying to get coverage report for some functions not in a package but just some script files. I'm using some testthat::expect_snapshot checks . My test are sucessful but when I try to run the code coveage it says "Can't compare snapshot to reference when testing interactively" Any work arounds to run coverage ?

library(testthat)
coverage <- covr::file_coverage(source_files = "/usrfiles/shared-projects/shannon/RENV_400_PACKAGES/TESTS/temp_fn.R",
                                test_files = "/usrfiles/shared-projects/shannon/RENV_400_PACKAGES/TESTS/test-temp_fn.R")
#> Can't compare snapshot to reference when testing interactively
#> ℹ Run `devtools::test()` or `testthat::test_file()` to see changes
#> ℹ Current value:
#> WAoAAAACAAQAAAACAwAAAAAOAAAAAUAAAAAAAAAA
#> ── Skip (test-temp_fn.R:1:1): Test snapshot function ───────────────────────────
#> Reason: empty test
covr::report(coverage)

Created on 2022-02-17 by the reprex package (v2.0.1)

sclewis23 avatar Feb 18 '22 04:02 sclewis23