diff --git a/NAMESPACE b/NAMESPACE index 074527b..c252639 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -32,7 +32,6 @@ importFrom(cli,cli_alert_info) importFrom(cli,cli_alert_success) importFrom(cli,cli_alert_warning) importFrom(covr,package_coverage) -importFrom(covr,report) importFrom(devtools,check) importFrom(glue,glue) importFrom(magrittr,"%>%") diff --git a/R/inflate.R b/R/inflate.R index 5aff45b..ae2e44b 100644 --- a/R/inflate.R +++ b/R/inflate.R @@ -41,7 +41,7 @@ regex_example <- paste(regex_example_vec, collapse = "|") #' @importFrom utils getFromNamespace #' @importFrom glue glue #' @importFrom methods formalArgs -#' @importFrom covr package_coverage report +#' @importFrom covr package_coverage #' #' @return #' Package structure. Return path to current package. @@ -82,10 +82,6 @@ inflate <- function(pkg = ".", flat_file, clean = "ask", update_params = TRUE, codecov = FALSE, - codecov_fun = c( - "package_coverage", - "report" - ), ...) { if (!is.null(list(...)[["name"]])) { stop(paste0( @@ -371,26 +367,9 @@ inflate <- function(pkg = ".", flat_file, ) if (codecov) { - codecov_fun <- try( - match.arg( - codecov_fun, - c("package_coverage", "report"), - several.ok = FALSE - ), - silent = TRUE - ) - if (inherits(codecov_fun, "try-error")) { - cli::cli_abort("codecov_fun must be either 'package_coverage' or 'report'") - } - cli::cli_alert_info("Computing code coverage - it might take some time") - print( - get( - sprintf( - "%s", codecov_fun[1] - ) - )() + covr::package_coverage() ) } diff --git a/man/inflate.Rd b/man/inflate.Rd index 7ff32d8..f3a42c4 100644 --- a/man/inflate.Rd +++ b/man/inflate.Rd @@ -15,7 +15,6 @@ inflate( clean = "ask", update_params = TRUE, codecov = FALSE, - codecov_fun = c("package_coverage", "report"), ... ) } diff --git a/tests/testthat/test-inflate-part3.R b/tests/testthat/test-inflate-part3.R index 3b4123e..6207414 100644 --- a/tests/testthat/test-inflate-part3.R +++ b/tests/testthat/test-inflate-part3.R @@ -50,22 +50,6 @@ usethis::with_project(dummypackage, { ) }) - test_that("inflate fails if a wrong function to compute coverage is used", { - expect_error( - inflate( - pkg = dummypackage, - flat_file = dev_file1, - vignette_name = "Get started", - check = FALSE, - open_vignette = FALSE, - document = TRUE, - overwrite = "yes", - codecov = TRUE, - codecov_fun = "wrong" - ), - "codecov_fun must be either 'package_coverage' or 'report'" - ) - }) capture.output( inflate( @@ -76,15 +60,14 @@ usethis::with_project(dummypackage, { open_vignette = FALSE, document = TRUE, overwrite = "yes", - codecov = TRUE, - codecov_fun = "package_coverage" + codecov = TRUE ), file = console_output_file, type = "message" ) - test_that("inflate outputs compute codecov if asked and if codecov_fun = package_coverage", { + test_that("inflate outputs compute codecov if asked", { res <- readLines(console_output_file) expect_true( @@ -129,36 +112,6 @@ usethis::with_project(dummypackage, { file = console_output_file, type = "message" ) - - - test_that("inflate does not output compute codecov if asked and if codecov_fun = report", { - res <- readLines(console_output_file) - - expect_true( - any(grepl( - pattern = "Computing code coverage - it might take some time", - x = res - )) - ) - - expect_false( - any(grepl( - pattern = "R/flat1_rmd.R: 0.00%", - x = res - )) - ) - - - expect_false( - any(grepl( - pattern = paste( - basename(dummypackage), - "Coverage: 0.00%" - ), - x = res - )) - ) - }) }) unlink(console_output_file)