Skip to content

Commit 633f1de

Browse files
committed
Merged origin/main into new-snapshot-fail-on-ci
2 parents 3c3ce02 + 5925478 commit 633f1de

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

tests/testthat/_snaps/describe.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# snapshot tests in describe
2+
3+
Code
4+
1 + 1
5+
Output
6+
[1] 2
7+
8+
# snapshot tests in describe / and in it
9+
10+
Code
11+
1 + 1
12+
Output
13+
[1] 2
14+
115
# has to have a valid description for the block
216

317
Code

tests/testthat/_snaps/snapshot.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@
258258
Code
259259
cat(snapshot_accept_hint("_default", "bar.R", reset_output = FALSE))
260260
Output
261-
* Run ]8;;ide:run:testthat::snapshot_accept('bar.R')testthat::snapshot_accept('bar.R')]8;; to accept the change.
262-
* Run ]8;;ide:run:testthat::snapshot_review('bar.R')testthat::snapshot_review('bar.R')]8;; to interactively review the change.
261+
* Run `testthat::snapshot_accept('bar.R')` to accept the change.
262+
* Run `testthat::snapshot_review('bar.R')` to interactively review the change.
263263
Code
264264
cat(snapshot_accept_hint("foo", "bar.R", reset_output = FALSE))
265265
Output
266-
* Run ]8;;ide:run:testthat::snapshot_accept('foo/bar.R')testthat::snapshot_accept('foo/bar.R')]8;; to accept the change.
267-
* Run ]8;;ide:run:testthat::snapshot_review('foo/bar.R')testthat::snapshot_review('foo/bar.R')]8;; to interactively review the change.
266+
* Run `testthat::snapshot_accept('foo/bar.R')` to accept the change.
267+
* Run `testthat::snapshot_review('foo/bar.R')` to interactively review the change.
268268

269269
# expect_snapshot validates its inputs
270270

tests/testthat/test-describe.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ describe("describe", {
1313
})
1414
})
1515

16+
test_that("can write snaphot tests", {
17+
local_description_set()
18+
19+
describe("snapshot tests in describe", {
20+
expect_snapshot(1 + 1)
21+
it("and in it", {
22+
expect_snapshot(1 + 1)
23+
})
24+
})
25+
})
26+
1627
test_that("unimplemented specs generate skips", {
1728
expectations <- capture_expectations({
1829
it("can have not yet implemented specs", {

tests/testthat/test-snapshot.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ test_that("errors and warnings are folded", {
166166
# })
167167

168168
test_that("hint is informative", {
169-
local_reproducible_output(crayon = TRUE, hyperlinks = TRUE, rstudio = TRUE)
170-
171169
expect_snapshot({
172170
cat(snapshot_accept_hint("_default", "bar.R", reset_output = FALSE))
173171
cat(snapshot_accept_hint("foo", "bar.R", reset_output = FALSE))

0 commit comments

Comments
 (0)