Repository navigation
Closed
Description
Error:
Error in `app_initialize()`:
! `app_dir` must be a directory containing:
• an `./app.R` Shiny application
or
• a Shiny R Markdown file
• a `./server.R` Shiny server
ℹ If a Shiny R Markdown document is found, it will be the prefered document.
ℹ `./app.R` is not compatible with Shiny R Markdown files.
ℹ You can inspect the failed AppDriver object via `rlang::last_error()$app`
ℹ AppDriver logs:
{shinytest2} R info 20:31:46.75 Start AppDriver initialization
{shinytest2} R info 20:31:46.75 Starting Shiny app
{shinytest2} R info 20:31:46.75 Error while initializing AppDriver:
`app_dir` must be a directory containing:
• an `./app.R` Shiny application
or
• a Shiny R Markdown file
• a `./server.R` Shiny server
ℹ If a Shiny R Markdown document is found, it will be the prefered document.
ℹ `./app.R` is not compatible with Shiny R Markdown files.
Caused by error in `generic_abort()`:
! `app_dir` must be a directory containing:
• an `./app.R` Shiny application
or
• a Shiny R Markdown file
• a `./server.R` Shiny server
ℹ If a Shiny R Markdown document is found, it will be the prefered document.
ℹ `./app.R` is not compatible with Shiny R Markdown files.
Run `rlang::last_error()` to see where the error occurred
My app.R file is the base directory of my project, where I am running shinytest2::record_test(). My app.R file:
library(shiny)
source('./ui.R')
source('./server.R')
shinyApp(server=server, ui=ui)
I'm using v0.2.0 of shinytest2
Reacted by GitHunter0
Reacted by GitHunter0
Metadata
Metadata
Assignees
Labels
No labels
Activity
schloerke commentedon Nov 10, 2022
The check is done here:
shinytest2/R/app-driver-dir.R
Lines 49 to 65 in a928a19
I don't see why you're getting the error. Do you have a shiny rmarkdown quarto file in the same folder?
GitHunter0 commentedon Nov 10, 2022
I'm having the same issue in Windows 10, I can't find a way to use
shinytest2schloerke commentedon Nov 10, 2022
@GitHunter0 Can you provide a screen cap of your app folder contents and you running the minimal amount of code needed to produce the error? It is difficult for me to debug an error I can not reproduce locally. Thank you
GitHunter0 commentedon Nov 10, 2022
For sure @schloerke , this is my MWE for you to check:
Root project folder "shinytest2" containing:
Then I type
shinytest2::record_test(".")in the console (with the root project folder as the working directory) and get this error message:Created on 2022-11-10 by the reprex package (v2.0.1)
I appreciate if you can help, maybe it's a simple mistake.
schloerke commentedon Nov 10, 2022
Thank you!
Ah. I didn't see it earlier.
Please remove your
app.Rfile as your App logic is contained inui.R/server.R. Either useapp.rORui.R/server.R`. The error was being hit on this line of logic. We could probably have a cleaner error message.Example with an app with just a
server.Randui.R: https://github.com/rstudio/shinytest2/tree/9e5ac958dea15cd3b11123bbfb024397ae178209/tests/testthat/apps/files-server-ui(The
global.Rshould not make a difference to{shinytest2}. If it does, please let me know.)GitHunter0 commentedon Nov 10, 2022
Thank you @schloerke , now it's working as expected!