Skip to content

Commit 4590f44

Browse files
committed
fix: ensure optional requirements in tests
1 parent e2275ab commit 4590f44

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

tests/testthat/setup-logger.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
logger::log_appender(function(...) NULL, namespace = "teal.modules.general")
1+
if (requireNamespace("logger", quietly = TRUE)) {
2+
logger::log_appender(function(...) NULL, namespace = "teal.modules.general")
3+
}

tests/testthat/test-examples.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ for (i in rd_files()) {
145145
paste0("example-", basename(i)),
146146
{
147147
skip_if_too_deep(5)
148+
testthat::skip_if_not_installed("pkgload")
148149
if (basename(i) %in% strict_exceptions) {
149150
op <- options()
150151
withr::local_options(opts_partial_match_old)

tests/testthat/test-shinytest2-tm_data_table.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ test_that("e2e - tm_data_table: Verify checkbox displayed over data table", {
4444
})
4545

4646
test_that("e2e - tm_data_table: Verify module displays data table", {
47+
testthat::skip_if_not_installed("rvest")
4748
skip_if_too_deep(5)
4849
app_driver <- app_driver_tm_data_table()
4950

tests/testthat/test-shinytest2-tm_file_viewer.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ app_driver_tm_file_viewer <- function() {
1717
}
1818

1919
test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree specified in input_path argument", {
20+
testthat::skip_if_not_installed("rvest")
2021
skip_if_too_deep(5)
2122
app_driver <- app_driver_tm_file_viewer()
2223

@@ -42,6 +43,7 @@ test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree
4243
})
4344

4445
test_that("e2e - tm_file_viewer: Shows selected image file", {
46+
testthat::skip_if_not_installed("rvest")
4547
skip_if_too_deep(5)
4648
app_driver <- app_driver_tm_file_viewer()
4749

@@ -58,6 +60,7 @@ test_that("e2e - tm_file_viewer: Shows selected image file", {
5860
})
5961

6062
test_that("e2e - tm_file_viewer: Shows selected text file", {
63+
testthat::skip_if_not_installed("rvest")
6164
skip_if_too_deep(5)
6265
app_driver <- app_driver_tm_file_viewer()
6366

tests/testthat/test-shinytest2-tm_misssing_data.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ test_that("e2e - tm_missing_data: Validate functionality and UI response for 'By
147147
})
148148

149149
test_that("e2e - tm_missing_data: Validate 'By Variable Levels' table values", {
150+
testthat::skip_if_not_installed("rvest")
150151
skip_if_too_deep(5)
151152
app_driver <- app_driver_tm_missing_data()
152153

0 commit comments

Comments
 (0)