Is there a possibility to set a different Sys.getenv("R_CONFIG_ACTIVE")
value when run in tests using testthat?
For example, my config.yml
might look like this:
default:
db: "my-prod.db"
test:
db: "my-test.db"
When I run config::get("db")
from a non-test environment I want to get my-prod.db
but when I use testthat::test_dir()
or devtools::test()
or shiny::runTests()
I want to get my-test.db
.
I would be able to influence this by setting Sys.setenv("R_CONFIG_ACTIVE" = "test")
.