Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# reactlog (development)

- `reactlog_show()` now uses `shiny::reactlog()` as its default `log`, so `reactlog_show()` works with no arguments after running an app (#91)

- Migrated project license from GPL-3 to the MIT License.

- Documented that `reactlog_show()` passes `...` on to `reactlog_render()`, so `session_token` can be set from `reactlog_show()`. The docs used to say `...` was ignored (#120)
Expand Down
7 changes: 4 additions & 3 deletions R/showReactLog.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
#' enabled, it's possible for any user of your app to see at least some
#' of the source code of your reactive expressions and observers.
#'
#' @param log Log produced by shiny to be processed
#' @param log Log produced by shiny to be processed. Defaults to
#' [shiny::reactlog()], the log recorded in the current R session.
#' @param time A boolean that specifies whether or not to display the
#' time that each reactive takes to calculate a result.
#' @param ... Arguments passed on to `reactlog_render()`, such as `session_token`.
Expand All @@ -56,10 +57,10 @@
#' runApp(app)
#'
#' # once app has closed, display reactlog
#' shiny::reactlogShow()
#' reactlog_show()
#' }

reactlog_show <- function(log, time = TRUE, ...) {
reactlog_show <- function(log = shiny::reactlog(), time = TRUE, ...) {
file <- reactlog_render(log, time = as.logical(time), ...)
utils::browseURL(file)
}
Expand Down
7 changes: 4 additions & 3 deletions man/reactlog_show.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tests/testthat/test-render.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,18 @@ test_that("reactlog_show() passes ... to reactlog_render()", {
# no message match: "unused argument" is translated in other locales
expect_error(reactlog_show(log, foo = 1))
})

test_that("reactlog_show() defaults to shiny::reactlog()", {
skip_if_not_installed("shiny")
called <- FALSE
local_mocked_bindings(
reactlog = function() {
called <<- TRUE
structure(list(), version = "1")
},
.package = "shiny"
)
local_mocked_bindings(browseURL = function(...) NULL, .package = "utils")
reactlog_show()
expect_true(called)
})
Loading