Skip to content

Commit

Permalink
Add migration notes for breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee committed May 5, 2020
1 parent 8cc7492 commit 832b88c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions website/blog/2020-05-05-jest-26.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@ authorFBID: 100000023028168

When we started rebuilding Jest five years ago our goal was to provide a batteries-included zero-configuration test runner that is approachable for beginners, extensible for almost all testing use cases and scalable to large projects. One of the instrumental releases was [Jest 15](https://jestjs.io/blog/2016/09/01/jest-15) which tied everything together and provided good defaults that allowed people to run Jest often without any setup. However, this approach has a big downside as Jest installs a lot of dependencies into your projects that you may not need.

We are now beginning to address this shortcoming and are working on reducing Jest’s install size while keeping it approachable and extensible. We have made the following breaking changes in Jest 26:
We are now beginning to address this shortcoming and are working on reducing Jest’s install size while keeping it approachable and extensible. We have made the following **breaking changes** in Jest 26:

<!--truncate-->

- `[expect, jest-mock, pretty-format]` Remove `ES5` build files with a new minimum of support of ES2015 (Node 8) which were only used for browser builds ([#9945](https://github.com/facebook/jest/pull/9945))

> **Migration**: With this change, we are pushing the responsibility to bundle the affected packages to the users, rather than Jest providing them out of the box, since they know their target environments best. If you want it back, we're open to shipping these as separate packages. PRs welcome!
- `[jest-config, jest-resolve]` Remove support for `browser` field ([#9943](https://github.com/facebook/jest/pull/9943))

> **Migration**: Install `browser-resolve` module and use the following configuration:
```json
{
"jest": {
"resolver": "browser-resolve"
}
}
```

- TypeScript definitions requires a minimum of TypeScript v3.8 ([#9823](https://github.com/facebook/jest/pull/9823))

With the above changes Jest 26 is now 4 MiB smaller than Jest 25.5.4 (53 → 49 MiB). Please keep in mind that many dependencies like Babel are likely already part of your project. Jest's own size was reduced by 1.2 MiB (4.3 -> 3.1 MiB).
Expand Down Expand Up @@ -53,7 +67,7 @@ Jest has relied on globals popularized by the Jasmine testing framework and othe

Caveats:

- Currently the globals still exist in the environment but we will introduce a mode to disable globals in the future. Similarly, you cannot use `const jest = require('@jest/globals')` as you'll get declaration orders because the `jest` variable is still a global for now.
- Currently the globals still exist in the environment but we will introduce a mode to disable globals in the future. Similarly, you cannot use `const jest = require('@jest/globals')` as you'll get declaration errors because the `jest` variable is still a global for now.
- There is currently no way to add custom matchers to the TypeScript definitions when using globals like this.
- While this allows running tests without globals, it does not allow running tests without Jest's test runner at this time.

Expand Down

0 comments on commit 832b88c

Please sign in to comment.