Skip to content

Commit

Permalink
Merge branch 'main' into pkg_support
Browse files Browse the repository at this point in the history
* main:
  Replace crayon by cli (#399)
  • Loading branch information
schloerke committed Feb 10, 2025
2 parents 8c6aaa5 + 596ecf6 commit 6b4109f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Imports:
callr,
checkmate (>= 2.0.0),
chromote (>= 0.1.2),
crayon,
cli,
fs,
globals (>= 0.14.0),
httr,
Expand Down
14 changes: 7 additions & 7 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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(lifecycle,deprecated)
importFrom(rlang,"%||%")
importFrom(rlang,":=")
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/app-driver-initialize.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
Expand Down
2 changes: 1 addition & 1 deletion R/compare-screenshot-threshold.R
Original file line number Diff line number Diff line change
Expand Up @@ -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`)")
))
}

Expand Down
8 changes: 4 additions & 4 deletions R/shinytest2-logs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}

Expand Down

0 comments on commit 6b4109f

Please sign in to comment.