jest: Async example: Error: connect ECONNREFUSED 127.0.0.1:80
HI , I’m on the window 7, when i run npm test
in examples/async
, it produced errors below:
$ npm test
> @ test D:\study\jest\examples\async
> jest
RUNS __tests__\user-test.js
events.js:160
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 127.0.0.1:80
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)
npm ERR! Test failed. See above for more details.
then, I checked the 80 port, but found nothing:
Administrator@USER-20150722FJ D:\study\jest\examples\async
$ netstat -ano | findstr "127.0.0.1:80"
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 10
- Comments: 16 (6 by maintainers)
@dYb Did you run Jest with --no-cache once, or ran it for the first time with babel-jest > ‘9.0.3’? Which version of Node are you running?
I have this issue with all ^9.0.0 versions of babel-jest ( ‘9.0.1’, ‘9.0.2’, ‘9.0.3’). ‘10.0.1’ works and so does 16 and 17.
edit: tested here on a Windows 10 machine, babel-jest ^9.0.0 not working, 16 and 17 works fine.
@cpojer You’re right, this isn’t the issue, although it works somehow for me (I’m on OSX Sierra).
The example uses babel-jest ^9.0.0. Upgrading to 16.0.0 and running
jest --no-cache
once also solved the issue for me.Same problem here. Looks like the request is actually fired and the mock is not used.
Changing the host is reflected in the error message: