diff --git a/test/node/toError.js b/test/node/toError.js index 84aa7d557..4d09b2ea9 100644 --- a/test/node/toError.js +++ b/test/node/toError.js @@ -9,12 +9,12 @@ app.get('/', function(req, res){ res.status(400).send('invalid json'); }); -app.listen(65197); +var server = app.listen(); describe('res.toError()', function(){ it('should return an Error', function(done){ request - .get('http://localhost:65197/') + .get('http://localhost:' + server.address().port) .end(function(err, res){ var err = res.toError(); assert(err.status == 400);