This output is created by covrpage.

library(covr     , warn.conflicts = FALSE , quietly = TRUE)
library(knitr    , warn.conflicts = FALSE , quietly = TRUE)
testthat::set_max_fails(Inf)

test_x    <- testthat::test_check(
  package         = covrpage::package_name(path = '..'),
  reporter        = testthat::default_reporter(),
  stop_on_failure = FALSE,
  stop_on_warning = FALSE
)

skip <- length(test_x)>0
failed <- FALSE
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 <- any(test_x_long$status%in%c('ERROR','FAILED'))
test_skip <- test_m

Coverage

Coverage summary is created using the covr package.

if(any(grepl(covrpage::package_name(path = '..'),loadedNamespaces())))
  unloadNamespace(covrpage::package_name(path = '..'))
cvr <- covrpage::coverage_skip(test_path = '../tests/testthat', test_skip = test_skip)
cat(sprintf('%s Not All Tests Passed\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[[platform()]][['WARNING']]))
cvr |>
  covrpage::covr_summary(failed = failed,package = package_name(path = '..')) |>
  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(length(names(test_x_long))>0){
if('icon'%in%names(test_x_long)){
  emos <- covrpage:::emos[[covrpage:::platform()]]
  knitr::kable(t(c('Failed' = emos[['FAILED']],'Warning' = emos[['WARNING']], 'Skipped' = 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))



metrumresearchgroup/covrpage documentation built on Feb. 25, 2023, 2:22 p.m.