Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Temp fix for Warning: React depends on requestAnimationFrame. #212

Closed
quantuminformation opened this issue Dec 21, 2017 · 4 comments
Closed

Comments

@quantuminformation
Copy link

Does anyone have a way to get rid of this error when running tests? I know that there is some downstream fixes but I don't want to wait

image

@VasilyShelkov
Copy link

Here is my src/setupTests.ts file which does not display the error:

// tslint:disable-next-line:no-any
(global as any).requestAnimationFrame = (cb: any) => {
  setTimeout(cb, 0)
}

import { configure } from 'enzyme'
import * as Adapter from 'enzyme-adapter-react-16'

configure({ adapter: new Adapter() })

it's key to put the global.requestAnimationFrame before the enzyme imports otherwise it doesn't work. Hope that helps

@cortopy
Copy link

cortopy commented Jan 7, 2018

According to this issue the problem was resolved for the main scripts of create-react-app and there should be no need to mock requestAnimationFrame any more

Does anybody know if typescript scripts need updating or a different solution?

@cortopy
Copy link

cortopy commented Jan 7, 2018

Ah, yes, answering my own question, according to changelog [email protected] was the last merge into this repo. This issue is solved in [email protected]. Hopefully 2.9.0 should fix this

@DorianGrey
Copy link
Collaborator

Should no longer be an issue in recent version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants