1
1
test_that(" GitHub Actions functionality works" , {
2
- # imitate being on GHA whether or not we are
3
2
withr :: local_envvar(list (GITHUB_ACTIONS = " true" ))
4
3
withr :: local_options(lintr.rstudio_source_markers = FALSE )
5
4
tmp <- withr :: local_tempfile(lines = " x <- 1:nrow(y)" )
@@ -9,7 +8,6 @@ test_that("GitHub Actions functionality works", {
9
8
})
10
9
11
10
test_that(" GitHub Actions functionality works in a subdirectory" , {
12
- # imitate being on GHA whether or not we are
13
11
pkg_path <- test_path(" dummy_packages" , " assignmentLinter" )
14
12
withr :: local_envvar(list (GITHUB_ACTIONS = " true" ))
15
13
withr :: local_options(lintr.rstudio_source_markers = FALSE , lintr.github_annotation_project_dir = pkg_path )
@@ -26,8 +24,21 @@ test_that("GitHub Actions functionality works in a subdirectory", {
26
24
)
27
25
})
28
26
29
- test_that(" GitHub Actions - linting on error works" , {
30
- # imitate being on GHA whether or not we are
27
+ patrick :: with_parameters_test_that(
28
+ " GitHub Actions - env var for error on lint is converted to logical" ,
29
+ {
30
+ withr :: local_envvar(list (GITHUB_ACTIONS = " true" , LINTR_ERROR_ON_LINT = env_var_value ))
31
+ withr :: local_options(lintr.rstudio_source_markers = FALSE )
32
+ tmp <- withr :: local_tempfile(lines = " x <- 1:nrow(y)" )
33
+
34
+ l <- lint(tmp )
35
+
36
+ expect_output(print(l ), " ::warning file" , fixed = TRUE )
37
+ },
38
+ env_var_value = c(" " , " F" , NA ),
39
+ )
40
+
41
+ test_that(" GitHub Actions - error on lint works" , {
31
42
withr :: local_envvar(list (GITHUB_ACTIONS = " true" , LINTR_ERROR_ON_LINT = " true" ))
32
43
withr :: local_options(lintr.rstudio_source_markers = FALSE )
33
44
tmp <- withr :: local_tempfile(lines = " x <- 1:nrow(y)" )
0 commit comments