Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev-mode hack for createDropDownComponent tests #16

Open
jameswilddev opened this issue Oct 24, 2021 · 0 comments
Open

Dev-mode hack for createDropDownComponent tests #16

jameswilddev opened this issue Oct 24, 2021 · 0 comments

Comments

@jameswilddev
Copy link
Owner

jameswilddev commented Oct 24, 2021

If __DEV__ is truthy, React injects a large number of additional elements which interfere with tests.

There is therefore a hack which sets this to false at the top of the Jest helper:

(global as unknown as { __DEV__: boolean }).__DEV__ = false;

This is supposedly derived from NODE_ENV not being production, but applying this change breaks all other tests:

act(...) is not supported in production builds of React, and might not behave as expected.

Is there a better way of resolving this problem?

@jameswilddev jameswilddev changed the title Dev-mode hack in createDropDownComponent tests Dev-mode hack for createDropDownComponent tests Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant