|
1 | 1 | # testthat (development version) |
2 | 2 |
|
| 3 | +* New `expect_disjoint()` to check for the absence of values (@stibu81, #1851). |
| 4 | +* `expect_all_equal()`, `expect_all_true()`, and `expect_all_false()` are a new family of expectations that checks that every element of a vector has the same value. Compared to using `expect_true(all(...))` they give better failure messages (#1836, #2235). |
| 5 | +* Expectations now consistently return the value of the first argument, regardless of whether the expectation succeeds or fails. The primary exception are `expect_message()` and friends which will return the condition. This shouldn't affect existing tests, but will make failures clearer when you chain together multiple expectations (#2246). |
| 6 | +* `set_state_inspector()` gains `tolerance` argument and ignores minor FP differences by default (@mcol, #2237). |
| 7 | +* `expect_vector()` fails, instead of erroring, if `object` is not a vector (@plietar, #2224). |
| 8 | +* New `vignette("mocking")` explains mocking in detail (#1265). |
| 9 | +* New `vignette("challenging-functions")` provides an index to other documentation organised by testing challenges (#1265). |
| 10 | +* When running a test interactively, testthat now reports the number of successes. The results should also be more useful if you are using nested tests. |
| 11 | +* The hints generated by `expect_snapshot()` and `expect_snapshot_file()` now include the path to the package, if it's not in the current working directory (#1577). |
| 12 | +* `expect_snapshot_file()` now clearly errors if the `path` doesn't exist (#2191). |
| 13 | +* `expect_snapshot_file()` now considers `.json` to be a text file (#1593). |
| 14 | +* `expect_snapshot_file()` now shows differences for text files (#1593). |
| 15 | +* The failure messages for all `expect_` functions have been rewritten to first state what was expected and then what was actually received (#2142). |
| 16 | +* `test_file(desc = ...)` no longer loses snapshot results (#2066). |
| 17 | +* In `R CMD check`, snapshots now only advise on how to resolve failures once (#2207). |
| 18 | +* `snapshot_review()` includes a reject button and only displays the file navigation and the skip button if there are multiple files to review (#2025). |
| 19 | +* New `snapshot_download_gh()` makes it easy to get snapshots off GitHub and into your local package (#1779). |
| 20 | +* New `local_mocked_s3_method()`, `local_mocked_s4_method()`, and `local_mocked_r6_class()` allow you to mock S3 and S4 methods and R6 classes (#1892, #1916) |
3 | 21 | * `expect_snapshot_file(name=)` must have a unique file path. If a snapshot file attempts to be saved with a duplicate `name`, an error will be thrown. (#1592) |
4 | | -* `test_dir()`, `test_file()`, `test_package()`, `test_check()`, `test_local()`, `source_file()` gain a `shuffle` argument uses `sample()` to randomly reorder the top-level expressions in each test file (#1942). This random reordering surfaces dependencies between tests and code outside of any test, as well as dependencies between tests. This helps you find and eliminate unintentional dependencies. |
| 22 | +* `test_dir()`, `test_file()`, `test_package()`, `test_check()`, `test_local()`, `source_file()` gain a `shuffle` argument that uses `sample()` to randomly reorder the top-level expressions in each test file (#1942). This random reordering surfaces dependencies between tests and code outside of any test, as well as dependencies between tests. This helps you find and eliminate unintentional dependencies. |
5 | 23 | * `snapshot_accept(test)` now works when the test file name contains `.` (#1669). |
6 | 24 | * `local_mock()` and `with_mock()` have been deprecated because they are no longer permitted in R 4.5. |
7 | 25 | * `snapshot_review()` now passes `...` on to `shiny::runApp()` (#1928). |
8 | 26 | * `expect_named()` now gives more informative errors (#2091). |
9 | | -* `expect_*()` functions consistently and rigorously check their inputs (#1754). |
| 27 | +* `expect_*()` functions consistently and rigorously check their inputs (#1754). |
10 | 28 | * `test_that()` no longer warns about the absence of `{}` since it no longer seems to be necessary. |
11 | 29 | * `test_that()`, `describe()`, and `it()` can now be arbitrarily nested. Each component will skip only if it and its subtests don't contain any expectations. The interactive stop reporter has been fixed so it doesn't duplicate failures. (#2063, #2188). |
12 | 30 | * Test filtering now works with `it()`, and the `desc` argument can take a character vector in order to recursively filter subtests (i.e. `it()` nested inside of `describe()`) (#2118). |
13 | 31 | * New `snapshot_reject()` rejects all modified snapshots by deleting the `.new` variants (#1923). |
14 | 32 | * New `SlowReporter` makes it easier to find the slowest tests in your package. The easiest way to run it is with `devtools::test(reporter = "slow")` (#1466). |
15 | | -* Power `expect_mapequal()` with `waldo::compare(list_as_map = TRUE)` (#1521). |
16 | 33 | * On CRAN, `test_that()` now automatically skips if a package is not installed (#1585). Practically, this means that you no longer need to check that suggested packages are installed. (We don't do this in the tidyverse because we think it has limited payoff, but other styles advise differently.) |
17 | 34 | * `expect_snapshot()` no longer skips on CRAN, as that skips the rest of the test. Instead it just returns, neither succeeding nor failing (#1585). |
18 | | -* Interrupting a test now prints the test name. This makes it easier to tell where a very slow test might be hanging (#1464) |
| 35 | +* Interrupting a test now prints the test name. This makes it easier to tell where a very slow test might be hanging (#1464). |
19 | 36 | * Parallel testthat now does not ignore test files with syntax errors (#1360). |
20 | 37 | * `expect_lt()`, `expect_gt()`, and friends have a refined display that is more likely to display the correct number of digits and shows you the actual values compared. |
21 | 38 | * `describe()`, `it()`, and `test_that()` now have a shared stack of descriptions so that if you nest any inside of each other, any resulting failures will show you the full path. |
|
25 | 42 | * New `expect_r6_class()` (#2030). |
26 | 43 | * `expect_*()` functions consistently and rigorously check their inputs (#1754). |
27 | 44 | * `JunitReporter()` no longer fails with `"no applicable method for xml_add_child"` for warnings outside of tests (#1913). Additionally, warnings now save their backtraces. |
28 | | -* `JunitReporter()` strips ANSI escapes in more placese (#1852, #2032). |
| 45 | +* `JunitReporter()` strips ANSI escapes in more places (#1852, #2032). |
29 | 46 | * `try_again()` is now publicised. The first argument is now the number of retries, not tries (#2050). |
30 | | -* `vignette("custom-expectations)` has been overhauled to make it much clearer how to create high-quality expectations (#2113, #2132, #2072). |
| 47 | +* `vignette("custom-expectations")` has been overhauled to make it much clearer how to create high-quality expectations (#2113, #2132, #2072). |
31 | 48 | * `expect_snapshot()` and friends will now fail when creating a new snapshot on CI. This is usually a signal that you've forgotten to run it locally before committing (#1461). |
32 | 49 | * `expect_snapshot_value()` can now handle expressions that generate `-` (#1678) or zero length atomic vectors (#2042). |
33 | 50 | * `expect_matches()` failures should be a little easier to read (#2135, #2181). |
@@ -974,7 +991,7 @@ This release mostly focusses on an overhaul of how testthat works with condition |
974 | 991 | * In `expect_equal_to_reference()`, the default value for `update` is |
975 | 992 | now `FALSE` (@BrodieG, #683). |
976 | 993 |
|
977 | | -* `expect_error()` now returns the error object as documentated (#724). |
| 994 | +* `expect_error()` now returns the error object as documented (#724). |
978 | 995 | It also now warns if you're using a classed expectation and you're |
979 | 996 | not using the `class` argument. This is good practice as it decouples the |
980 | 997 | error object (which tends to be stable) from its rendering to the user |
@@ -1666,7 +1683,7 @@ The reporters system class has been considerably refactored to make existing rep |
1666 | 1683 | * `safe_digest()` uses a better strategy, and returns NA for directories |
1667 | 1684 | (#138, #146). |
1668 | 1685 |
|
1669 | | -* Random praise is renabled by default (again!) (#164). |
| 1686 | +* Random praise is re-enabled by default (again!) (#164). |
1670 | 1687 |
|
1671 | 1688 | * Teamcity reporter now correctly escapes output messages (#150, @windelinckx). |
1672 | 1689 | It also uses nested suites to include test names. |
|
0 commit comments