Skip to content

Document outline for test scripts #11082

Closed

Description

@maelle

In package projects, for test files under tests/testthat, it might be nice if the document outline / table of contents treated the test_that() call as headers, so one could easily navigate from one test to the other, or see at a glance all the test names in a test file.

E.g.

test_that("bla() works", {})

test_that("bla() errors well", {})

test_that("bla() when blop not installed", {})

would generate an outline to go directly to "bla() works"/"bla() errors well"/"bla() when blop not installed".

Activity

  1. kevinushey commented on Apr 28, 2022

    @kevinushey
    Collaborator

    FYI for @romainfrancois: you probably want to start looking around in

    this.$buildScopeTreeUpToRow = function(maxRow)
    . (The function is unfortunately kind of a long mess, but that's where the scope tree structure is built)

  2. romainfrancois commented on Apr 28, 2022

    @romainfrancois
    Contributor

    Not exactly this request, but perhaps test_that() calls can be source items so that e.g. fuzzy finder recognizes them.

  3. romainfrancois commented on May 7, 2022

    @romainfrancois
    Contributor

    QA: in a package that has unit tests, the outline should show them:

    image

    image

    Also, the fuzzy finder indexes them if the search term starts with "t ":

    image

  4. jgutman commented on May 9, 2022

    @jgutman
    Contributor

    Verified in 2022.6.0.374 RStudio Desktop running on Mac OS 12.3.1

  5. jgutman commented on May 9, 2022

    @jgutman
    Contributor

    Great feature! Thanks for the suggestion.

  6. maelle commented on May 9, 2022

    @maelle
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions