Skip to content

Drop Jest polyfill for requestAnimationFrame #4129

@kentcdodds

Description

@kentcdodds

Sorry, the template didn't really apply here.

I just noticed that in master, react-scripts depends on [email protected]. As of [email protected], jest-environment-jsdom upgraded to [email protected] which includes built-in support for requestAnimationFrame.

I'm fairly confident that all that needs to happen here is to simply remove these lines:

// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
// We don't polyfill it in the browser--this is user's responsibility.
if (process.env.NODE_ENV === 'test') {
require('raf').polyfill(global);
}

Oh, and remove the dependency:

Oh, and while we're at it, if create-react-app is supporting node@>=6 then we can probably get rid of the Object.assign polyfill (and the object-assign dep) as well as the Promise polyfill (and the promise dep).

That should leave the file pretty bare. Something like this I think:

// @remove-on-eject-begin
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
// @remove-on-eject-end
'use strict';

// fetch() polyfill for making API calls.
require('whatwg-fetch');

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions