-
Notifications
You must be signed in to change notification settings - Fork 316
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
Exit code once a test fails #515
Comments
@jimhester do you have any smart way to handle this? |
Oh, now I remember: our expectation is that you're running the tests in a such a way that R quits when you get an error: R -e "stop('error')"
echo $? |
@lc0 More specifically If you are trying to run tests in a CI environment like Jenkins you should probably be using |
In case it's useful to others searching... I wanted to see more verbose output in CI than R CMD check "${PKG_TARBALL}" --as-cran --no-tests
Rscript -e 'res=devtools::test(reporter="summary");df=as.data.frame(res);if(sum(df$failed) > 0 || any(df$error)) {q(status=1)}' As far as I can tell, that has the added benefit of running all tests, including any in Part of the second line is based on |
Bumping, it's a little surprising that |
If you want to make sure there are no ERRORs, WARNINGs, or NOTEs, this command is also something that could be used for CI: Rscript -e 'stopifnot(all(sapply(devtools::check(), length) == 0L))' Or if you just want to catch ERRORs: Rscript -e 'stopifnot(length(devtools::check()$errors) == 0L)' |
|
There's also a "stop_on_failure" flag in |
It always returns 0, even if a test fails. r-lib/testthat#515 This will also reduce the installation time.
It always returns 0, even if a test fails. r-lib/testthat#515 This will also reduce the installation time.
`devtools::test`'s exit code always 0 (r-lib/testthat#515). So I shoud use `testthat::test("tests")` here instead. And, `force=TRUE` should be set to `remotes::install_local`.
Hey guys,
Thank you for the awesome package! Although, I have a couple questions:
So I have
Where I run my tests, a couple of these fail:
Unfortunately the exit code, still 0
docker@0131698d01ec:/# echo $? 0
Any suggestions, how to make testthat return the exit code when any of the test fail?
As a side question: does testthat by any chance supports XUnit export? I do use Continuous Integration and would be quite convenient to export results of tests, so it could be used for other purposes.
Thanks for the help!
The text was updated successfully, but these errors were encountered: