From 8a62583f794875e6dc5d1e4a24889b3b702d9f86 Mon Sep 17 00:00:00 2001 From: Chris Shepherd Date: Wed, 21 Jul 2021 15:35:27 -0700 Subject: [PATCH] Fix mislabelled polyfills for Object.entries and Object.values (#31880) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: The polyfills for `Object.entries` and `Object.values` are in a file named `Object.es7.js` when these APIs form part of ES8/ES2017 (https://en.wikipedia.org/wiki/ECMAScript#8th_Edition_–_ECMAScript_2017). The docs (https://reactnative.dev/docs/javascript-environment#polyfills) list these correctly as ES8 so I thought it might reduce confusion if anyone starts looking into the polyfills in the future like I did. ## Changelog [Internal] [Fixed] - Fix filename to include correct ECMA spec Pull Request resolved: https://github.com/facebook/react-native/pull/31880 Test Plan: All unit tests pass. Reviewed By: yungsters Differential Revision: D29820165 Pulled By: ShikaSD fbshipit-source-id: 2a4eb58bed7b7a4089406665c5c9115cb1773ff6 --- jest/setup.js | 2 +- packages/polyfills/{Object.es7.js => Object.es8.js} | 0 .../__tests__/{Object.es7-test.js => Object.es8-test.js} | 4 ++-- packages/polyfills/index.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename packages/polyfills/{Object.es7.js => Object.es8.js} (100%) rename packages/polyfills/__tests__/{Object.es7-test.js => Object.es8-test.js} (98%) diff --git a/jest/setup.js b/jest/setup.js index 2ffa8ecddfb9c4..9a439f81537530 100644 --- a/jest/setup.js +++ b/jest/setup.js @@ -12,7 +12,7 @@ const MockNativeMethods = jest.requireActual('./MockNativeMethods'); const mockComponent = jest.requireActual('./mockComponent'); -jest.requireActual('@react-native/polyfills/Object.es7'); +jest.requireActual('@react-native/polyfills/Object.es8'); jest.requireActual('@react-native/polyfills/error-guard'); global.__DEV__ = true; diff --git a/packages/polyfills/Object.es7.js b/packages/polyfills/Object.es8.js similarity index 100% rename from packages/polyfills/Object.es7.js rename to packages/polyfills/Object.es8.js diff --git a/packages/polyfills/__tests__/Object.es7-test.js b/packages/polyfills/__tests__/Object.es8-test.js similarity index 98% rename from packages/polyfills/__tests__/Object.es7-test.js rename to packages/polyfills/__tests__/Object.es8-test.js index c51c32c7f9ae76..b52771226eb16e 100644 --- a/packages/polyfills/__tests__/Object.es7-test.js +++ b/packages/polyfills/__tests__/Object.es8-test.js @@ -10,12 +10,12 @@ 'use strict'; -describe('Object (ES7)', () => { +describe('Object (ES8)', () => { beforeEach(() => { delete Object.entries; delete Object.values; jest.resetModules(); - require('../Object.es7'); + require('../Object.es8'); }); describe('Object.entries', () => { diff --git a/packages/polyfills/index.js b/packages/polyfills/index.js index b4dd4b63c6754c..4b515f6a755cb1 100644 --- a/packages/polyfills/index.js +++ b/packages/polyfills/index.js @@ -12,5 +12,5 @@ module.exports = () => [ require.resolve('./console.js'), require.resolve('./error-guard.js'), - require.resolve('./Object.es7.js'), + require.resolve('./Object.es8.js'), ];