Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RN:
Object.defineProperties
for Jest Globals (#37046)
Summary: Pull Request resolved: #37046 Changes React Native's `jest/setup.js` so that globals (e.g. `__DEV__`, `performance`, `window`) are defined using `Object.defineProperties` instead of using object property assignment. This makes the setup logic more resilient to Jest environments (e.g. [`jsdom`](https://github.com/jsdom/jsdom/blob/master/lib/jsdom/browser/Window.js#L422-L424)) where the globals are defined without a setter (i.e. `set` is undefined) or without `writable: true`, because object property assignment to such properties throws an error in strict mode. Changelog: [General][Changed] - Jest globals are now defined using `Object.defineProperties` instead of object property assignment Reviewed By: motiz88 Differential Revision: D45202142 fbshipit-source-id: 5511e374ac6ba051ad0c224b902fb6f20960e9be
- Loading branch information