diff --git a/NEWS.md b/NEWS.md index aa418a624..3fa3f7e5d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ * `it()` now finds the correct evaluation environment in more cases (@averissimo, #2085). * Fixed an issue preventing compilation from succeeding due to deprecation / removal of `std::uncaught_exception()` (@kevinushey, #2047). * New `skip_unless_r()` to skip running tests on unsuitable versions of R, e.g. `skip_unless_r(">= 4.1.0")` to skip tests that require, say, `...names` (@MichaelChirico, #2022) +* `skip_on_os()` gains an option `"emscripten"` of the `os` argument to skip tests on Emscripten (@eitsupi, #2103). # testthat 3.2.3 diff --git a/R/skip.R b/R/skip.R index 1ad1de7ed..894cf7377 100644 --- a/R/skip.R +++ b/R/skip.R @@ -170,7 +170,8 @@ skip_on_cran <- function() { #' @export #' @param os Character vector of one or more operating systems to skip on. -#' Supported values are `"windows"`, `"mac"`, `"linux"`, and `"solaris"`. +#' Supported values are `"windows"`, `"mac"`, `"linux"`, `"solaris"`, +#' and `"emscripten"`. #' @param arch Character vector of one or more architectures to skip on. #' Common values include `"i386"` (32 bit), `"x86_64"` (64 bit), and #' `"aarch64"` (M1 mac). Supplying `arch` makes the test stricter; i.e. both @@ -179,7 +180,7 @@ skip_on_cran <- function() { skip_on_os <- function(os, arch = NULL) { os <- match.arg( os, - choices = c("windows", "mac", "linux", "solaris"), + choices = c("windows", "mac", "linux", "solaris", "emscripten"), several.ok = TRUE ) @@ -187,7 +188,8 @@ skip_on_os <- function(os, arch = NULL) { windows = if ("windows" %in% os) "On Windows", darwin = if ("mac" %in% os) "On Mac", linux = if ("linux" %in% os) "On Linux", - sunos = if ("solaris" %in% os) "On Solaris" + sunos = if ("solaris" %in% os) "On Solaris", + emscripten = if ("emscripten" %in% os) "On Emscripten" ) if (!is.null(arch) && !is.null(msg)) { diff --git a/man/skip.Rd b/man/skip.Rd index 911db42f2..e64ccfd8f 100644 --- a/man/skip.Rd +++ b/man/skip.Rd @@ -55,7 +55,8 @@ should only be run on R versions 4.1.0 and later.} \item{host}{A string with a hostname to lookup} \item{os}{Character vector of one or more operating systems to skip on. -Supported values are \code{"windows"}, \code{"mac"}, \code{"linux"}, and \code{"solaris"}.} +Supported values are \code{"windows"}, \code{"mac"}, \code{"linux"}, \code{"solaris"}, +and \code{"emscripten"}.} \item{arch}{Character vector of one or more architectures to skip on. Common values include \code{"i386"} (32 bit), \code{"x86_64"} (64 bit), and diff --git a/tests/testthat/_snaps/skip.md b/tests/testthat/_snaps/skip.md index c9247c7d4..3868f8216 100644 --- a/tests/testthat/_snaps/skip.md +++ b/tests/testthat/_snaps/skip.md @@ -70,7 +70,7 @@ skip_on_os("amiga") Condition Error in `match.arg()`: - ! 'arg' should be one of "windows", "mac", "linux", "solaris" + ! 'arg' should be one of "windows", "mac", "linux", "solaris", "emscripten" # can skip on multiple oses diff --git a/tests/testthat/test-skip.R b/tests/testthat/test-skip.R index ff970078e..b4661cd26 100644 --- a/tests/testthat/test-skip.R +++ b/tests/testthat/test-skip.R @@ -122,6 +122,7 @@ test_that("can skip on multiple oses", { expect_snapshot_skip(skip_on_os(c("windows", "linux"))) expect_no_skip(skip_on_os("linux")) expect_no_skip(skip_on_os("mac")) + expect_no_skip(skip_on_os("emscripten")) }) test_that("can refine os with arch", {