We've been running R CMD check on packages for our package registry manager PRISM (Home | PRISM) and noticed that naniar is failing during tests with 27 failures.
The full error output:
checking tests Running spelling.R
Comparing spelling.Rout to spelling.Rout.save ... OK
Running testthat.R
Running the tests in tests/testthat.R failed.
Last 13 lines of output:
3. └─testthat::fail(info = info)
4. └─testthat:::check_character(info, allow_null = TRUE)
5. └─testthat:::stop_input_type(...)
6. └─rlang::abort(message, ..., call = call, arg = arg)
Snapshots
To review and process snapshots locally:
* Locate check directory.
* Copy 'tests/testthat/_snaps' to local package.
* Run `testthat::snapshot_accept()` to accept all changes.
* Run `testthat::snapshot_review()` to review all changes.
[ FAIL 27 | WARN 0 | SKIP 0 | PASS 615 ]
Error:
! Test failures.
Execution halted
Investigating the errors, we found three categories of failures:
1. "shade" class lost on grouped data (2 failures)
Here is the failing test:
test-special-missing-values.R:
test_that("special missings class is maintained for grouped and ungrouped data", {
skip_on_cran()
skip_on_ci()
expect_equal(class(aq_grouped_recoded$Ozone_NA),
class(aq_recoded$Ozone_NA))
expect_true(is_shade(aq_grouped_recoded$Ozone_NA),
is_shade(aq_recoded$Ozone_NA))
})
The "shade" class is missing from the grouped data, only "factor" remains:
Expected `class(aq_grouped_recoded$Ozone_NA)` to equal `class(aq_recoded$Ozone_NA)`.
Differences:
`actual`: "factor"
`expected`: "shade" "factor"
and another error here:
Error in `fail(msg, info = info, trace_env = trace_env)`:
`info` must be a character vector or `NULL`, not `TRUE`.
2. Snapshot mismatches:
Here are the failing tests:
test-defunct.R:
df <- tibble::tibble(x = c("A", NA))
test_that("miss_var_prop is defunct", {
expect_snapshot(error = TRUE, miss_var_prop(df))
})
test_that("complete_var_prop is defunct", {
expect_snapshot(error = TRUE, complete_var_prop(df))
})
test_that("miss_var_pct is defunct", {
expect_snapshot(error = TRUE, miss_var_pct(df))
})
test_that("complete_var_pct is defunct", {
expect_snapshot(error = TRUE, complete_var_pct(df))
})
test_that("miss_case_prop is defunct", {
expect_snapshot(error = TRUE, miss_case_prop(df))
})
test_that("complete_case_prop is defunct", {
expect_snapshot(error = TRUE, complete_case_prop(df))
})
test_that("miss_case_pct is defunct", {
expect_snapshot(error = TRUE, miss_case_pct(df))
})
test_that("complete_case_pct is defunct", {
expect_snapshot(error = TRUE, complete_case_pct(df))
})
test_that("replace_to_na is defunct", {
expect_snapshot(error = TRUE, replace_to_na(df))
})
All 9 show the same pattern — the error header now includes the function name. Here is one example:
Expected:
Error:
! 'miss_var_prop' is defunct.
Use 'prop_miss_var' instead.
See help("Defunct")
Actual:
Error in `miss_var_prop()`:
! 'miss_var_prop' is defunct.
Use 'prop_miss_var' instead.
See help("Defunct")
3. Visual snapshot mismatches (16 failures)
16 vdiffr::expect_doppelganger failures across test-gg-miss-case.R (8), test-gg-miss-fct.R (1), test-gg-miss-span.R (2), test-gg-miss-var-plot.R (4), test-gg-miss-which.R (1). These are resolved by downgrading to ggplot2 3.5.2. The expected and actual plots appear visually identical. We've attached a zip of the visual diffs for reference:
naniar.zip
Happy to provide any more details or clarity if needed.
We've been running R CMD check on packages for our package registry manager PRISM (Home | PRISM) and noticed that
naniaris failing during tests with 27 failures.The full error output:
Investigating the errors, we found three categories of failures:
1.
"shade"class lost on grouped data (2 failures)Here is the failing test:
test-special-missing-values.R:The "shade" class is missing from the grouped data, only "factor" remains:
and another error here:
2. Snapshot mismatches:
Here are the failing tests:
test-defunct.R:All 9 show the same pattern — the error header now includes the function name. Here is one example:
Expected:
Actual:
3. Visual snapshot mismatches (16 failures)
16
vdiffr::expect_doppelgangerfailures acrosstest-gg-miss-case.R(8),test-gg-miss-fct.R(1),test-gg-miss-span.R(2),test-gg-miss-var-plot.R(4),test-gg-miss-which.R(1). These are resolved by downgrading toggplot2 3.5.2. The expected and actual plots appear visually identical. We've attached a zip of the visual diffs for reference:naniar.zip
Happy to provide any more details or clarity if needed.