From 34f20a91b6e1e0cb0ea8798f4b859d0feb4cb59c Mon Sep 17 00:00:00 2001 From: Nico Jansen Date: Thu, 5 May 2022 19:49:13 +0200 Subject: [PATCH 1/4] docs(upgrading): detail changes to NodeEnvironment export --- website/versioned_docs/version-28.0/UpgradingToJest28.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/website/versioned_docs/version-28.0/UpgradingToJest28.md b/website/versioned_docs/version-28.0/UpgradingToJest28.md index 0ab7f4a03878..dd22fb956f47 100644 --- a/website/versioned_docs/version-28.0/UpgradingToJest28.md +++ b/website/versioned_docs/version-28.0/UpgradingToJest28.md @@ -140,6 +140,13 @@ The constructor of [test environment](Configuration.md#testenvironment-string) c + const config = projectConfig; ``` +In addition, test environments `"jest-environment-node"` is now exporting it's environment with a default export, instead of simply exporting the class directly: + +```diff +- const NodeEnvironment = require('jest-environment-node'); ++ const NodeEnvironment = require('jest-environment-node').default; +``` + ### `jsdom` If you are using JSDOM [test environment](Configuration.md#testenvironment-string), `jest-environment-jsdom` package now must be installed separately: From e023c79d5bef753cffd6455b46db714af961fd3e Mon Sep 17 00:00:00 2001 From: Nico Jansen Date: Thu, 5 May 2022 21:23:06 +0200 Subject: [PATCH 2/4] Update UpgradingToJest28.md --- website/versioned_docs/version-28.0/UpgradingToJest28.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/website/versioned_docs/version-28.0/UpgradingToJest28.md b/website/versioned_docs/version-28.0/UpgradingToJest28.md index dd22fb956f47..f870a86878c3 100644 --- a/website/versioned_docs/version-28.0/UpgradingToJest28.md +++ b/website/versioned_docs/version-28.0/UpgradingToJest28.md @@ -140,11 +140,14 @@ The constructor of [test environment](Configuration.md#testenvironment-string) c + const config = projectConfig; ``` -In addition, test environments `"jest-environment-node"` is now exporting it's environment with a default export, instead of simply exporting the class directly: +In addition, test environments are now exported with the name `TestEnvironment`, instead of simply exporting the class directly: ```diff -- const NodeEnvironment = require('jest-environment-node'); -+ const NodeEnvironment = require('jest-environment-node').default; +- const TestEnvironment = require('jest-environment-node'); ++ const { TestEnvironment } = require('jest-environment-node'); + +- const TestEnvironment = require('jest-environment-jsdom'); ++ const { TestEnvironment } = require('jest-environment-jsdom'); ``` ### `jsdom` From 633fcb929ec397d4140edd5a33adb1ff23154435 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 6 May 2022 11:25:28 +0200 Subject: [PATCH 3/4] versioned docs --- docs/UpgradingToJest28.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/UpgradingToJest28.md b/docs/UpgradingToJest28.md index df64e6a475a9..844ab936fa7b 100644 --- a/docs/UpgradingToJest28.md +++ b/docs/UpgradingToJest28.md @@ -140,6 +140,16 @@ The constructor of [test environment](Configuration.md#testenvironment-string) c + const config = projectConfig; ``` +In addition, test environments are now exported with the name `TestEnvironment`, instead of simply exporting the class directly: + +```diff +- const TestEnvironment = require('jest-environment-node'); ++ const { TestEnvironment } = require('jest-environment-node'); + +- const TestEnvironment = require('jest-environment-jsdom'); ++ const { TestEnvironment } = require('jest-environment-jsdom'); +``` + ### `jsdom` If you are using JSDOM [test environment](Configuration.md#testenvironment-string), `jest-environment-jsdom` package now must be installed separately: From 66021ad7c200f493481ed7b9212d735531fc8890 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 6 May 2022 11:38:36 +0200 Subject: [PATCH 4/4] match code style --- docs/UpgradingToJest28.md | 4 ++-- website/versioned_docs/version-28.0/UpgradingToJest28.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/UpgradingToJest28.md b/docs/UpgradingToJest28.md index 844ab936fa7b..485cc51d9d31 100644 --- a/docs/UpgradingToJest28.md +++ b/docs/UpgradingToJest28.md @@ -144,10 +144,10 @@ In addition, test environments are now exported with the name `TestEnvironment`, ```diff - const TestEnvironment = require('jest-environment-node'); -+ const { TestEnvironment } = require('jest-environment-node'); ++ const {TestEnvironment} = require('jest-environment-node'); - const TestEnvironment = require('jest-environment-jsdom'); -+ const { TestEnvironment } = require('jest-environment-jsdom'); ++ const {TestEnvironment} = require('jest-environment-jsdom'); ``` ### `jsdom` diff --git a/website/versioned_docs/version-28.0/UpgradingToJest28.md b/website/versioned_docs/version-28.0/UpgradingToJest28.md index f870a86878c3..3e2eee4a9a5d 100644 --- a/website/versioned_docs/version-28.0/UpgradingToJest28.md +++ b/website/versioned_docs/version-28.0/UpgradingToJest28.md @@ -144,10 +144,10 @@ In addition, test environments are now exported with the name `TestEnvironment`, ```diff - const TestEnvironment = require('jest-environment-node'); -+ const { TestEnvironment } = require('jest-environment-node'); ++ const {TestEnvironment} = require('jest-environment-node'); - const TestEnvironment = require('jest-environment-jsdom'); -+ const { TestEnvironment } = require('jest-environment-jsdom'); ++ const {TestEnvironment} = require('jest-environment-jsdom'); ``` ### `jsdom`