Closed MarcusElevait closed 1 week ago
That's really weird, setImmediate
is used in the xmlhttprequest-ssl
package, but it should not be included in the browser build (since the XMLHttpRequest is already provided).
Might be related: https://stackoverflow.com/questions/68708955/jest-test-error-browsertype-launch-setimmediate-is-not-defined-while-using-pl
Can I work on this
I'm getting the same error with "socket.io-client": "^4.7.5". Any update on this ?
This is still an issue for me as well.
For future readers:
This should be fixed by https://github.com/socketio/socket.io/commit/93010ca3c4daf203c7b2c343158ab102f65aee9f, included in engine.io-client@6.6.0
and socket.io-client@4.8.0
.
Describe the bug We have an nx project where we have a library that holds all of our angular services. One of these services is called SocketService and is managing socket-io socket instantiation. When we run our unittests for this library and the tests are running one after another, we get the following error:
ReferenceError: setImmediate is not defined at XMLHttpRequest.dispatchEvent (/home/marcus/projects/aicosy/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js:628:9) at setState (/home/marcus/projects/aicosy/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js:654:12) at XMLHttpRequest.handleError (/home/marcus/projects/aicosy/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js:572:5) at ClientRequest.errorHandler (/home/marcus/projects/aicosy/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js:490:14) at ClientRequest.emit (node:events:520:28) at Socket.socketErrorListener (node:_http_client:442:9) at Socket.emit (node:events:520:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21)
This error occurs on the unittest of the service, that is directly running after the SocketService tests. (No matter which test this is) When I'm skipping the SocketService test, the unittests are succeeding.To Reproduce Here is the code for our SocketService:
and here is the test:
Socket.IO client version:
4.5.1
Expected behavior I expect the error not to be thrown.
Platform: Running with :
Additional context Add any other context about the problem here.