File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,5 +23,5 @@ URL: https://github.com/markvanderloo/tinytest
2323BugReports: https://github.com/markvanderloo/tinytest/issues
2424Depends: R (>= 3.0.0)
2525Imports: parallel, utils
26- RoxygenNote: 7.2.3
26+ RoxygenNote: 7.3.2
2727Encoding: UTF-8
Original file line number Diff line number Diff line change 11version 1.4.2
2+ - tt.pr.color is now set to FALSE when the NO_COLOR environment
3+ variable is set. See https://no-color.org/
24- expect_<condition> now uses conditionMessage internally. This
35 should increase compatibility with packages defining custom
46 conditions. (thanks to Tim Taylor for suggesting and Etienne Bacher
Original file line number Diff line number Diff line change 11
22
33.onLoad <- function (libname , pkgname ){
4- # turn off color printing for dumb terminals
4+ # turn off color printing for dumb terminal
55 term <- tolower(trimws(Sys.getenv(" TERM" )))
6- if ( identical( term , " dumb" ) ){
6+ # turn off color when NO_COLOR is set
7+ no_color <- Sys.getenv(" NO_COLOR" ,unset = NA_character_ )
8+ if ( identical(term , " dumb" ) ||
9+ identical(no_color , NA_character_ )|| identical(no_color , " " ) ){
10+
711 options(tt.pr.color = FALSE )
812 }
913
Original file line number Diff line number Diff line change @@ -117,8 +117,10 @@ any_fail <- function(x){
117117# ' }
118118# ' which determines whether colored output is printed.
119119# ' If R is running in a dumb terminal (detected by comparing
120- # ' environment variable \code{"TERM"} to \code{"dumb"}), then
120+ # ' environment variable \code{"TERM"} to \code{"dumb"}), or if the
121+ # ' \code{NO_CODE} environment variable is set, then
121122# ' this option is set to \code{FALSE} when the package is loaded.
123+ # ' See also \href{https://no-color.org}{https://no-color.org}.
122124# '
123125# ' @rdname tinytests
124126# ' @export
Original file line number Diff line number Diff line change 11
2- oldterm <- Sys.getenv(" TERM" )
32Sys.setenv(TERM = " dumb" ) # will be unset by tinytest
43tinytest ::: .onLoad()
54expect_false(getOption(" tt.pr.color" ))
65
6+
7+
8+ options(tt.pr.color = NULL )
9+ Sys.setenv(NO_COLOR = 1L )
10+ tinytest ::: .onLoad()
11+ expect_false(getOption(" tt.pr.color" ))
12+
13+
714# reset option set by .onLoad()
815options(tt.pr.color = NULL )
916
You can’t perform that action at this time.
0 commit comments