From c45f342c04484c910a2903444dc2a84447dabcd6 Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 12 Dec 2024 12:42:41 -0500 Subject: [PATCH 1/2] Replace crayon by cli --- DESCRIPTION | 2 +- NAMESPACE | 14 +++++++------- R/app-driver-initialize.R | 2 +- R/compare-screenshot-threshold.R | 2 +- R/shinytest2-logs.R | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e9c71233..5b75e773 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,7 +26,7 @@ Imports: callr, checkmate (>= 2.0.0), chromote (>= 0.1.2), - crayon, + cli, fs, globals (>= 0.14.0), httr, diff --git a/NAMESPACE b/NAMESPACE index 2098285c..302cc1c0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,13 +16,13 @@ export(use_shinytest2) export(use_shinytest2_test) importFrom(R6,R6Class) importFrom(callr,process) -importFrom(crayon,blue) -importFrom(crayon,cyan) -importFrom(crayon,green) -importFrom(crayon,magenta) -importFrom(crayon,make_style) -importFrom(crayon,red) -importFrom(crayon,silver) +importFrom(cli,col_blue) +importFrom(cli,col_cyan) +importFrom(cli,col_green) +importFrom(cli,col_magenta) +importFrom(cli,col_red) +importFrom(cli,col_silver) +importFrom(cli,make_ansi_style) importFrom(rlang,"%||%") importFrom(rlang,":=") importFrom(rlang,list2) diff --git a/R/app-driver-initialize.R b/R/app-driver-initialize.R index 977d5d4a..8c6520bd 100644 --- a/R/app-driver-initialize.R +++ b/R/app-driver-initialize.R @@ -235,7 +235,7 @@ app_initialize <- function(self, private, ..., view = missing_arg()) { c( conditionMessage(e), "\n", - i = crayon::silver("You can inspect the failed AppDriver object via `rlang::last_error()$app`"), + i = cli::col_silver("You can inspect the failed AppDriver object via `rlang::last_error()$app`"), i = paste0("AppDriver logs:\n", logs), "\n" ), diff --git a/R/compare-screenshot-threshold.R b/R/compare-screenshot-threshold.R index c2fe2b19..4286221a 100644 --- a/R/compare-screenshot-threshold.R +++ b/R/compare-screenshot-threshold.R @@ -170,7 +170,7 @@ compare_screenshot_threshold <- function( " > `", threshold, "` (threshold)."), "*" = paste0("`old`:", old), "*" = paste0("`new`:", new), - "i" = crayon::silver("(To remove this message, increase `threshold`, or set `quiet = TRUE`)") + "i" = cli::col_silver("(To remove this message, increase `threshold`, or set `quiet = TRUE`)") )) } diff --git a/R/shinytest2-logs.R b/R/shinytest2-logs.R index e8bfb074..18245e19 100644 --- a/R/shinytest2-logs.R +++ b/R/shinytest2-logs.R @@ -5,14 +5,14 @@ print.shinytest2_log <- function(x, ...) { } #' @export -#' @importFrom crayon blue magenta cyan green red silver make_style +#' @importFrom cli col_blue col_magenta col_cyan col_green col_red col_silver make_ansi_style format.shinytest2_log <- function(x, ...) { get_color <- function(location, level) { switch(as.character(location), - shiny = switch(level, stderr = magenta, force), - chromote = switch(level, throw = red, error = red, cyan), - shinytest2 = switch(level, green) + shiny = switch(level, stderr = col_magenta, force), + chromote = switch(level, throw = col_red, error = col_red, col_cyan), + shinytest2 = switch(level, col_green) ) } From 2e6fa8af8c33b9f423cadd656384292bc778249d Mon Sep 17 00:00:00 2001 From: olivroy <52606734+olivroy@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:06:15 -0500 Subject: [PATCH 2/2] Add news --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index a744e6b7..ccb0a03b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,8 @@ * Improved the error message when an app takes too long to start up (@LouisLeNezet, #394). +* `{shinytest2}` now imports `{cli}` and no longer imports `{crayon}` (@olivroy, #399). + # shinytest2 0.3.2 ## Bug / Improvements