library(shiny)
library(testthat)
test_that("test ", {
withReactiveDomain(MockShinySession$new(), {
v <- reactiveVal()
v("abc")
val <- v()
expect_equal("abc", val)
})
})
Operation not allowed without an active reactive context. (You tried to do something that can only be done from inside a reactive expression or observer.)
Backtrace:
1. shiny::withReactiveDomain(...) test_integration.R:45:2
5. shiny:::v() test_integration.R:48:4
6. rv$get()
7. private$dependents$register()
8. shiny:::getCurrentContext()
9. .getReactiveEnvironment()$currentContext()
我错过了什么?如果我在R会话中执行内部块,我会得到相同的错误。