Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

unexpected-mitm

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unexpected-mitm - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

@@ -335,2 +335,4 @@ /* global setImmediate, after */

this.shift(expect, subject, 0);
} catch (e) {
handleError(e);
} finally {

@@ -542,2 +544,4 @@ this.args.pop(); // Prevent the wrapped callback from being inspected when the assertion fails.

this.shift(expect, subject, 1);
} catch (e) {
handleError(e);
} finally {

@@ -544,0 +548,0 @@ this.args.pop(); // Prevent the wrapped callback from being inspected when the assertion fails.

{
"name": "unexpected-mitm",
"version": "2.1.0",
"version": "2.1.1",
"description": "Unexpected plugin for the mitm library",

@@ -5,0 +5,0 @@ "main": "lib/unexpectedMitm.js",

@@ -29,2 +29,10 @@ /*global describe, it, __dirname*/

it('should not break when the assertion being delegated to throws synchronously', function (done) {
expect('http://www.google.com/', 'with http mocked out', [], 'to foobarquux', function (err) {
expect(err, 'to be an', Error);
expect(err.output.toString(), 'to match', /^Unknown assertion "to foobarquux"/);
done();
});
});
// Awaiting https://github.com/moll/node-mitm/issues/10

@@ -354,5 +362,16 @@ describe('when mocking out an https request and asserting that the request is https', function () {

it('should record an error', function (done) {
expect('http://www.icwqjecoiqwjecoiwqjecoiwqjceoiwq.com/', 'with http recorded', 'to yield response', (function () {var err = new Error('getaddrinfo EADDRINFO'); err.code = 'EADDRINFO'; err.errno = 'EADDRINFO'; err.syscall = 'getaddrinfo';return err;}()), done);
var expectedError;
// I do not know the exact version where this change was introduced. Hopefully this is enough to get
// it working on Travis (0.10.36 presently):
if (process.version === 'v0.10.29') {
expectedError = new Error('getaddrinfo EADDRINFO');
expectedError.code = expectedError.errno = 'EADDRINFO';
} else {
expectedError = new Error('getaddrinfo ENOTFOUND');
expectedError.code = expectedError.errno = 'ENOTFOUND';
}
expectedError.syscall = 'getaddrinfo';
expect('http://www.icwqjecoiqwjecoiwqjecoiwqjceoiwq.com/', 'with http recorded', 'to yield response', expectedError, done);
});
});