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

unexpected-sinon

Package Overview
Dependencies
Maintainers
4
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.8.1 to 10.8.2

11

lib/unexpected-sinon.js

@@ -137,5 +137,12 @@ /*global location*/

} catch (e) {}
var call = spy.getCall(j);
if (call.stack) {
call.stack = null;
}
if (call.errorWithCallStack) {
call.errorWithCallStack.stack = null;
}
var expectedSpyCallSpec = {
proxy: spy,
call: spy.getCall(j),
call: call,
args: spy.args[j],

@@ -267,3 +274,3 @@ callId: spy.callIds[j],

suffix: function (output, value) {
var stackFrames = value.getStackFrames && value.getStackFrames();
var stackFrames = value.stack && value.stack.split('\n').slice(3);
if (Array.isArray(stackFrames) && stackFrames.length > 0) {

@@ -270,0 +277,0 @@ output.sp().jsComment('at ' + makePathsRelativeToCwdOrLocation(stackFrames[0].replace(/^\s*(?:at\s+|@)?/, '')));

4

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

@@ -45,3 +45,3 @@ "keywords": [

"serve": "*",
"sinon": "1.17.7",
"sinon": "2.3.7",
"unexpected": "10.23.0",

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

@@ -20,8 +20,15 @@ // Monkey-patch sinon.create to patch all created spyCall instances

var bogusStack =
'Error\n' +
'at theFunction (theFileName:xx:yy)\n' +
'at theFunction (theFileName:xx:yy)\n' +
'at theFunction (theFileName:xx:yy)';
function patchCall(call) {
var getStackFrames = call && call.getStackFrames;
if (getStackFrames) {
call.getStackFrames = function () {
return ['at theFunction (theFileName:xx:yy)'];
};
if (call) {
call.stack = bogusStack;
if (call.errorWithCallStack) {
call.errorWithCallStack = { stack: bogusStack };
}
}

@@ -34,13 +41,15 @@ return call;

spy.getCall = function () {
return patchCall(getCall.apply(spy, arguments));
var call = getCall.apply(spy, arguments);
return patchCall(call);
};
var getCalls = spy.getCalls;
spy.getCalls = function () {
return getCalls.call(spy).map(patchCall);
var calls = getCalls.apply(spy, arguments);
return calls.map(patchCall, this);
};
}
['spy', 'stub'].forEach(function (name) {
var orig = sinon[name];
sinon[name] = function () { // ...
function replace(name, obj) {
var orig = obj[name];
obj[name] = function () { // ...
var result = orig.apply(this, arguments);

@@ -52,3 +61,8 @@ if (isSpy(result)) {

};
sinon[name].create = orig.create;
obj[name].create = orig.create;
}
['spy', 'stub'].forEach(function (name) {
replace(name, sinon);
replace(name, sinon.sandbox);
});

@@ -55,0 +69,0 @@

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