Give test_dir() a recursive option#2
Merged
radbasa merged 2 commits intorecursive-test-dirfrom Aug 29, 2023
Merged
Conversation
jakubnowicki
approved these changes
Aug 23, 2023
radbasa
added a commit
that referenced
this pull request
Aug 29, 2023
* give a recursive directories option * unit test for recursive = TRUE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because of this Appsilon/rhino#440, the recursive
rhino::test_r()PR Appsilon/rhino#433 may not be sustainable. It works outside oftestthat. To provide an experience similar totestthat::test_dir(), I just copied the stdout prompts ofProgressReporter. This cannot accommodate a specific reporter likeJunitReporteror 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.
testthat::test_dir("tests/testthat/")will work as before. Just one single directory, and with the default reporter.testthat::test_dir("tests/testthat/", recursive = TRUE)to run all of the test scripts in all directories intests/testthat.testthat::test_dir()will only see scripts with the^test.*\\.[rR]$filename.Unit tests
testthat::test_dir("tests/testthat/")will showtest-fileshas no failures.testthat::test_file("tests/testthat/test-test-files.R")should pass.devtools::test()throws an error even onmainbranch:Error inteardown_env()`.