You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
that it's fine to mix describe() and test_that() in a single test-*.R, as per:
Use describe to verify that you implement the right things and use test_that() to ensure you do the things right. testthat docs
that skip()s would have scope only inside any given describe(), just as is the case (and documented) for test_that():
skip_if() and skip_if_not() allow you to skip tests, immediately concluding a test_that() block without executing any further expectations. testthat docs
so I wrote this:
test_that("foo", {
skip()
stop()
})
# this is *not* skipped, as expected
describe("bar", {
it("bars", expect_true(TRUE))
})
describe("baz", {
skip()
it("bazs", expect_true(TRUE))
})
# below are all skipped, which is not expected
test_that("qux", expect_true(FALSE))
describe("quux", it("quuxs", expect_true(FALSE)))
expecting that all exceptfoo and baz would be run.
However, devtools::test() yields:
✔ | 2 1 | test
so only bar is run, and only foo and baz are skipped, the remaining qux and quux aren't even listed as skipped.
I'm guessing this is because skip_*()s inside describe() have higher (= file) scope than those inside test_that().
Based on my above assumptions 1) and 2) I assumed that skip_*()s would behave equally inside describe() and `test_that().
If 1) and 2) is intended, I'm guessing this behavior is a bug.
If 1) and/or 2) are wrong, I'd be happy to add some explanation to the docs in a PR.
I assumed
that it's fine to mix
describe()
andtest_that()
in a singletest-*.R
, as per:that
skip()
s would have scope only inside any givendescribe()
, just as is the case (and documented) fortest_that()
:so I wrote this:
expecting that all except
foo
andbaz
would be run.However,
devtools::test()
yields:so only
bar
is run, and onlyfoo
andbaz
are skipped, the remainingqux
andquux
aren't even listed as skipped.I'm guessing this is because
skip_*()
s insidedescribe()
have higher (= file) scope than those insidetest_that()
.Based on my above assumptions 1) and 2) I assumed that
skip_*()
s would behave equally insidedescribe()
and `test_that().If 1) and 2) is intended, I'm guessing this behavior is a bug.
If 1) and/or 2) are wrong, I'd be happy to add some explanation to the docs in a PR.
The text was updated successfully, but these errors were encountered: