ladjs / supertest

🕷 Super-agent driven library for testing node.js HTTP servers using a fluent API. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SuperTest is not compatible with Node v18.19.0 Error: ECONNREFUSED: Connection Refused

brianpilati opened this issue · comments

Describe the bug

Node.js version: v18.19.0

OS version: Ventura 13.6.1

Description: SuperTest is not compatible with Node v18.19.0 Error: ECONNREFUSED: Connection Refused

Actual behavior

If I run supertest with node@16.20.2, all my test pass. If I run it with node@18.19.0, none of my tests run and I can an error

Expected behavior

Tests to run like using node@16.20.2

Code to reproduce

at Test.assert (/Users/brian.pilati/code/greenseed/prism/subscription/prism-subscription-api/node_modules/supertest/lib/test.js:156:20)
at localAssert (/Users/brian.pilati/code/greenseed/prism/subscription/prism-subscription-api/node_modules/supertest/lib/test.js:120:14)
at /Users/brian.pilati/code/greenseed/prism/subscription/prism-subscription-api/node_modules/supertest/lib/test.js:125:7
at Request.callback (/Users/brian.pilati/code/greenseed/prism/subscription/prism-subscription-api/node_modules/superagent/lib/node/index.js:867:3)
at ClientRequest. (/Users/brian.pilati/code/greenseed/prism/subscription/prism-subscription-api/node_modules/superagent/lib/node/index.js:789:10)
at ClientRequest.emit (node:events:517:28)
at Socket.socketErrorListener (node:_http_client:501:9)
at Socket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)

console log from line 156

Error: connect ECONNREFUSED 127.0.0.1:3999
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3999,
  response: undefined
}

I did remove all my node_modules and reinstall using node@18 and there was no change.

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

I am also seeing the issue with node 20.10.0

We have been seeing this on randomly during our testing. We are on 18.16.0.

If you want this to get fixed, or at the least reviewed, please submit a working reproducible test case, e.g. another repo on GitHub that shows failure, e.g. via GitHub Actions CI.