@@ -24,27 +24,45 @@ test_that("detect number of cpus to use", {
2424
2525test_that(" ok" , {
2626 withr :: local_envvar(c(TESTTHAT_PARALLEL = " TRUE" ))
27- suppressMessages(ret <- test_local(
27+ # we cannot run these with the silent reporter, because it is not
28+ # parallel compatible, and they'll not run in parallel
29+ capture.output(suppressMessages(ret <- test_local(
2830 test_path(" test-parallel" , " ok" ),
29- reporter = " silent " ,
31+ reporter = " summary " ,
3032 stop_on_failure = FALSE
31- ))
33+ )))
3234 tdf <- as.data.frame(ret )
3335 tdf <- tdf [order(tdf $ file ), ]
3436 expect_equal(tdf $ failed , c(0 ,1 ,0 ))
3537 expect_equal(tdf $ skipped , c(FALSE , FALSE , TRUE ))
3638})
3739
40+ test_that(" fail" , {
41+ withr :: local_envvar(c(TESTTHAT_PARALLEL = " TRUE" ))
42+ # we cannot run these with the silent reporter, because it is not
43+ # parallel compatible, and they'll not run in parallel
44+ capture.output(suppressMessages(ret <- test_local(
45+ test_path(" test-parallel" , " fail" ),
46+ reporter = " summary" ,
47+ stop_on_failure = FALSE
48+ )))
49+ tdf <- as.data.frame(ret )
50+ tdf <- tdf [order(tdf $ file ), ]
51+ expect_equal(tdf $ failed , c(1 ))
52+ })
53+
3854test_that(" snapshots" , {
3955 withr :: local_envvar(c(TESTTHAT_PARALLEL = " TRUE" ))
4056 on.exit(unlink(tmp , recursive = TRUE ), add = TRUE )
4157 dir.create(tmp <- tempfile(" testthat-snap-" ))
4258 file.copy(test_path(" test-parallel" , " snap" ), tmp , recursive = TRUE )
43- suppressMessages(ret <- test_local(
59+ # we cannot run these with the silent reporter, because it is not
60+ # parallel compatible, and they'll not run in parallel
61+ capture.output(suppressMessages(ret <- test_local(
4462 file.path(tmp , " snap" ),
45- reporter = " silent " ,
63+ reporter = " summary " ,
4664 stop_on_failure = FALSE
47- ))
65+ )))
4866 tdf <- as.data.frame(ret )
4967 tdf <- tdf [order(tdf $ file ), ]
5068 expect_equal(tdf $ failed , c(0 ,0 ,1 ))
@@ -60,11 +78,13 @@ test_that("new snapshots are added", {
6078 dir.create(tmp <- tempfile(" testthat-snap-" ))
6179 file.copy(test_path(" test-parallel" , " snap" ), tmp , recursive = TRUE )
6280 unlink(file.path(tmp , " snap" , " tests" , " testthat" , " _snaps" , " snap-2.md" ))
63- suppressMessages(ret <- test_local(
81+ # we cannot run these with the silent reporter, because it is not
82+ # parallel compatible, and they'll not run in parallel
83+ capture.output(suppressMessages(ret <- test_local(
6484 file.path(tmp , " snap" ),
65- reporter = " silent " ,
85+ reporter = " summary " ,
6686 stop_on_failure = FALSE
67- ))
87+ )))
6888 tdf <- as.data.frame(ret )
6989 tdf <- tdf [order(tdf $ file ), ]
7090 expect_equal(tdf $ failed , c(0 ,0 ,1 ))
@@ -83,11 +103,13 @@ test_that("snapshots are removed if test file has no snapshots", {
83103 " test_that(\" 2\" , { expect_true(TRUE) })" ,
84104 file.path(tmp , " snap" , " tests" , " testthat" , " test-snap-2.R" )
85105 )
86- suppressMessages(ret <- test_local(
106+ # we cannot run these with the silent reporter, because it is not
107+ # parallel compatible, and they'll not run in parallel
108+ capture.output(suppressMessages(ret <- test_local(
87109 file.path(tmp , " snap" ),
88- reporter = " silent " ,
110+ reporter = " summary " ,
89111 stop_on_failure = FALSE
90- ))
112+ )))
91113 tdf <- as.data.frame(ret )
92114 tdf <- tdf [order(tdf $ file ), ]
93115 expect_equal(tdf $ failed , c(0 ,0 ,1 ))
@@ -104,11 +126,13 @@ test_that("snapshots are removed if test file is removed", {
104126 file.copy(test_path(" test-parallel" , " snap" ), tmp , recursive = TRUE )
105127 unlink(file.path(tmp , " snap" , " tests" , " testthat" , " test-snap-2.R" ))
106128 withr :: local_envvar(CI = NA_character_ )
107- suppressMessages(ret <- test_local(
129+ # we cannot run these with the silent reporter, because it is not
130+ # parallel compatible, and they'll not run in parallel
131+ capture.output(suppressMessages(ret <- test_local(
108132 file.path(tmp , " snap" ),
109- reporter = " silent " ,
133+ reporter = " summary " ,
110134 stop_on_failure = FALSE
111- ))
135+ )))
112136 tdf <- as.data.frame(ret )
113137 tdf <- tdf [order(tdf $ file ), ]
114138 expect_equal(tdf $ failed , c(0 ,1 ))
0 commit comments