Skip to content

test!: custom check() never fails - migrate to testthat3 #54

Closed

Description

@davidbudzynski

Problem
tests/test_kit.R:7-34 defines check(test,x,y,error,warning) that only does cat("Check ... failed.\n"); return(invisible(FALSE)). The file tail just does rm(...) with no stop() / stopifnot(). grep -c 'check(' = 1286, and the only stop hit is test data stop("bang!").

Result: R CMD check is always green even with regressions. 1286 silent checks give false confidence.

Evidence

  • tests/test_kit.R:7-34, tail rm(check,...) + # END, no failure propagation.

Acceptance

  • Add Config/testthat/edition: 3 + Suggests: testthat (>= 3.0.0)
  • Split into tests/testthat/test-topn.R, test-iif-nif.R, test-parallel.R, test-share.R, ...
  • Map check(id, expr, expected) -> expect_identical() / expect_equal(), check(..., error=) -> expect_error(..., regexp=)
  • Verify R CMD check fails on a deliberately mutated return value
  • Keep legacy test_kit.R shim or delete it, update test-coverage.yaml

Activity

  1. davidbudzynski commented on Sep 20, 2026

    @davidbudzynski
    CollaboratorAuthor

    Update: pivoting this from testthat 3e (PR #64) to tinytest — new PR incoming, #64 will be closed as superseded.

    Why the change: the actual bug here (silent check(), always-green R CMD check) is fixed equally well by either framework, but testthat 3.x costs ~15k lines + 22 dependencies and needs R >= 4.1, while kit itself is lean C code with zero Imports and R >= 3.1.0. tinytest is zero-dependency, needs R >= 3.0, and matches what this suite actually uses (expect_identical / expect_error / tolerant numeric compares — no snapshots, mocking, or reporters). Two extra wins: tests ship inside inst/tinytest/ so users can run tinytest::test_package("kit") post-install (nice for a compiled package), and covr is framework-agnostic so test-coverage.yaml needs no change.

    Acceptance criteria still hold, just with different paths:

    • Loud failures instead of silent cat() — verified by mutation (3 deliberate failures, including one through the tolerant-compare helper, all detected with legacy-ID labels)
    • 1271 expectations, 0 failures (parity with the testthat conversion)
    • Legacy IDs preserved as info= labels; interleaved setup order preserved
    • tests/test_kit.R deleted, replaced by tests/tinytest.R runner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions