From 9342a23737e4a8b31de92b04a3104859fd37e42e Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 25 Apr 2022 09:38:01 +0200 Subject: [PATCH] docs: add mention of expect breaking change to upgrade guide (#12730) --- docs/UpgradingToJest28.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/UpgradingToJest28.md b/docs/UpgradingToJest28.md index 9c507970ad99..fc1a91f2a666 100644 --- a/docs/UpgradingToJest28.md +++ b/docs/UpgradingToJest28.md @@ -47,6 +47,10 @@ The `testURL` option is removed. Now you should use [`testEnvironmentOptions`](C `babel-jest` now passes `root: config.rootDir` to Babel when resolving configuration. This improves compatibility when using `projects` with differing configuration, but it might mean your babel config isn't picked up in the same way anymore. You can override this option by passing options to `babel-jest` in your [configuration](Configuration.md#transform-objectstring-pathtotransformer--pathtotransformer-object). +## `expect` + +In versions prior to Jest 28, `toHaveProperty` checked for equality instead if existence, which means that e.g. `expect({}).toHaveProperty('a', undefined)` is a passing test. This has been changed in Jest 28 to fail. + ## Fake Timers Fake timers were refactored to allow passing options to the underlying [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers).