Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accurate position of messages in test log #1950

Open
olivroy opened this issue Apr 12, 2024 · 0 comments
Open

Accurate position of messages in test log #1950

olivroy opened this issue Apr 12, 2024 · 0 comments

Comments

@olivroy
Copy link
Contributor

olivroy commented Apr 12, 2024

Follow-up to this

#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()
}
@olivroy olivroy changed the title Accurate position of messages Accurate position of messages in test log Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant