Skip to content

Conversation

@radbasa
Copy link
Collaborator

@radbasa radbasa commented Feb 6, 2023

Because of this Appsilon/rhino#440, the recursive rhino::test_r() PR Appsilon/rhino#433 may not be sustainable. It works outside of testthat. To provide an experience similar to testthat::test_dir(), I just copied the stdout prompts of ProgressReporter. This cannot accommodate a specific reporter like JunitReporter or any other reporters.

This is a proposed solution inside testthat.

How to test

Build and install on local. Set up an R project with nested test directories.

  1. testthat::test_dir("tests/testthat/") will work as before. Just one single directory, and with the default reporter.
  2. testthat::test_dir("tests/testthat/", recursive = TRUE) to run all of the test scripts in all directories in tests/testthat. testthat::test_dir() will only see scripts with the ^test.*\\.[rR]$ filename.
  3. testthat::test_dir("tests/testthat/", recursive = TRUE, reporter = "Junit") the same as (2) above, but display Junit format.

Unit tests

  1. testthat::test_dir("tests/testthat/") will show test-files has no failures.
  2. testthat::test_file("tests/testthat/test-test-files.R") should pass.
  3. devtools::test() throws an error even on main branch: Error in teardown_env()`.

@radbasa radbasa self-assigned this Feb 6, 2023
@radbasa radbasa merged commit 1b9af10 into recursive-test-dir Aug 29, 2023
radbasa added a commit that referenced this pull request Aug 29, 2023
* give a recursive directories option

* unit test for recursive = TRUE
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.

3 participants