Last active
October 27, 2017 16:17
-
-
Save czeildi/76cdf40afaf2aa8616e68668ab7eb1f6 to your computer and use it in GitHub Desktop.
CI suitable test running for R project which is not a package
This file contains 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
# do not forget to set the executable bit on .git/hooks/pre-push | |
Rscript test-runner.R |
This file contains 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
suppressWarnings(source("libraries.R")) | |
invisible(sapply(list.files("src", full.names = TRUE), source)) | |
has_all_tests_passed_as_expected <- testthat::test_dir("test", reporter = testthat::SilentReporter) %>% | |
map_lgl(~ "expectation_success" %in% class(.[["results"]][[1]])) %>% | |
all() | |
if (!has_all_tests_passed_as_expected) stop("some of the tests failed") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment