Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
R/Shiny: el intérprete JS de Shinytest no puede funcionar con Promise y tiene JS Standart antiguo

Quiero usar el paquete R shinytest para probar mi aplicación R/Shiny. Ahora, me enfrento a un problema extraño tras otro. Parece que el intérprete de JavaScript de "shinytest" o que se ejecuta en segundo plano no puede funcionar con Promise , ni cosas simples como 'a'.startsWith('a') no funcionan.

¿Puedo cambiar el backend de shinytest o puedo agregar de alguna manera las funciones de JavaScript que faltan?

A continuación, verá un ejemplo mínimo, la aplicación en sí no tiene significado, pero la executing Javascript dentro del conjunto de pruebas muestra que las llamadas simples fallan.

Para ejecutar el ejemplo, es posible que deba instalar el paquete "globals". Como renv::install("globals") .

Ejemplo:

 library(shiny) library(shinytest) # you may need to run: # renv::install("globals") ui <- fluidPage( titlePanel("Hello Shiny!"), sidebarLayout( sidebarPanel(), mainPanel() ) ) # Define server logic required to draw a histogram ---- server <- function(input, output) {} # See above for the definitions of ui and server app <- shinyApp(ui = ui, server = server) testapp <- ShinyDriver$new(app, debug="all") testapp$executeScript("console.log('Hello')") print(testapp$getDebugLog("browser")) testapp$executeScript("console.log('a'.startsWith('b'))") print(testapp$getDebugLog("browser")) testapp$executeScript("console.log(Promise)") print(testapp$getDebugLog("browser"))

Las últimas declaraciones print siempre deben devolver una salida correcta. Pero los mensajes de error son:

 B/I 12:26:40.26 Hello (:)> testapp$executeScript("console.log('a'.startsWith('b'))") Error in session_makeRequest(self, private, endpoint, data, params, headers) : undefined is not a function (evaluating ''a'.startsWith('b')') > print(testapp$getDebugLog("browser")) > testapp$executeScript("console.log(Promise)") Error in session_makeRequest(self, private, endpoint, data, params, headers) : Can't find variable: Promise

Esto significa que Promises no está disponible en este paquete shinytest .

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!