Re: [zombie-js] connect ECONNREFUSED when using browser.visit

108 views
Skip to first unread message

Justin C. Rounds

unread,
Jan 19, 2017, 12:11:48 PM1/19/17
to zomb...@googlegroups.com
Are you trying to connect outside of localhost? That is not what
zombiejs is for. From the docs:

Browser.localhost(host, port)

Allows you to make requests against a named domain and HTTP/S port, and
will route it to the test server running on localhost and unprivileged port.

For example, if you want to call your application "example.com", and
redirect traffic from port 80 to the test server that's listening on
port 3000, you can do this:

Browser.localhost('example.com', 3000)
browser.visit('/path', function() {
console.log(browser.location.href);
});
=> 'http://example.com/path'

Thus you can have your web application running on whatever port and
internally your tests can use a sensible domain/path URL (to emulate a
real browser).

HTH

–J


On 1/19/17 11:42 AM, cOborski wrote:
> I can't seem to connect to any website using zombie.js, this is the code
> I'm using:
>
>
> const http = require('http')
>> const Browser = require('zombie');
>> var browser = new Browser();
>> Browser.localhost('google.com', 80); // I've tried a number of different
>> sites and different ports as well as http://google.com,
>> https://google.com...
>> browser.visit("/", function(err) { //I've also tried different paths ex.
>> /#q=zombie.js
>> if (err) {
>> throw (err.message)
>> };
>> });
>
>
> I always get the error:
>
> throw error;
>> ^
>> connect ECONNREFUSED 127.0.0.1:80
>

cOborski

unread,
Mar 23, 2017, 2:38:26 PM3/23/17
to zombie.js
Thank you for replying to my message. I was trying to connect outside of localhost. The project I was working on took a different route though, and we're no longer using zombie.js - which is good since we were not using it for its intended purpose.
Reply all
Reply to author
Forward
0 new messages