vendredi 4 octobre 2019

Getting connect ECONNREFUSED 127.0.0.1:80 error when running supertest

My student got a connect ECONNREFUSED 127.0.0.1:80 error when running the following test:

it("returns status code 200", () => {
  return request(app)
    .get("./about")
    .expect(200)
});

My student is using supertest for HTTP assertions on superagent requests. They are using jest as their test runner.

Background

One of my students encountered this problem and we eventually found the error to be a small typo in the route.

Since it took us a while to find the solution, I thought of posting the question here in case anyone else who has the same problem can find the solution easily.

Hope this helps someone.

2 commentaires: