Skip to content

Commit

Permalink
Polyfill rAF in test environment (facebook#3340)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Oct 28, 2017
1 parent 6ca9a5f commit c9ea562
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ require('whatwg-fetch');
// Object.assign() is commonly used with React.
// It will use the native implementation if it's present and isn't buggy.
Object.assign = require('object-assign');

// 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);
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.6",
"promise": "8.0.1",
"raf": "3.4.0",
"react-dev-utils": "^4.1.0",
"style-loader": "0.19.0",
"sw-precache-webpack-plugin": "0.11.4",
Expand Down

0 comments on commit c9ea562

Please sign in to comment.