testthat icon indicating copy to clipboard operation
testthat copied to clipboard

FR: Warn optionally on duplicate test names

Open krlmlr opened this issue 2 years ago • 1 comments

Should testthat warn in this case, perhaps optionally?

library(testthat)

test_that("foo", {
  expect_true(TRUE)
})
#> Test passed 🎊

test_that("foo", {
  expect_true(TRUE)
})
#> Test passed 🎊

Created on 2023-08-23 with reprex v2.0.2

Reference: https://github.com/tidyverse/dplyr/pull/6901#issuecomment-1689991900

krlmlr avatar Aug 23 '23 13:08 krlmlr

I think it would be fine for this to be an unconditional warning.

hadley avatar Sep 22 '23 15:09 hadley

But this also doesn't seem that important to me; especially since it means that a reporter would have to keep track of every test that it's seen.

hadley avatar Aug 01 '25 15:08 hadley