This output is created by covrpage.

library(covr     , warn.conflicts = FALSE , quietly = TRUE)
library(knitr    , warn.conflicts = FALSE , quietly = TRUE)
library(magrittr , warn.conflicts = FALSE , quietly = TRUE)
#test_x <- testthat::test_dir('testthat')
this_pkg <- basename(normalizePath('..'))
test_x <- testthat::test_check(this_pkg,reporter = testthat::default_reporter(),stop_on_failure = FALSE,stop_on_warning = FALSE)

skip <- length(test_x)>0
test_m <- covrpage::map_testthat('testthat')
test_x_short <- test_x%>%
  covrpage::testthat_summary(type='short')

test_x_long <- test_x%>%
  covrpage::testthat_summary(type='long')
test_skip <- test_x_long[test_x_long$status!='PASS',c('file','test')]

test_skip$file <- gsub('#(.*?)$','',basename(test_skip$file))

test_skip <- merge(test_skip,test_m)

failed <- nrow(test_skip)>0
test_skip <- test_m

Coverage

Coverage summary is created using the covr package.

cvr <- covrpage::coverage_skip(test_path = '../tests/testthat', test_skip = test_skip)
cat(sprintf('%s Tests Failed\n  Coverage statistics are approximations of the non-failing tests.\n  Use with caution\n\n For further investigation check in testthat summary tables.',covrpage:::emos[['WARNING']]))
cvr%>%
  covrpage::covr_summary(failed = failed)%>%
  knitr::kable(digits = 2,
             col.names = c('Object','Coverage (%)'),align = c('l','c'))


Unit Tests

Unit Test summary is created using the testthat package.

cat('All tests were skipped')
test_x_short%>%
  knitr::kable()

r sprintf('%s',if(skip) test_details(test_x_short))> Show Detailed Test Results

cat('All tests were skipped')
test_x_long%>%
  knitr::kable()
if(names(test_x_long)[1]=='icon')
  knitr::kable(t(c('Failed' = covrpage:::emos[['FAILED']],'Warning' = covrpage:::emos[['WARNING']], 'Skipped' = covrpage:::emos[['SKIPPED']])))

Session Info

x <- covrpage:::sinfo()

x$info%>%
  knitr::kable()

x$pkgs%>%
  knitr::kable()

r sprintf('<!--- Final Status : %s --->', test_to_badge(test_x_short))



jonocarroll/importAs documentation built on May 15, 2019, 1:16 p.m.