polyfills.js
This file
Path
__tests__/polyfills.js
86 lines · 1.9 KiB · JavaScript
Last changed by
fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2
History of this fileTake it
The walk stopped after 200 commits: lines older than f9cd736 point at it.
fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2
line 1why, one step back1const {assign, getOwnPropertyDescriptors} = Objecttest: improve "nested producer" testsaleclarsonbefore adoptionf9cd736
lines 2–4why, one step back2const {ownKeys} = Reflect3const SymbolConstructor = Symbol4fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2
lines 5–6why, one step back5const testSymbol = Symbol("test-symbol")6test: improve "nested producer" testsaleclarsonbefore adoptionf9cd736
lines 7–9why, one step back7Symbol = undefined8Object.assign = undefined9Reflect.ownKeys = undefinedfix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2
line 10why, one step back10Object.getOwnPropertyDescriptors = undefinedtest: improve "nested producer" testsaleclarsonbefore adoptionf9cd736
lines 11–12why, one step back1112jest.resetModules()fix: Map and Set instantions won't work on certain environments, fixes #502Michel Weststratebefore adoption9f4711a
line 13why, one step back13const common = require("../src/internal")test: improve "nested producer" testsaleclarsonbefore adoptionf9cd736
lines 14–18why, one step back1415// Reset the globals to avoid unintended effects.16Symbol = SymbolConstructor17Object.assign = assign18Reflect.ownKeys = ownKeysfix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2
line 19why, one step back19Object.getOwnPropertyDescriptors = getOwnPropertyDescriptorstest: improve "nested producer" testsaleclarsonbefore adoptionf9cd736
line 20why, one step back20chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 21–35why, one step back21if (!global.USES_BUILD)22 describe("Symbol", () => {23 test("NOTHING", () => {24 const value = common.NOTHING25 expect(value).toBeTruthy()26 expect(typeof value).toBe("object")27 })28 test("DRAFTABLE", () => {29 const value = common.DRAFTABLE30 expect(typeof value).toBe("string")31 })32 test("DRAFT_STATE", () => {33 const value = common.DRAFT_STATE34 expect(typeof value).toBe("string")35 })style: use tabsuse-tabsbefore adoptiona9c0fd0
line 36why, one step back36 })test: improve "nested producer" testsaleclarsonbefore adoptionf9cd736
line 37why, one step back37chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 38–40why, one step back38if (!global.USES_BUILD)39 describe("Reflect.ownKeys", () => {40 const {ownKeys} = commontest: improve "nested producer" testsaleclarsonbefore adoptionf9cd736
line 41why, one step back41chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 42–47why, one step back42 // Symbol keys are always last.43 it("includes symbol keys", () => {44 const s = SymbolConstructor()45 const obj = {[s]: 1, b: 1}46 expect(ownKeys(obj)).toEqual(["b", s])47 })test: improve "nested producer" testsaleclarsonbefore adoptionf9cd736
line 48why, one step back48chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 49–52why, one step back49 it("includes non-enumerable keys", () => {50 const obj = {a: 1}51 Object.defineProperty(obj, "b", {value: 1})52 expect(ownKeys(obj)).toEqual(["a", "b"])fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2
lines 53–80why, one step back53 })54 })5556if (!global.USES_BUILD)57 describe("Object.getOwnPropertyDescriptors", () => {58 const {getOwnPropertyDescriptors} = common5960 // Symbol keys are always last.61 it("gets symbolic and nonsymbolic properties", () => {62 expect(63 Object.getOwnPropertyDescriptors({64 x: 1,65 [testSymbol]: 266 })67 ).toEqual({68 x: {69 value: 1,70 enumerable: true,71 configurable: true,72 writable: true73 },74 [testSymbol]: {75 value: 2,76 enumerable: true,77 configurable: true,78 writable: true79 }80 })chore: verify build during testMichel Weststratebefore adoptionef8990b
line 81why, one step back81 })style: use tabsuse-tabsbefore adoptiona9c0fd0
line 82why, one step back82 })chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 83–85why, one step back8384test("suppress jest warning", () => {85 expect(true).toBe(true)test: improve "nested producer" testsaleclarsonbefore adoptionf9cd736
line 86why, one step back86})