-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Testing in Create React App #21
Comments
You can't run websocket libraries in NodeJS. This isn't a limitation of sockette but of NodeJS itself, it just doesn't provide the same WebSocket api as browsers. You need to adjust your tests or your application to use a different or emulated code path depending on the environment it's in. Something like this: if (typeof WebSocket !== "undefined") {
// Do real WebSocket stuff in the browser
} else {
// We're in NodeJS, no WebSocket API!
} |
What @ClickSimply said is correct. There's no You can use something like Personally, I haven't tested Sockette extending from WebSocket replacement (since this is a browser module). But if I ever get around to writing tests for this library, I'd use either of those replacements to do so. Hope that helps! |
Thanks @ClickSimply , I only saw your response after this issue was closed. Thanks also to @lukeed. |
I built my app starting with the convenient create-react-app. It comes with Jest built in for testing. However, I can't run any tests because of the following error:
The text was updated successfully, but these errors were encountered: