Skip to content
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

Add stop_on_failure argument to test_file #968

Closed
vspinu opened this issue Nov 19, 2019 · 5 comments
Closed

Add stop_on_failure argument to test_file #968

vspinu opened this issue Nov 19, 2019 · 5 comments
Labels
feature a feature request or enhancement

Comments

@vspinu
Copy link
Contributor

vspinu commented Nov 19, 2019

My use case is the same as in #515. I want to be able to get the non-0 exit value from test_file.

It's a bit strange that test_dir, test_check and the internal test_files accept the stop_on_failure, but the workhorse test_file doesn't.

The simplest way to address this might be to export test_files.

@DDorch
Copy link

DDorch commented Dec 2, 2019

Exporting test_files could also be a way to solve the feature #916 :)

@jimhester
Copy link
Member

I the meantime testthat::test_file("tests/testthat.R", reporter = c("summary", "fail")) will do this without any code changes to testthat.

@hadley hadley added the feature a feature request or enhancement label Apr 13, 2020
@hadley
Copy link
Member

hadley commented Jun 16, 2020

It might make sense to export test_files() and then push people towards using that. test_files() really seems like the natural primitive here; test_file() is just a special case with one path.

Something about the whole structure of test-files.R and test-directory.R feels a bit off, and I think would benefit from refactoring.

@hadley
Copy link
Member

hadley commented Jul 7, 2020

Currently test_file() is half an internal helper that's used by test_dir() and half an equivalent of test_dir() for a single file. It does neither thing well: as an internal helper, it could assume that more setup is done in test_files(), and as a runner for a single file, it fails to run setup and teardown code.

@hadley
Copy link
Member

hadley commented Jul 7, 2020

It turns out that test_file() had one additional use — it was also used for testing. So it really had 3 uses, and was optimised for none of them.

@hadley hadley closed this as completed in c47d6ad Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants