hyper-fetch
hyper-fetch copied to clipboard
[Socket] getWebsocketAdapter/getSSEAdapter throws ReferenceError: window is not defined
Describe the bug getWebsocketAdapter and getSSEAdapter throws ReferenceError: window is not defined inside vitest env without jsdom.
To Reproduce
- Create new Socket()
- Try to run a random test using vitest/jest with it.
Expected behavior getWebsocketAdapter/getSSEAdapter should check environment before referencing the window variable. If current environment === webworker/service worker, etc., the window variable should not be referenced at all.
I think it should be fine now 👍🏻