Skip to content

Instantly share code, notes, and snippets.

@gaearon
Last active October 14, 2019 15:06
Show Gist options
  • Select an option

  • Save gaearon/9a4d54653ae9c50af6c54b4e0e56b583 to your computer and use it in GitHub Desktop.

Select an option

Save gaearon/9a4d54653ae9c50af6c54b4e0e56b583 to your computer and use it in GitHub Desktop.
@ninjasort

Copy link
Copy Markdown

Any chance you can just bake this into React 16? Why do we need to add it to application code? Who wouldn't want to have access to it?

@biuuu

biuuu commented Sep 30, 2017

Copy link
Copy Markdown

@guyellis I found some site has polyfill like this:
<script defer>window.Map||document.write('<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>')</script>
How about this solution.

@rockchalkwushock

Copy link
Copy Markdown

I am using create-react-app and trying to implement this but it does not support passing jest.setupFiles in the package.json. I've been going through the jest docs but haven't found anything yet on a CLI flag for passing this information to react-scripts test. Has anyone figured this out?

@pedro-mass

Copy link
Copy Markdown

@rockchalkwushock

Copy link
Copy Markdown

@pedro-mass

Thanks! Now I understand that --setupTestFrameworkScriptFile is the CLI flag as well. So thankful for --showConfig to see the underlying config being applied ๐Ÿ™

@acatl

acatl commented Oct 6, 2017

Copy link
Copy Markdown

this fixed the issue for me in Jest jestjs/jest#4545 (comment)

@jtrein

jtrein commented Oct 11, 2017

Copy link
Copy Markdown

Cheers, @capaj!

>$  yarn add raf --dev

// package.json
...

"jest": {
  "setupFiles": [
      "raf/polyfill"
    ]
},

...

BEFORE
screen shot 2017-10-11 at 11 49 36

AFTER
screen shot 2017-10-11 at 11 49 55

@karthickyuva

karthickyuva commented Oct 13, 2017 •

Copy link
Copy Markdown

@capaj, Great... ๐Ÿ‘

// package.json

...
"setupFiles": [
"raf/polyfill"
]
...

Thanks!.. am using jest package and now its fixed my console warning
console.error node_modules/fbjs/lib/warning.js:33
Warning: React depends on requestAnimationFrame. Make sure that you load a polyfill in older browsers. http://fb.me/react-polyfills

@isaldin

isaldin commented Oct 26, 2017

Copy link
Copy Markdown

@capaj, thanks!)

@neomusic

Copy link
Copy Markdown

@capaj, Thanks!!!

@1Jesper1

Copy link
Copy Markdown

@capaj, Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment