These are similar to `expect` and `expectAsync` except that they throw exceptions rather than recording matcher failures as spec/suite failures. They're intended to support using Jasmine matchers in testing-library's `waitFor`, and also provide a way to integration-test custom matchers. These funtions are not equivalent to `expect` and `expectAsync` and should not be used in situations where you want a matcher failure to reliably fail the spec. Whether that happens depends on the structure of the surrounding code. In general, you should only use `throwUnless` when you expect something (which could be your own code or library code like `waitFor`) to catch the resulting exception. Fixes #2003. Fixes #1980.
17 KiB
17 KiB