From f9814d2b4004cc99151ebaf04a2765cf0d5a844f Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 1 Dec 2021 14:58:10 +0100 Subject: [PATCH] fix: remove `@types/jsdom` dependency (#12107) --- CHANGELOG.md | 6 ++++++ packages/jest-environment-jsdom/package.json | 4 ++-- packages/jest-environment-jsdom/src/index.ts | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be20d726c16f..d46ba9504fef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ ### Performance +## 27.4.3 + +### Fixes + +- `[jest-environment-jsdom]` Remove `@types/jsdom` dependency (and make its `dom` property `private`) ([#12107](https://github.com/facebook/jest/pull/12107)) + ## 27.4.2 ### Fixes diff --git a/packages/jest-environment-jsdom/package.json b/packages/jest-environment-jsdom/package.json index 2073488b6ef7..7dc9f3f1d71f 100644 --- a/packages/jest-environment-jsdom/package.json +++ b/packages/jest-environment-jsdom/package.json @@ -20,14 +20,14 @@ "@jest/environment": "^27.4.2", "@jest/fake-timers": "^27.4.2", "@jest/types": "^27.4.2", - "@types/jsdom": "^16.2.4", "@types/node": "*", "jest-mock": "^27.4.2", "jest-util": "^27.4.2", "jsdom": "^16.6.0" }, "devDependencies": { - "@jest/test-utils": "^27.4.2" + "@jest/test-utils": "^27.4.2", + "@types/jsdom": "^16.2.4" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" diff --git a/packages/jest-environment-jsdom/src/index.ts b/packages/jest-environment-jsdom/src/index.ts index 1aab227fdb71..006f2357e83e 100644 --- a/packages/jest-environment-jsdom/src/index.ts +++ b/packages/jest-environment-jsdom/src/index.ts @@ -23,11 +23,11 @@ type Win = Window & }; class JSDOMEnvironment implements JestEnvironment { - dom: JSDOM | null; + private dom: JSDOM | null; fakeTimers: LegacyFakeTimers | null; fakeTimersModern: ModernFakeTimers | null; global: Win; - errorEventListener: ((event: Event & {error: Error}) => void) | null; + private errorEventListener: ((event: Event & {error: Error}) => void) | null; moduleMocker: ModuleMocker | null; constructor(config: Config.ProjectConfig, options?: EnvironmentContext) {