Repo with reprex: https://github.com/etiennebacher/bug.testthat.coverage (tested in Positron and RStudio)
> packageVersion("covr")
[1] ‘3.6.5.9001’
> packageVersion("devtools")
[1] ‘2.5.2.9000’
> packageVersion("testthat")
[1] ‘3.3.2.9000’
Setup:
Bug:
- Open
tests/testthat/test-foo.R in your editor (so that it is detected as the "active file")
devtools::test() reports no issue
devtools::test_coverage_active_file() is not happy with the snapshot:
> devtools::test_coverage_active_file()
── Failure: foo ──────────────────────────────────────────────────────────────────────────────────────────
Snapshot of code has changed:
old | new
[1] Code | Code [1]
[2] f(x = logical(0)) | f(x = logical(0)) [2]
[3] Condition | Condition [3]
[4] Error in `if (x) ...`: - Error in `if (...) NULL`: [4]
[5] ! argument is of length zero | ! argument is of length zero [5]
* Run testthat::snapshot_accept("foo") to accept the change.
* Run testthat::snapshot_review("foo") to review the change.
Error:
! Test failed with 1 failure and 0 successes.
Repo with reprex: https://github.com/etiennebacher/bug.testthat.coverage (tested in Positron and RStudio)
Setup:
R/foo.R:tests/testthat/test-foo.R:tests/testthat/_snaps/foo.md:Bug:
tests/testthat/test-foo.Rin your editor (so that it is detected as the "active file")devtools::test()reports no issuedevtools::test_coverage_active_file()is not happy with the snapshot: