Socket
Socket
Sign inDemoInstall

supertest

Package Overview
Dependencies
9
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 0.6.1

.travis.yml

6

History.md
0.6.1 / 2013-06-02
==================
* fix: EADDRINUSE errnos, use ephemeral ports now
* fix: handling of socket errors
0.6.0 / 2013-04-15

@@ -3,0 +9,0 @@ ==================

15

lib/test.js

@@ -14,8 +14,2 @@

/**
* Starting port.
*/
var port = 3456;
/**
* Expose `Test`.

@@ -65,6 +59,6 @@ */

var addr = app.address();
var portno = addr ? addr.port : port++;
if (!addr) app.listen(portno);
if (!addr) app.listen(0);
var port = app.address().port;
var protocol = app instanceof https.Server ? 'https' : 'http';
return protocol + '://127.0.0.1:' + portno + path;
return protocol + '://127.0.0.1:' + port + path;
};

@@ -125,3 +119,4 @@

var end = Request.prototype.end;
end.call(this, function(res){
end.call(this, function(err, res){
if (err) return fn(err);
self.assert(res, fn);

@@ -128,0 +123,0 @@ });

{
"name": "supertest",
"version": "0.6.0",
"version": "0.6.1",
"description": "Super-agent driven library for testing HTTP servers",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,2 +6,3 @@

, path = require('path')
, should = require('should')
, express = require('express');

@@ -95,2 +96,3 @@

.end(function(err, res){
if (err) return done(err);
res.should.have.status(200);

@@ -141,2 +143,17 @@ res.text.should.equal('hey');

it('should handle socket errors', function(done) {
var app = express();
app.get('/', function(req, res){
res.destroy();
});
request(app)
.get('/')
.end(function(err) {
should.exist(err);
done();
});
})
describe('.expect(status[, fn])', function(){

@@ -143,0 +160,0 @@ it('should assert the response status', function(done){

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc