From 832b88c893eb5c059b16fe3ca1b962a9528b8914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 5 May 2020 20:09:43 +0200 Subject: [PATCH] Add migration notes for breaking changes --- website/blog/2020-05-05-jest-26.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/website/blog/2020-05-05-jest-26.md b/website/blog/2020-05-05-jest-26.md index e1fa707e1c41..7a4b7e268d0a 100644 --- a/website/blog/2020-05-05-jest-26.md +++ b/website/blog/2020-05-05-jest-26.md @@ -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: - `[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). @@ -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.