testthat
testthat copied to clipboard
Accurate position of messages in test log
Follow-up to this
https://github.com/r-lib/testthat/issues/1459
Sometimes there are messages in tests, but they can be hard to locate, could there be an handling similar to how warnings are handled?
Warnings are easy to locate to go silence and / or add expect_warning()
/ suppressWarnings()
, but you have to run tests one by one to find the source of a message.
Is there a way testthat could make that easier by giving the source of messages?
Possibly that to avoid messing with CI, and it is probably not that useful in CI, maybe just in Build Pane or in interactive sessions, where cli hyperlinks are quite handy to locate warnings!
Edit: maybe adding to tests/testthat/setup.R
would work?
# Only on testing (not R CMD CHECK)
if (!on_ci() && !interactive() && Sys.getenv("RSTUDIO", "true") == "true" && !Sys.getenv("R_CMD_CHECK", "true")) {
cli::cli_inform("Activated global entrace")
rlang::global_entrace()
}
or make them less prominent with `col_silver()`?