From 6c8998acb1b803db30a0ed3ac9e89966dfa861ed Mon Sep 17 00:00:00 2001 From: Yadd Date: Tue, 13 Sep 2022 15:38:09 +0200 Subject: [PATCH 1/3] Replace deprecated call to __proto__ by Object.setPrototypeOf --- packages/jest-haste-map/src/watchers/WatchmanWatcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jest-haste-map/src/watchers/WatchmanWatcher.js b/packages/jest-haste-map/src/watchers/WatchmanWatcher.js index c7f8791bf34b..9de55fa0f1c9 100644 --- a/packages/jest-haste-map/src/watchers/WatchmanWatcher.js +++ b/packages/jest-haste-map/src/watchers/WatchmanWatcher.js @@ -35,7 +35,7 @@ export default function WatchmanWatcher(dir, opts) { } // eslint-disable-next-line no-proto -WatchmanWatcher.prototype.__proto__ = EventEmitter.prototype; +Object.setPrototypeOf(WatchmanWatcher.prototype, EventEmitter.prototype); /** * Run the watchman `watch` command on the root and subscribe to changes. From b740dca81e9e51ae61ef1ca6244ab0f7c5ff47ed Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 13 Sep 2022 16:31:55 +0200 Subject: [PATCH 2/3] Update packages/jest-haste-map/src/watchers/WatchmanWatcher.js --- packages/jest-haste-map/src/watchers/WatchmanWatcher.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/jest-haste-map/src/watchers/WatchmanWatcher.js b/packages/jest-haste-map/src/watchers/WatchmanWatcher.js index 9de55fa0f1c9..69ef94afaf0f 100644 --- a/packages/jest-haste-map/src/watchers/WatchmanWatcher.js +++ b/packages/jest-haste-map/src/watchers/WatchmanWatcher.js @@ -34,7 +34,6 @@ export default function WatchmanWatcher(dir, opts) { this.init(); } -// eslint-disable-next-line no-proto Object.setPrototypeOf(WatchmanWatcher.prototype, EventEmitter.prototype); /** From eb88c450872d0bd48fe9b4fab1934a1a05ea503a Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 13 Sep 2022 16:33:28 +0200 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3776019161..c03a2274fc3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Fixes +- `[jest-haste-map]` Remove `__proto__` usage ([#13256](https://github.com/facebook/jest/pull/13256)) - `[jest-mock]` Improve `spyOn` typings to handle optional properties ([#13247](https://github.com/facebook/jest/pull/13247)) ### Chore & Maintenance