|
1 | | -# shinytest2 (development version) |
| 1 | +# shinytest2 0.5.0 |
2 | 2 |
|
| 3 | +## Lifecycle changes |
3 | 4 |
|
4 | | -## AppDriver |
| 5 | +* `load_app_env()` has been superseded by `load_app_support()`. This new |
| 6 | + function aligns its name with `local_app_support()` and |
| 7 | + `with_app_support()`, and similarly, it requires an `app_dir` parameter |
| 8 | + (#328). |
5 | 9 |
|
6 | | -* Added support for local package development for the background Shiny App process in `AppDriver$new(app_dir=)`. In the background test R process, any `library(<pkg>)` or `require(<pkg>)` call will automatically execute `pkgload::load_all()` to load the local R package's source code. Installing the package before testing is no longer required! (#402). |
| 10 | +* `test_app(check_setup=)` is now deprecated. Checking is no longer required |
| 11 | + as default behavior, as `load_app_env()` has been superseded by |
| 12 | + `with_app_support()` and `local_app_support()`, which provide a more robust |
| 13 | + and flexible way to scope app support files such as `global.R`, `app.R`, |
| 14 | + `server.R`, and `ui.R` (#328). |
7 | 15 |
|
8 | | -* Added support for function execution for `AppDriver$new(app_dir=)`. You must run the App or document yourself. Similar to `{mirai}`, all packages must be `library()`'d or `require()`'d again as the function is being ran in the background R process (#402). |
9 | | - |
10 | | -## Package testing |
11 | | - |
12 | | -* For package authors, it is now recommended to test your Shiny applications within your own `{testthat}` tests instead of using `test_app()`. By using your package's existing `{testthat}` infrastructure to test your Shiny applications, collecting snapshots in a single location. Be sure to use `with_app_support()` or `local_app_support()` to load your app's support files as needed. See the [use-package vignette](https://rstudio.github.io/shinytest2/articles/use-package.html) for more details (#328). |
13 | | - |
14 | | -* To implement the new test file location app, `record_test()` will now save the test file to the package's `tests/testthat/` directory if the current working directory is within a package given `record_in_package=TRUE` (default). If `record_in_package=FALSE`, the test file will be saved relative to the app's `tests/testthat/` directory. This change helps facilitate using the package's existing testing infrastructure by having unit tests in a single place (#328). |
15 | | - |
16 | | -## Bug / Improvements |
17 | | - |
18 | | -* Added two new methods: `with_app_support()` and `local_app_support()`. These methods provide package authors a flexible way to scope app support files such as `global.R`, `app.R`, `server.R`, and `ui.R` within your tests. Non-package authors should still use `load_app_support()` within their `setup-shinytest2.R` file. See `?local_app_support` for more details (#328). |
19 | | - |
20 | | -* `load_app_env()` has been superseded by `load_app_support()`. This new method aligns its name with `local_app_support()` and `with_app_support()`, and similarly, it requires an `app_dir=` parameter (#328). |
21 | | - |
22 | | -* `test_app(check_setup=)` is now deprecated. Checking is no longer required as default behavior. This is because `load_app_env()` is now superseded by two new functions: `with_app_support()` and `local_app_support()`. Each function provides a more robust and flexible way to scope app support files such as `global.R`, `app.R`, `server.R`, and `ui.R`. See `?with_app_support` and `?local_app_support` for more details (#328). |
23 | | - |
24 | | -* Given `test_app(check_setup=FALSE)` is now deprecated. This change was done for package authors do not require apps to load support (#328). |
25 | | - |
26 | | -* `record_test()` will now only save setup file for local app testing and not within package app testing. When recording a test for an app inside a package, `local_app_support()` will be added to the top of the testing code (#328). |
27 | | - |
28 | | -* Fixed internal bug where `{testthat}` v3.3.0 changed expectation behavior for screenshot snapshots within `App$expect_values()` (#418). |
| 16 | +## New features |
29 | 17 |
|
30 | | -* Migrated from `{httr}` to `{httr2}` for all HTTP requests made by `{shinytest2}` (#420, #428). |
| 18 | +* `AppDriver$new(app_dir=)` now supports local package development for the |
| 19 | + background Shiny app process. In the background test R process, any |
| 20 | + `library(<pkg>)` or `require(<pkg>)` call automatically executes |
| 21 | + `pkgload::load_all()` to load the local R package's source code. Installing |
| 22 | + the package before testing is no longer required (#402). |
| 23 | + |
| 24 | +* `AppDriver$new(app_dir=)` now supports function execution. You must run the |
| 25 | + app (or document) yourself or return a Shiny app object. Similar to `{mirai}`, |
| 26 | + all packages must be loaded with `library()` or `require()` again as the |
| 27 | + function runs in the background R process (#402). |
| 28 | + |
| 29 | +* Added `local_app_support()`, `with_app_support()`, and `load_app_support()`. |
| 30 | + `local_app_support()` and `with_app_support()` provide package authors a |
| 31 | + flexible way to scope app support files such as `global.R`, `app.R`, |
| 32 | + `server.R`, and `ui.R` within tests. Non-package authors should still use |
| 33 | + `load_app_support()` within their `setup-shinytest2.R` file. See |
| 34 | + `?local_app_support` for more details (#328). |
| 35 | + |
| 36 | +* `record_test()` gained a `record_in_package` parameter. If `TRUE` (default) |
| 37 | + and the current working directory is within a package, the test file is saved |
| 38 | + to the package's `tests/testthat/` directory. If `FALSE`, the test file is |
| 39 | + saved to the app's `tests/testthat/` directory (#328). |
| 40 | + |
| 41 | +* Package authors should now test Shiny applications within their own |
| 42 | + `{testthat}` tests instead of using `test_app()`. This collects snapshots in a |
| 43 | + single location using the package's existing `{testthat}` infrastructure. Use |
| 44 | + `with_app_support()` or `local_app_support()` to load app support files as |
| 45 | + needed. See the [use-package |
| 46 | + vignette](https://rstudio.github.io/shinytest2/articles/use-package.html) for |
| 47 | + more details (#328). |
| 48 | + |
| 49 | +## Bug fixes and minor improvements |
| 50 | + |
| 51 | +* `AppDriver$expect_values()` now works correctly with `{testthat}` v3.3.0, |
| 52 | + which changed expectation behavior for screenshot snapshots (#418). |
| 53 | + |
| 54 | +* `record_test()` now only saves the setup file for local app testing and not |
| 55 | + within package app testing. When recording a test for an app inside a package, |
| 56 | + `local_app_support()` is added to the top of the testing code. If the current |
| 57 | + working directory is within a package and `record_in_package = TRUE` |
| 58 | + (default), the test file is saved to the package's `tests/testthat/` |
| 59 | + directory. If `record_in_package = FALSE`, the test file is saved relative to |
| 60 | + the app's `tests/testthat/` directory (#328). |
| 61 | + |
| 62 | +* Migrated from `{httr}` to `{httr2}` for all HTTP requests made by |
| 63 | + `{shinytest2}` (#420, #428). |
31 | 64 |
|
32 | | -* `record_test()` gained a new parameter `record_in_package=`. If `TRUE` and if the current working directory is within a package, the test file will be saved to the package's `tests/testthat/` directory. If `FALSE`, the test file will be saved to the app's `tests/testthat/` directory (#328). |
33 | 65 |
|
34 | 66 | # shinytest2 0.4.1 |
35 | 67 |
|
|
0 commit comments