devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Support for test_active_file in vscode

Open ghar1821 opened this issue 5 months ago • 1 comments

I'm moving away from rstudio towards vscode. Unfortunately, function like test_active_file still doesn't work on vscode. I guess it is because it relies on rstudioapi to detect what file is active.

This is the error message if i try to run test_active_file:

Error in rstudioapi::executeCommand("activateConsole", quiet = TRUE) : 
  This {rstudioapi} function is not currently implemented for VSCode.

The alternative is to use test_file, but even then the error persist. Plus, it was already deprecated post 2.4.0.

Happy to consider alternative way of running a test on just a single file that does not rely on rstudio.

ghar1821 avatar Aug 13 '25 00:08 ghar1821

The testing situation in Positron is quite nice. If you haven't heard of Positron here is more info:

https://positron.posit.co/

In the R Console of Positron, test_active_file() "just works" and there is also a new test explorer, which provides another way to run the tests in a single file (or to run a single test).

jennybc avatar Aug 13 '25 20:08 jennybc