You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to add that it is possible to change the test environment that Jest uses for testing but I think that a feature-detection style improves the quality of the check your code relies on.
The default test environment that Jest uses for testing is a browser-like one through jsdom.
The browser-like environment makes your following line of code fail:
because
typeof window !== 'undefined'
inisBrowser()
evaluates to true butwindow.fetch
is undefined.Maybe, you can directly check against the existence of
window.fetch
instead of relying onisBrowser
.If you agree, I can send you a PR to replace each and every check against
isBrowser
with a feature-detection check.The text was updated successfully, but these errors were encountered: