@@ -24,27 +24,45 @@ test_that("detect number of cpus to use", {
24
24
25
25
test_that(" ok" , {
26
26
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(
28
30
test_path(" test-parallel" , " ok" ),
29
- reporter = " silent " ,
31
+ reporter = " summary " ,
30
32
stop_on_failure = FALSE
31
- ))
33
+ )))
32
34
tdf <- as.data.frame(ret )
33
35
tdf <- tdf [order(tdf $ file ), ]
34
36
expect_equal(tdf $ failed , c(0 ,1 ,0 ))
35
37
expect_equal(tdf $ skipped , c(FALSE , FALSE , TRUE ))
36
38
})
37
39
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
+
38
54
test_that(" snapshots" , {
39
55
withr :: local_envvar(c(TESTTHAT_PARALLEL = " TRUE" ))
40
56
on.exit(unlink(tmp , recursive = TRUE ), add = TRUE )
41
57
dir.create(tmp <- tempfile(" testthat-snap-" ))
42
58
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(
44
62
file.path(tmp , " snap" ),
45
- reporter = " silent " ,
63
+ reporter = " summary " ,
46
64
stop_on_failure = FALSE
47
- ))
65
+ )))
48
66
tdf <- as.data.frame(ret )
49
67
tdf <- tdf [order(tdf $ file ), ]
50
68
expect_equal(tdf $ failed , c(0 ,0 ,1 ))
@@ -60,11 +78,13 @@ test_that("new snapshots are added", {
60
78
dir.create(tmp <- tempfile(" testthat-snap-" ))
61
79
file.copy(test_path(" test-parallel" , " snap" ), tmp , recursive = TRUE )
62
80
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(
64
84
file.path(tmp , " snap" ),
65
- reporter = " silent " ,
85
+ reporter = " summary " ,
66
86
stop_on_failure = FALSE
67
- ))
87
+ )))
68
88
tdf <- as.data.frame(ret )
69
89
tdf <- tdf [order(tdf $ file ), ]
70
90
expect_equal(tdf $ failed , c(0 ,0 ,1 ))
@@ -83,11 +103,13 @@ test_that("snapshots are removed if test file has no snapshots", {
83
103
" test_that(\" 2\" , { expect_true(TRUE) })" ,
84
104
file.path(tmp , " snap" , " tests" , " testthat" , " test-snap-2.R" )
85
105
)
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(
87
109
file.path(tmp , " snap" ),
88
- reporter = " silent " ,
110
+ reporter = " summary " ,
89
111
stop_on_failure = FALSE
90
- ))
112
+ )))
91
113
tdf <- as.data.frame(ret )
92
114
tdf <- tdf [order(tdf $ file ), ]
93
115
expect_equal(tdf $ failed , c(0 ,0 ,1 ))
@@ -104,11 +126,13 @@ test_that("snapshots are removed if test file is removed", {
104
126
file.copy(test_path(" test-parallel" , " snap" ), tmp , recursive = TRUE )
105
127
unlink(file.path(tmp , " snap" , " tests" , " testthat" , " test-snap-2.R" ))
106
128
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(
108
132
file.path(tmp , " snap" ),
109
- reporter = " silent " ,
133
+ reporter = " summary " ,
110
134
stop_on_failure = FALSE
111
- ))
135
+ )))
112
136
tdf <- as.data.frame(ret )
113
137
tdf <- tdf [order(tdf $ file ), ]
114
138
expect_equal(tdf $ failed , c(0 ,1 ))
0 commit comments