测试react-router v4以及redux并实现store持久化

polyfills.js 856B

1234567891011121314151617181920212223
  1. 'use strict';
  2. if (typeof Promise === 'undefined') {
  3. // Rejection tracking prevents a common issue where React gets into an
  4. // inconsistent state due to an error, but it gets swallowed by a Promise,
  5. // and the user has no idea what causes React's erratic future behavior.
  6. require('promise/lib/rejection-tracking').enable();
  7. window.Promise = require('promise/lib/es6-extensions.js');
  8. }
  9. // fetch() polyfill for making API calls.
  10. require('whatwg-fetch');
  11. // Object.assign() is commonly used with React.
  12. // It will use the native implementation if it's present and isn't buggy.
  13. Object.assign = require('object-assign');
  14. // In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
  15. // We don't polyfill it in the browser--this is user's responsibility.
  16. if (process.env.NODE_ENV === 'test') {
  17. require('raf').polyfill(global);
  18. }