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

fix(env): improve env detection compatibility for Node #1111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

liamjones
Copy link

The React Native test environment is Node but sets up a window global: https://github.com/facebook/react-native/blob/7a85b911254dbae9fac4c6d8a862a20c33e0b36a/packages/react-native/Libraries/Core/setUpGlobals.js#L18

Reintroduce the navigator.userAgent check as a fallback for detecting a Node environment

The React Native test environment *is* Node but sets up a window global: https://github.com/facebook/react-native/blob/7a85b911254dbae9fac4c6d8a862a20c33e0b36a/packages/react-native/Libraries/Core/setUpGlobals.js#L18

Reintroduce the navigator.userAgent check as a fallback for detecting a Node environment
@liamjones
Copy link
Author

Without this tests in an RN environment fall over on this line:

const style = document.documentElement.style;

As there's a window but no document

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

Successfully merging this pull request may close these issues.

1 participant