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 authored and F3n67u committed May 2, 2022
1 parent b4bfcec commit f27cc48
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
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
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 f27cc48

Please sign in to comment.