I haven't found an "official" way to detect from outside if testing infrastructure is present: uses_testthat() is not exported. On the other hand, test() fails in non-interactive mode if no testing infrastructure is present. So there seems to be no way to run tests if they exist, and do nothing if they don't. Am I missing anything?
I see two solutions:
- Export
uses_testthat()
- Don't fail in
test() in non-interactive mode if no infrastructure is present.
Which is better?
I haven't found an "official" way to detect from outside if testing infrastructure is present:
uses_testthat()is not exported. On the other hand,test()fails in non-interactive mode if no testing infrastructure is present. So there seems to be no way to run tests if they exist, and do nothing if they don't. Am I missing anything?I see two solutions:
uses_testthat()test()in non-interactive mode if no infrastructure is present.Which is better?