Socket
Socket
Sign inDemoInstall

nock

Package Overview
Dependencies
Maintainers
1
Versions
430
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nock - npm Package Compare versions

Comparing version 0.8.0 to 0.8.2

2

lib/request_overrider.js

@@ -161,4 +161,4 @@ var Piper = require('./piper'),

function callnext() {
process.nextTick(function() {
if (paused || next.length === 0 || aborted) { return; }
process.nextTick(function() {
next.shift()();

@@ -165,0 +165,0 @@ callnext();

@@ -218,2 +218,3 @@ var path = require('path')

, put: put
, intercept: intercept
, done: done

@@ -220,0 +221,0 @@ , isDone: isDone

{ "name" : "nock"
, "description" : "HTTP Server mocking for Node.js"
, "tags" : ["Mock", "HTTP", "testing", "isolation"]
, "version" : "0.8.0"
, "version" : "0.8.2"
, "author" : "Pedro Teixeira <pedro.teixeira@gmail.com>"

@@ -13,2 +13,4 @@ , "contributors" :

, {"name":"nilsbunger"}
, {"name": "bacchusrx", "email": "bacchusrx@eightstar.ca"}
, {"name": "Fabiano França"}
]

@@ -15,0 +17,0 @@ , "repository" :

@@ -1011,2 +1011,55 @@ var nock = require('../.')

});
tap.test("scopes are independent", function(t) {
var scope1 = nock('http://www34.google.com')
.get('/')
.reply(200, "Hello World!");
var scope2 = nock('http://www34.google.com')
.get('/')
.reply(200, "Hello World!");
var req = http.request({
host: "www34.google.com"
, path: '/'
, port: 80
}, function(res) {
res.on('end', function() {
t.ok(scope1.isDone());
t.ok(! scope2.isDone()); // fails
t.end();
});
});
req.end();
});
tap.test("two scopes with the same request are consumed", function(t) {
var scope1 = nock('http://www36.google.com')
.get('/')
.reply(200, "Hello World!");
var scope2 = nock('http://www36.google.com')
.get('/')
.reply(200, "Hello World!");
var doneCount = 0;
function done() {
doneCount += 1;
if (doneCount == 2) {
t.end();
}
}
for (var i = 0; i < 2; i += 1) {
var req = http.request({
host: "www36.google.com"
, path: '/'
, port: 80
}, function(res) {
res.on('end', done);
});
req.end();
}
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc