From b30f908738fe8bdb0c969638683bb9748efc774c Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 25 Apr 2022 17:58:46 +0200 Subject: [PATCH] chore: mention exports being breaking in upgrade guide (#12739) --- docs/UpgradingToJest28.md | 4 ++++ website/versioned_docs/version-28.0/UpgradingToJest28.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/UpgradingToJest28.md b/docs/UpgradingToJest28.md index fc1a91f2a666..cc18c683b547 100644 --- a/docs/UpgradingToJest28.md +++ b/docs/UpgradingToJest28.md @@ -157,6 +157,10 @@ npm install --save-dev jest-jasmine2 } ``` +## `package.json` `exports` + +Jest now includes full support for [package `exports`](https://nodejs.org/api/packages.html#exports), which might mean that files you import are not resolved correctly. Additionally, Jest now supplies more conditions. `jest-environment-node` has `node` and `node-addons`, while `jest-environment-jsdom` has `browser`. As a result, you might e.g. get browser code which assumes ESM, when Jest provides `['require', 'browser']`. You can either report a bug to the library (or Jest, the implementation is new and might have bugs!) or override the conditions Jest passes. + ## TypeScript :::info diff --git a/website/versioned_docs/version-28.0/UpgradingToJest28.md b/website/versioned_docs/version-28.0/UpgradingToJest28.md index fc1a91f2a666..cc18c683b547 100644 --- a/website/versioned_docs/version-28.0/UpgradingToJest28.md +++ b/website/versioned_docs/version-28.0/UpgradingToJest28.md @@ -157,6 +157,10 @@ npm install --save-dev jest-jasmine2 } ``` +## `package.json` `exports` + +Jest now includes full support for [package `exports`](https://nodejs.org/api/packages.html#exports), which might mean that files you import are not resolved correctly. Additionally, Jest now supplies more conditions. `jest-environment-node` has `node` and `node-addons`, while `jest-environment-jsdom` has `browser`. As a result, you might e.g. get browser code which assumes ESM, when Jest provides `['require', 'browser']`. You can either report a bug to the library (or Jest, the implementation is new and might have bugs!) or override the conditions Jest passes. + ## TypeScript :::info