-
Notifications
You must be signed in to change notification settings - Fork 92
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
R: Test explorer improvements #1808
Comments
When there is no current testing view, we currently see this: If the workspace is an R package, I think we'd like to not see the contribution from the positron-python package here: but I think that would require some work/coordination in positron that provides the positron R and Python extensions some notion of "this is an R project" vs. "this is a Python" project, for use in the This is now #2637. |
Update: done in #2488 |
readr uses testthat but does not have a positron/extensions/positron-r/src/testing/watcher.ts Lines 82 to 87 in 9b349bd
Despite this fact, the test explorer still works in readr. This is nice, I guess, but is also somewhat surprising. Rationalize that when I come back to do 👆 Now part of #2638. |
The intent already is to initialize the tree-sitter-r parser exactly once: positron/extensions/positron-r/src/testing/parser.ts Lines 84 to 86 in 9b349bd
But if the first use of the parser coincides with a full test run, and all the test files are getting parsed for the first time, it appears to effectively result in one initialization per test file:
The parsing is either happening literally in parallel or in such close succession that it is effectively in parallel. This doesn't seem to cause a user-perceivable problem, but it still seems worth correcting. Now part of #2638. |
Slack feedback from @aronatkins:
|
Something I've noticed and was also raised by @hfrick in Slack:
Update: usethis is a good example for seeing this behaviour:
Fixed in #2796 |
Another observation from @hfrick:
Later addition: @hadley is also seeing something odd with test that use backticks in their description. This is now #2639. |
Raised by @hadley in slack.
Update: "Test: Run Tests in Current File" does already work if and only if the test files have been loaded into the controller. So, if you've already interacted with the test explorer (the beaker), all is well. Takeaway: maybe my listener for test file creation and modification should expand to include opening a test file in an editor. Now part of #2638. |
Reported by @andrie in slack:
Update: this was fixed in #2194 |
This issue was, unofficially, a huge epic. Closing now that I've opened the remaining items as individual issues. |
In anticipation of merging #1763 in the near-ish future, I'm opening this issue to track TODOs that are already on my mind, but that won't be part of #1763. It's also a fine place to put feedback as people use the testing feature.
When our posture towards multi-root workspaces matures, revisit handling of that in the test explorer. The current code does (sort of) work with a multi-root, multi-package workspace, but I've made no special effort to, e.g., clearly delineate the tests from the different packages. If we decide to support this officially, I suspect we should introduce one more level in the test hierarchy: instead of test file > test case, do package > test file > test case.This additional level of hierarchy may also be important for rationalizing the way we run the entire test suite even when working with a workspace that is a single package (see Adapt vscode-r-test-adapter #1763 (comment)).OTOH I suspect, even if we support multi-root workspaces, we will decide that only 1 package can be active as a target for package-development tasks. Update: I have definitely decided that the test explorer should be single-package only for now and probably forever. I have also concluded it is untenable to introduce a whole package as a concrete test item.
When we develop an official notion of project type, this code should check for a package and early exit if not a package. If the project is a package, I would expect to receive metadata, such as the package name and its top-level root directory (which is often the workspace folder, but not always). This could then be incorporated in
TestingTools
, making that info available to lower-level functions in the testing facility, and removing the need for some janky filepath operations. Now done in Second wave of R test explorer improvement (eg better "run all tests") #1894, at least at a "first pass" level.Revisit the construction of the ID for a
testItem
that is a file. Feels like it should share a prefix/stem with the ID for atestItem
that is a test case within the file. Done in Second wave of R test explorer improvement (eg better "run all tests") #1894.Rebuild
tree-sitter-r.wasm
from the same grammar used in ARK. Adapt parsing code accordingly. This is now Updatetree-sitter-r.wasm
in positron-r #2632.Call
match.call()
ontest_that()
calls to truly resolvedesc
vscode
? This is now Usematch.call()
when parsing test files and finding the test identifier (desc
) #2633.Level up the
describe()
treatment once testthat supports running a singledescribe()
. Update: happened in Support running a singledescribe()
test r-lib/testthat#1903. This is now Provide more support fordescribe()
tests in the test explorer #2634.Switch to more general machinery for checking the presence and version of necessary R packages, once that exists.
See if we can make single clicks on a test file or a test case do something more immediate. More details in https://github.com/posit-dev/positron/pull/1763/files#r1389563485. Preliminary research suggests the testing API does not support this, but co-pilot was able to suggest a workaround: set a flag in
createRunProfile()
that helps theresolveHandler()
distinguish whether it was called due to a test run request or for some other reason (presumably mouse click?). Haven't tried that yet. Part of UI improvements for R test explorer #2636 now.Improve display of test failures. See https://github.com/posit-dev/positron/pull/1763/files#r1389571071 and https://github.com/posit-dev/positron/pull/1763/files#r1389572783 and https://github.com/posit-dev/positron/pull/1763/files#r1389604417. Part of UI improvements for R test explorer #2636 now.
The Debug Tests button isn't terribly useful in R, where we can walk through our tests easily in the REPL. Can I remove the button or otherwise mitigate its presence? See https://github.com/posit-dev/positron/pull/1763/files#r1389605966. Part of UI improvements for R test explorer #2636 now.
It would be nice to be able to execute clickable suggestions, e.g.
testthat::snapshot_accept()
. See https://github.com/posit-dev/positron/pull/1763/files#r1389618442. Part of UI improvements for R test explorer #2636 now.There should be no need to explicitly runNot even sure what I meant by this any more. We do calldevtools::load_all()
. I think every test-running function we call handle this internally. Check this and, if true, edit the command run in the child process.load_all()
on the embedded test reporter package, but that is also necessary.The text was updated successfully, but these errors were encountered: