Open hadley opened 1 year ago
I think the one tricky bit with with_coverage()
as you have it is making sure that the code is executed in the execution environment that has the traces.
I tried playing around with this a bit today and wasn't able the get it working with the time I allotted to the task, I think there is a bit of a chicken and egg problem with defining the test environment and instrumenting it for coverage. If you can work out a POC that uses test_file()
or with_coverage()
that would fit your needs I would be happy to merge it.
devtools::test_coverage_active_file()
is proving increasingly useful in our workflow where there's (in most cases) there's a one-to-one relationship between files inR/
and intests/testthat/
. However, because covrenvironment_coverage()
callssys.source()
rather thantestthat::test_file()
we have to recreate much of thetest_file()
infrastructure intest_coverage_active_file()
. And that's fragile and continues to cause problems (see https://github.com/r-lib/devtools/pull/2537 for a recent example).Could we have a variant of
environment_coverage()
(either a new argument or a new function) that'd calltestthat::test_file()
?Or maybe something like this?