You already asked, and accepted an answer I wrote, on this question, in which I told you that
supertest
does not use
app.listen()
. You cannot test your application in this manner without using
supertest
if you don't want to reinvent the wheel. Use supertest,
that's what it is there for. Just because you call this type of test a 'unit test' doesn't make it so. Unit testing is when you test a singular function. You cannot test
GET /
with a single function because that necessarily involves two moving parts - the router and the function that is assigned to that route. —
Dan Pantry 1 min ago