I'm trying to code a test to my client-server modules. I need to run the server before the client is sending its requests, so I'm trying to use
beforeEach, but the test fails before the server even started running.
When I'm running manually first the server, and then the client with these commands, it works perfectly.
In the test sometimes the client request is sent before the server is listening.
How could it happen?
What am I doing wrong?