Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several Feature Suggestions #28

Open
katrinabrock opened this issue Aug 22, 2024 · 3 comments
Open

Several Feature Suggestions #28

katrinabrock opened this issue Aug 22, 2024 · 3 comments

Comments

@katrinabrock
Copy link

Hi,

Thanks for making this extension. It's really helpful to leverage VSCode's testing UI with R. Here are some ideas

These might exist already, but I haven't found them:

  • Some way to view non-result output. Basically I'm only seeing the error message when the tests fails, not any print messages etc. generated by the test.
  • Way to view backtrace on failure.
  • Option to set environment variables and/or options for the test run. In particular, it would be nice to set how many tests testthat runs in parallel.

Bigger extensions:

  • Integration with R VSCode debugger so that run-with debug is possible
  • Integration with test coverage

Probably these are things you have thought of as well. I'm mostly curious to know whether they are in line with your vision and what you think the relative effort would be among them. I may be willing to do a bit of work on it if there is one that is relatively low hanging and more of an R than JS/typescript project.

I've also had some issues that might be bugs, but I will try to pull together an MRE before posting about them.

Thanks again!
Brock

@meakbiyik
Copy link
Owner

Hey! Thanks a lot for the recommendations :) Interesting, I think it should be possible to view the non-result output in the output tab of VSCode, but I haven't coded in R in ages, so I need to double-check.

The environment variables part is a very good and straightforward idea, following the pattern of other extensions, e.g., Go. It should be implemented.

Debugger and test coverage would also certainly be charming, although as you noted, they are quite large efforts. I don't know whether the test adapter base that VSCode exposes easily extends to debuggers, and even then how we would connect it to R's adapter.

These days, I don't code in R much and am otherwise quite busy, so I am mostly fixing bugs whenever they come along to the repo. I will go over the features you recommended in the next couple of days and give a basic outline for each, so that you (or any others) can see if there's a way to give it a try. At first glance, the environment variable part should be the easiest; it just requires registering an extension setting to VSCode (similar to RscriptPath that this extension already registers) and using it in the test calls.

If you want to give any of them a try, I would be happy to assist, limited on the code side but surely on the ideas! Thanks again for your detailed write-up. I am happy to see other R people using VSCode as well :)

@katrinabrock
Copy link
Author

Interesting, I think it should be possible to view the non-result output in the output tab of VSCode

When I used it on my real project the reporter worked, but I didn't see any output in the output tab. Trying to make an MRE, by putting print statements in the tests themselves, the reporter totally failed. Reporter here: #30

I'm pretty sure the full backtrace is not getting passed from VSCode reporter methods in any way at all.


Another suggestion... I believe you are passing the location of the failure itself back from R to the typescript, but then ignore it and put the error at the start of the failing test rather than within the test where the failure actually occurred. Especially for failed expectations, it might be good to put it on the line of the expectation, rather than the test.

e.g. here:
image
put the error on line 8 instead of line 7 where it is currently.

@katrinabrock
Copy link
Author

I am happy to see other R people using VSCode as well :)

The VSCode Debugger Extension has 428K downloads and the General R Lang VSCode Extension has 1.9 million....so I think there is an audience for this kind of extension. I haven't checked yet whether Positron has test reporter functionality like this.

I think the R folks who are inclined to use VSCode are also the type to use tinytest instead of test that so there might be folks interested in building VSCode test reporter support for that at some point. (As far as I can tell, it doesn't currently exist.) Not sure if it would make more sense to make a separate extension for that or enhance this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants