New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unexpected-sinon

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unexpected-sinon - npm Package Compare versions

Comparing version 10.2.1 to 10.3.0

2

lib/unexpected-sinon.js

@@ -251,2 +251,4 @@ /*global location*/

value = { spy: value };
} else if (Array.isArray(value) || isNonEmptyAndHasOnlyNumericalProperties(value)) {
value = { args: value };
}

@@ -253,0 +255,0 @@ var unsupportedKeys = Object.keys(value).filter(function (key) {

9

package.json
{
"name": "unexpected-sinon",
"version": "10.2.1",
"version": "10.3.0",
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>",

@@ -22,3 +22,4 @@ "keywords": [

"test": "mocha --compilers md:unexpected-markdown test/*.js `find documentation -name '*.md'` && npm run lint",
"travis": "npm test && npm run coverage && (<coverage/lcov.info coveralls || true) && npm run generate-site",
"phantom": "phantomjs ./node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/tests.html spec \"`node -pe 'JSON.stringify({useColors:true,grep:process.env.grep})'`\"",
"travis": "npm test && npm run phantom && npm run coverage && (<coverage/lcov.info coveralls || true) && npm run generate-site",
"test-browser": "serve .",

@@ -41,4 +42,6 @@ "coverage": "NODE_ENV=development istanbul cover _mocha -- --reporter dot && echo google-chrome coverage/lcov-report/index.html",

"mocha": "2.4.5",
"mocha-phantomjs-core": "2.0.1",
"phantomjs-prebuilt": "2.1.7",
"serve": "*",
"sinon": "1.16.1",
"sinon": "1.17.5",
"unexpected": "10.10.5",

@@ -45,0 +48,0 @@ "unexpected-documentation-site-generator": "^4.0.0",

@@ -5,14 +5,29 @@ // Monkey-patch sinon.create to patch all created spyCall instances

module.exports = function (sinon) {
var sinonCreate = sinon.create;
sinon.create = function (arg) {
var getStackFrames = arg.getStackFrames;
// Copied from test/monkeyPatchSinonStackFrames.js
function patchCall(call) {
var getStackFrames = call && call.getStackFrames;
if (getStackFrames) {
arg.getStackFrames = function () {
var stackFrames = getStackFrames.call(this);
stackFrames[0] = 'at theFunction (theFileName:xx:yy)';
return stackFrames;
call.getStackFrames = function () {
return ['at theFunction (theFileName:xx:yy)'];
};
}
return sinonCreate.call(this, arg);
};
return call;
}
['spy', 'stub'].forEach(function (name) {
var orig = sinon[name];
sinon[name] = function () {
var result = orig.apply(this, arguments);
var getCall = result.getCall;
result.getCall = function () {
return patchCall(getCall.apply(result, arguments));
};
var getCalls = result.getCalls;
result.getCalls = function () {
return getCalls.call(result).map(patchCall);
};
return result;
};
sinon[name].create = orig.create;
});
};

@@ -1329,2 +1329,72 @@ /*global describe, it, beforeEach, sinon, unexpected*/

});
describe('spyCall type', function () {
describe('to satisfy', function () {
describe('with an object with only numerical properties', function () {
it('should succeed', function () {
spy(123);
spy(456);
expect(spy.lastCall, 'to satisfy', {0: 456});
});
it('should fail with a diff', function () {
spy(123);
spy(456);
expect(function () {
expect(spy.lastCall, 'to satisfy', {0: 789});
}, 'to throw',
"expected spy1( 456 ); at theFunction (theFileName:xx:yy) to satisfy { 0: 789 }\n" +
"\n" +
"spy1(\n" +
" 456 // should equal 789\n" +
"); at theFunction (theFileName:xx:yy)"
);
});
});
describe('with an array', function () {
it('should succeed', function () {
spy(123);
spy(456);
expect(spy.lastCall, 'to satisfy', [456]);
});
it('should fail with a diff', function () {
spy(123);
spy(456);
expect(function () {
expect(spy.lastCall, 'to satisfy', [789]);
}, 'to throw',
"expected spy1( 456 ); at theFunction (theFileName:xx:yy) to satisfy [ 789 ]\n" +
"\n" +
"spy1(\n" +
" 456 // should equal 789\n" +
"); at theFunction (theFileName:xx:yy)"
);
});
});
describe('with an object', function () {
it('should succeed', function () {
spy(123);
spy(456);
expect(spy.lastCall, 'to satisfy', {args: [456]});
});
it('should fail with a diff', function () {
spy(123);
spy(456);
expect(function () {
expect(spy.lastCall, 'to satisfy', {args: [789]});
}, 'to throw',
"expected spy1( 456 ); at theFunction (theFileName:xx:yy) to satisfy { args: [ 789 ] }\n" +
"\n" +
"spy1(\n" +
" 456 // should equal 789\n" +
"); at theFunction (theFileName:xx:yy)"
);
});
});
});
});
});

Sorry, the diff of this file is not supported yet

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