Skip to content

Improve desc_filter so you can run single BDD-style tests (aka run just a single it test from describe) #2077

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kubajal
Copy link

@kubajal kubajal commented Apr 7, 2025

Currently, desc_filter let's you run either a single test_that or a single describe suite of tests. This PR adds support for selecting just a single it(...) test from a describe suite.
So e.g. running testthat::test_file("tests.R", desc="level 0&&&level 1 A")

# tests.R
describe("level 0", {
  it("level 1 A", {}),
  it("level 1 B", {})
})

effectively triggers just

describe("level 0", {
  it("level 1 A", {}),
})

@kubajal kubajal force-pushed the feature/desc_filter_improvement branch from 4af569a to 84dc618 Compare April 8, 2025 19:57
@kubajal
Copy link
Author

kubajal commented Apr 9, 2025

The error on Ubuntu is not related to my change and has been observed in other PRs too, e.g. #2061:

Error: Error: running the tests in ‘testthat.R’ failed
Error: Error: Failure in `/home/runner/work/_temp/package/testthat/testthat-tests/testthat.Rout.fail`
r ('test-local.R:38:3'): can override translation of error messages ─────
<notSubsettableError/error/condition>
Error in `mean[[1]]`: object of type 'closure' is not subsettable
Backtrace:

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

Successfully merging this pull request may close these issues.

1 participant