Skip to content

Commit

Permalink
Avoid looking at the RStudio state when running tests inside of it.
Browse files Browse the repository at this point in the history
  • Loading branch information
plietar committed Jan 18, 2024
1 parent ceb0d66 commit 410234f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/interactive.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ is_plausible_orderly_report <- function(path) {
}

rstudio_get_current_active_editor_path <- function() {
if (rstudioapi::isAvailable()) {
# Avoid looking at the RStudio state when running tests inside of it.
# https://github.com/r-lib/testthat/blob/fe50a222c62cc8733b397690caf3b2a95856f902/R/test-env.R#L20
testing <- identical(Sys.getenv("TESTTHAT"), "true")
if (!testing && rstudioapi::isAvailable()) {
rstudioapi::getSourceEditorContext()$path
} else {
NULL
Expand Down

0 comments on commit 410234f

Please sign in to comment.