Skip to content

Integrate 'testthat' into the Tests feature for R packages #1365

Closed

Description

@jmcphers

Currently, if you have an R package and open the Testing view, it says that 'No tests have been found in the workspace', even if the workspace contains testthat tests.

image

We should:

  • Detect any testthat tests and display them in the Tests pane; support running tests, showing results, and jumping to errors
  • Have a "Configure R Tests" button that helps new users set up testthat for the first time

Activity

  1. added this to the Internal Preview milestone on Sep 21, 2023
  2. jennybc commented on Sep 22, 2023

    @jennybc
    Member

    The first groundwork for this has been laid by @juliasilge in #915. That creates the scaffold for hooking into VS Code's test UI.

    At the complete other extreme, I have standalone code that extracts the relevant test info (e.g. coordinates for test_that() calls, their descriptions) from a folder's worth of test files, using a tree-sitter-generated R parser. In a private repo: https://github.com/jennybc/treesitrrust.

    The next phase is to create the plumbing that connects those two pieces.

    Re: 'Have a "Configure R Tests" button that helps new users set up testthat for the first time'

    ☝️ if one can use R code, that is usethis::use_testthat() and, if not, then replicating that.

  3. jmcphers commented on Sep 22, 2023

    @jmcphers
    CollaboratorAuthor

    if one can use R code...

    I think it's fine to lean on R code; it'd be nicer to have our own UI but not essential. We'll need an RStudio-like mechanism for helping users get bootstrapped by installing the packages needed for this kind of functionality ("configuring R tests requires usethis and testthat, would you like to install those now?").

  4. juliasilge commented on Oct 3, 2023

    @juliasilge
    Member

    With #1445 we can now run tests in a little self-contained R session or alternatively in the console.

  5. juliasilge commented on Oct 4, 2023

    @juliasilge
    Member

    With #915 merged in, we can now move on to a next step, such as parsing the test files.

  6. self-assigned this
    on Oct 23, 2023
  7. juliasilge commented on Nov 16, 2023

    @juliasilge
    Member

    In build 1214 I see:

    • R package tests identified 🎉
    • I can click to run a test 🎉
    • the test does not run or return info to the UI about success/failure 😢

    When I click to run a test, it looks like it is going but it never finishes (will wait for minutes) or returns success/failure info to the UI.

  8. jennybc commented on Nov 16, 2023

    @jennybc
    Member

    Having experienced this myself now in build 1214, my leading hypothesis is that it's this, quoting @jmcphers:

    One thing you'll need to watch out for when you get closer to making a PR is that it can be a little tricky to get wasm files to get picked up properly when the extension is webpacked for release. You'll probably have to add it to positron-r/positron.json.

    It's clear (from logging) that the hang is at the test file parsing stage.

  9. jennybc commented on Nov 18, 2023

    @jennybc
    Member

    Oh lordy, we're back in business and I think this is fixed now in release builds. A simple fix but rather hard to divine.

  10. juliasilge commented on Nov 22, 2023

    @juliasilge
    Member

    In build 1327, I can use the testing extension for R packages. Looking so great! 🎉

    Passing tests:

    test2

    A failing test:

    test1

  11. locked as resolved and limited conversation to collaborators on Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions