Skip to content

Commit

Permalink
chore: note change in expect import in upgrade guide
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Apr 26, 2022
1 parent 2ac1a61 commit 7169163
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion docs/UpgradingToJest28.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,19 @@ The `testURL` option is removed. Now you should use [`testEnvironmentOptions`](C

## `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.
In versions prior to Jest 28, `toHaveProperty` checked for equality instead of existence, which means that e.g. `expect({}).toHaveProperty('a', undefined)` is a passing test. This has been changed in Jest 28 to fail.

Additionally, if you import `expect` directly, it has been changed from default export to a named export.

```diff
- import expect from 'expect';
+ import {expect} from 'expect';
```

```diff
- const expect = require('expect');
+ const {expect} = require('expect');
```

## Fake Timers

Expand Down
14 changes: 13 additions & 1 deletion website/versioned_docs/version-28.0/UpgradingToJest28.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,19 @@ The `testURL` option is removed. Now you should use [`testEnvironmentOptions`](C

## `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.
In versions prior to Jest 28, `toHaveProperty` checked for equality instead of existence, which means that e.g. `expect({}).toHaveProperty('a', undefined)` is a passing test. This has been changed in Jest 28 to fail.

Additionally, if you import `expect` directly, it has been changed from default export to a named export.

```diff
- import expect from 'expect';
+ import {expect} from 'expect';
```

```diff
- const expect = require('expect');
+ const {expect} = require('expect');
```

## Fake Timers

Expand Down

0 comments on commit 7169163

Please sign in to comment.