I.e. nice clean output with no messages about changing project directories. How can I achieve the same result? Is there some kind of verbosity option?
Yes! There's options(usethis.quiet = TRUE)
but from reading that same page I'm not sure why wrapping the code in usethis::ui_silence()
does not work. In usethis tests the option is used cf setup file.
Looking into usethis testing infrastructure is also what I would have done so I have no further tip except reading the testthat "Test fixtures" vignette if you haven't yet -- you'll have encountered most of it in usethis tests. (reg setup vs helper files for testthat see summary table in a blog post of mine if helpful)