Closed dpprdan closed 2 years ago
This sounds like a great idea! Should the docs state this will only work with testthat? I'm not sure there are vcr users who don't use testthat, though.
Should the docs state this will only work with testthat?
I'd say the docs are pretty clear that vcr works only with assumes tests are done with testthat, see e.g. the first sentence in the Getting Started section. OTOH it doesn't hurt to mention it explicitly.
I just noticed that the README/Getting Started vignette still use
invisible(vcr::vcr_configure(
dir = "../fixtures"
))
i.e. "../fixtures"
to specify the fixtures directory instead of dir = vcr::vcr_test_path("fixtures")
as mentioned in the http-testing book.
Should we change that?
BTW, if I am right about #244, or rather that #225 wasn't caused by vcr_test_path()
- and that's a big IF - then we might be able to use a testthat::test_path()
based approach after all and drop the rprojroot dependency. (IIUC we only began fiddling with vcr_test_path()
because of #225).
This is based on multiple hunches though, so I'd go with the rprojroot::find_testthat_root_file()
for now. We will have to revisit this topic again anyway, when we want to adapt vcr for other test suites (#162).
looks good to me. I don't use vcr_test_path
so if others could please make sure to test this in their packages.
vcr_test_path()
now looks for thetestthat
dir instead oftests
, because the latter may not be present duringR CMD check
.fixtures
(or however the folder is called by the user) is then put on the same level astestthat
(instead of one level up fromtests
).fixes #242 (hopefully)