diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 826988ad..f3335113 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -51,11 +51,8 @@ jobs: NOT_CRAN=true TESTING_DEPTH=5 enforce-note-blocklist: true - publish-unit-test-report-gh-pages: false - junit-xml-comparison: false concurrency-group: non-cran - disable-unit-test-reports: true - skip-r-cmd-install: true + unit-test-report-directory: unit-test-report-non-cran note-blocklist: | checking dependencies in R code .* NOTE checking R code for possible problems .* NOTE diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 9b7a7e54..57ae8004 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -41,3 +41,4 @@ jobs: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} with: default-landing-page: latest-tag + additional-unit-test-report-directories: unit-test-report-non-cran diff --git a/.github/workflows/on-demand.yaml b/.github/workflows/on-demand.yaml deleted file mode 100644 index 02843bb3..00000000 --- a/.github/workflows/on-demand.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: On-demand 🧑‍đŸ”Ŧ - -on: - schedule: - - cron: '45 3 * * 0' - workflow_dispatch: - -jobs: - revdepcheck: - name: revdepcheck ↩ī¸ - uses: insightsengineering/r.pkg.template/.github/workflows/revdepcheck.yaml@main diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 226473ce..e56418bb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -52,3 +52,7 @@ jobs: uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + wasm: + name: Build WASM packages 🧑‍🏭 + needs: release + uses: insightsengineering/r.pkg.template/.github/workflows/wasm.yaml@main diff --git a/.github/workflows/scheduled.yaml b/.github/workflows/scheduled.yaml index f2ddf686..207c2c97 100644 --- a/.github/workflows/scheduled.yaml +++ b/.github/workflows/scheduled.yaml @@ -19,6 +19,7 @@ jobs: GCHAT_WEBHOOK: ${{ secrets.GCHAT_WEBHOOK }} with: strategy: ${{ matrix.test-strategy }} + extra-deps: "R.utils (>= 2.12.3)" additional-env-vars: | PKG_SYSREQS_DRY_RUN=true branch-cleanup: @@ -26,3 +27,9 @@ jobs: uses: insightsengineering/r.pkg.template/.github/workflows/branch-cleanup.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + revdepcheck: + name: revdepcheck ↩ī¸ + uses: insightsengineering/r.pkg.template/.github/workflows/revdepcheck.yaml@main + rhub: + name: R-hub 🌐 + uses: insightsengineering/r.pkg.template/.github/workflows/rhub.yaml@main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b40c46a1..92bf2790 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.2 + rev: v0.4.3 hooks: - id: style-files name: Style code with `styler` diff --git a/DESCRIPTION b/DESCRIPTION index f3f77c50..287d955d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: teal.widgets Title: 'shiny' Widgets for 'teal' Applications -Version: 0.4.2.9014 -Date: 2024-07-10 +Version: 0.4.2.9017 +Date: 2024-08-06 Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")), person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"), @@ -61,4 +61,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 diff --git a/NEWS.md b/NEWS.md index a1543843..5a37ee68 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.widgets 0.4.2.9014 +# teal.widgets 0.4.2.9017 # teal.widgets 0.4.2 diff --git a/R/plot_with_settings.R b/R/plot_with_settings.R index 65cc8ba1..2a681065 100644 --- a/R/plot_with_settings.R +++ b/R/plot_with_settings.R @@ -413,7 +413,7 @@ plot_with_settings_srv <- function(id, }) output$width_warning <- renderUI({ - grDevices::pdf(NULL) # reset Rplots.pdf for shiny server + grDevices::pdf(nullfile()) # reset Rplots.pdf for shiny server w <- grDevices::dev.size("px")[1] grDevices::dev.off() if (p_width() < w) { diff --git a/R/table_with_settings.R b/R/table_with_settings.R index fcfb1a9a..b85e435b 100644 --- a/R/table_with_settings.R +++ b/R/table_with_settings.R @@ -202,7 +202,7 @@ type_download_srv_table <- function(id, table_reactive) { try(rtables::paginate_table( tt = table_reactive(), lpp = as.numeric(input$lpp) - )) + ), silent = TRUE) } if (inherits(catch_warning, "try-error")) { diff --git a/_pkgdown.yml b/_pkgdown.yml index a34956a9..f5b0b702 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -16,6 +16,8 @@ navbar: href: coverage-report/ - text: Unit test report href: unit-test-report/ + - text: Non-CRAN unit test report + href: unit-test-report-non-cran/ github: icon: fa-github href: https://github.com/insightsengineering/teal.widgets diff --git a/tests/testthat/helpers-utils.R b/tests/testthat/helpers-utils.R index 71e3af76..d3c4a251 100644 --- a/tests/testthat/helpers-utils.R +++ b/tests/testthat/helpers-utils.R @@ -7,6 +7,7 @@ is_draw <- function(plot_fun) { checkmate::assert_function(plot_fun) grDevices::graphics.off() # close any current graphics devices cdev <- grDevices::dev.cur() + grDevices::pdf(nullfile()) plot_fun() if (cdev != grDevices::dev.cur()) { on.exit(grDevices::dev.off()) diff --git a/tests/testthat/test-plot_with_settings.R b/tests/testthat/test-plot_with_settings.R index cc44b37e..bc572ff0 100644 --- a/tests/testthat/test-plot_with_settings.R +++ b/tests/testthat/test-plot_with_settings.R @@ -75,17 +75,16 @@ plot_funs <- list( function() boxplot(2), function() 2 ) +plot_types <- list( + function() "gg", + function() "trel", + function() "grob", + function() "base", + function() "base", + function() "other" +) testthat::test_that("print_plot is able to plot different types of graphics", { - plot_types <- list( - function() "ANYTHING", - function() "trel", - function() "grob", - function() "base", - function() "base", - function() "other" - ) - for (p in seq_along(plot_funs)) { testthat::expect_true( is_draw(function() print_plot(plot_funs[[p]], plot_types[[p]])) @@ -484,14 +483,13 @@ testthat::test_that("plot_with_settings_srv returns the click ggplot2 functional }) testthat::test_that("plot_with_settings_srv and plot_type reactive types", { - plot_types <- c("gg", "trel", "grob", "base", "base", "other") for (p in seq_along(plot_funs)) { plot_with_settings_args[["plot_r"]] <- plot_funs[[p]] shiny::testServer( teal.widgets:::plot_with_settings_srv, args = plot_with_settings_args, expr = { - testthat::expect_identical(plot_type(), plot_types[p]) + plot_suppress(testthat::expect_identical(plot_type(), plot_types[[p]]())) } ) } diff --git a/tests/testthat/test-plot_with_settings_ui.R b/tests/testthat/test-plot_with_settings_ui.R index cb4d48d0..d18b2758 100644 --- a/tests/testthat/test-plot_with_settings_ui.R +++ b/tests/testthat/test-plot_with_settings_ui.R @@ -388,7 +388,6 @@ testthat::test_that( app_driver$click(selector = "#plot_with_settings-downbutton-downl") app_driver$wait_for_idle(timeout = default_idle_timeout) - app_driver$expect_download("plot_with_settings-downbutton-data_download") filename <- app_driver$get_download("plot_with_settings-downbutton-data_download") testthat::expect_match(filename, "png$", fixed = FALSE) @@ -454,8 +453,6 @@ testthat::test_that("e2e teal.widgets::plot_with_settings: expanded image can be app_driver$click(selector = "#plot_with_settings-modal_downbutton-downl") app_driver$wait_for_idle(timeout = default_idle_timeout) - app_driver$expect_download("plot_with_settings-modal_downbutton-data_download") - filename <- app_driver$get_download("plot_with_settings-modal_downbutton-data_download") testthat::expect_match(filename, "png$", fixed = FALSE) diff --git a/tests/testthat/test-table_with_settings.R b/tests/testthat/test-table_with_settings.R index ca43c318..a21a13c4 100644 --- a/tests/testthat/test-table_with_settings.R +++ b/tests/testthat/test-table_with_settings.R @@ -110,20 +110,17 @@ testthat::test_that("type_download_srv_table: downloading different output types }) testthat::test_that("type_download_srv_table: pagination, lpp to small", { - testthat::expect_error( - shiny::testServer( - teal.widgets:::type_download_srv_table, - args = list(id = "tws", table_reactive = table_r), - expr = { - for (down_type in c(".txt", ".pdf")) { - session$setInputs(`pagination_switch` = TRUE) - session$setInputs(`lpp` = 1) - session$setInputs(`file_format` = down_type) - testthat::expect_true(file.exists(output$data_download)) - } + shiny::testServer( + teal.widgets:::type_download_srv_table, + args = list(id = "tws", table_reactive = table_r), + expr = { + for (down_type in c(".txt", ".pdf")) { + session$setInputs(`pagination_switch` = TRUE) + session$setInputs(`lpp` = 1) + session$setInputs(`file_format` = down_type) + testthat::expect_error(output$data_download, "Lines of repeated context") } - ), - "Lines of repeated context" + } ) }) diff --git a/tests/testthat/test-table_with_settings_ui.R b/tests/testthat/test-table_with_settings_ui.R index d6cdca53..a9f3912f 100644 --- a/tests/testthat/test-table_with_settings_ui.R +++ b/tests/testthat/test-table_with_settings_ui.R @@ -343,7 +343,6 @@ testthat::test_that( app_driver$click(selector = "#table_with_settings-downbutton-dwnl") app_driver$wait_for_idle(timeout = default_idle_timeout) - app_driver$expect_download("table_with_settings-downbutton-data_download") filename <- app_driver$get_download("table_with_settings-downbutton-data_download") testthat::expect_match(filename, "txt$", fixed = FALSE) @@ -371,8 +370,6 @@ testthat::test_that("e2e teal.widgets::table_with_settings: expanded table can b app_driver$click(selector = "#table_with_settings-modal_downbutton-dwnl") app_driver$wait_for_idle(timeout = default_idle_timeout) - app_driver$expect_download("table_with_settings-modal_downbutton-data_download") - filename <- app_driver$get_download("table_with_settings-modal_downbutton-data_download") testthat::expect_match(filename, "txt$", fixed = FALSE)