I've been writing integration tests for my NodeJS app using
mongodb-memory-server and for one of my test cases, I was encountering the error
connect ECONNREFUSED 127.0.0.1:80 error whenever I ran the test suite.
The solution is so simple you would not believe it.
Check that the url passed to supertest has a
/ prefix 🤦🏽♀️.
In my case, it was
request.post('api/auth/login') instead of
Powered By Swish