0

I want to write a unit test for a shiny module using testthat package. I am following the instruction of mastering Shiny book. It has written in this book that first we should create a test file using usethis::use_test() in the R console.

But when I run this code, I get this error:

Error: Path 'my R file path' does not appear to be inside a project or package.

I appreciate any help everybody can provide.

Andy Baxter
  • 5,833
  • 1
  • 8
  • 22
  • Please provide enough code so others can better understand or reproduce the problem. – Community Nov 28 '22 at 08:30
  • it needs to have one "RProj" file in the output of `list.files()` – Bertil Baron Nov 28 '22 at 11:09
  • @BertilBaron . My R files weren't in an R project, so I created an R project for them, and now I have an RProj file in the output of `list.files()`. But now, when I run `usethis::use_test()` I get this error: `Error: Open file must be in the 'R' directory of the active package. * Actual path: 'app.R'` – Maryam Momeni Nov 28 '22 at 12:18

0 Answers0