Comparing version 3.2.1 to 3.3.0
@@ -6,2 +6,3 @@ "use strict"; | ||
var functionName = require("./util/core/function-name"); | ||
var get = require("lodash.get"); | ||
var iterableToString = require("./util/core/iterable-to-string"); | ||
@@ -21,2 +22,8 @@ var typeOf = require("./util/core/typeOf"); | ||
function assertMethodExists(value, method, name, methodPath) { | ||
if (value[method] == null) { | ||
throw new TypeError("Expected " + name + " to have method " + methodPath); | ||
} | ||
} | ||
var matcher = { | ||
@@ -184,6 +191,10 @@ toString: function () { | ||
match.instanceOf = function (type) { | ||
assertType(type, "function", "type"); | ||
if (typeof Symbol === "undefined" || typeof Symbol.hasInstance === "undefined") { | ||
assertType(type, "function", "type"); | ||
} else { | ||
assertMethodExists(type, Symbol.hasInstance, "type", "[Symbol.hasInstance]"); | ||
} | ||
return match(function (actual) { | ||
return actual instanceof type; | ||
}, "instanceOf(" + functionName(type) + ")"); | ||
}, "instanceOf(" + (functionName(type) || Object.prototype.toString.call(type)) + ")"); | ||
}; | ||
@@ -221,2 +232,19 @@ | ||
match.hasNested = function (property, value) { | ||
assertType(property, "string", "property"); | ||
var onlyProperty = arguments.length === 1; | ||
var message = "hasNested(\"" + property + "\""; | ||
if (!onlyProperty) { | ||
message += ", " + valueToString(value); | ||
} | ||
message += ")"; | ||
return match(function (actual) { | ||
if (actual === undefined || actual === null || | ||
get(actual, property) === undefined) { | ||
return false; | ||
} | ||
return onlyProperty || deepEqual(value, get(actual, property)); | ||
}, message); | ||
}; | ||
match.array = match.typeOf("array"); | ||
@@ -223,0 +251,0 @@ |
@@ -74,2 +74,3 @@ "use strict"; | ||
var expectation = mockExpectation.create(method); | ||
extend(expectation, this.object[method]); | ||
push.call(this.expectations[method], expectation); | ||
@@ -76,0 +77,0 @@ |
@@ -23,4 +23,4 @@ "use strict"; | ||
var stubbed = isStubbingNonFuncProperty ? | ||
stubNonFunctionProperty.apply(null, arguments) : | ||
sinonStub.apply(null, arguments); | ||
stubNonFunctionProperty.apply(null, arguments) : | ||
sinonStub.apply(null, arguments); | ||
@@ -27,0 +27,0 @@ if (isStubbingEntireObject) { |
@@ -248,4 +248,4 @@ "use strict"; | ||
return spyCall(this, this.thisValues[i], this.args[i], | ||
this.returnValues[i], this.exceptions[i], | ||
this.callIds[i], this.errorsWithCallStack[i]); | ||
this.returnValues[i], this.exceptions[i], | ||
this.callIds[i], this.errorsWithCallStack[i]); | ||
}, | ||
@@ -252,0 +252,0 @@ |
{ | ||
"name": "sinon", | ||
"description": "JavaScript test spies, stubs and mocks.", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"homepage": "http://sinonjs.org/", | ||
@@ -38,4 +38,6 @@ "author": "Christian Johansen", | ||
"dependencies": { | ||
"build": "^0.1.4", | ||
"diff": "^3.1.0", | ||
"formatio": "1.2.0", | ||
"lodash.get": "^4.4.2", | ||
"lolex": "^2.1.2", | ||
@@ -51,3 +53,3 @@ "native-promise-only": "^0.8.1", | ||
"browserify": "^14.0.0", | ||
"eslint": "^3.1.1", | ||
"eslint": "^4.6.1", | ||
"eslint-config-sinon": "^1.0.0", | ||
@@ -85,3 +87,3 @@ "eslint-plugin-mocha": "^4.2.0", | ||
"CONTRIBUTING.md", | ||
"Changelog.txt", | ||
"History.md", | ||
"LICENSE", | ||
@@ -88,0 +90,0 @@ "README.md" |
@@ -23,2 +23,3 @@ <h1 align=center> | ||
<a href="https://www.npmjs.com/package/sinon" target="_blank"><img src="https://img.shields.io/npm/dm/sinon.svg" alt="npm downloads per month"></a> | ||
<a href="https://cdnjs.com/libraries/sinon.js" target="_blank"><img src="https://img.shields.io/cdnjs/v/sinon.js.svg" alt="CDNJS version"></a> | ||
</p> | ||
@@ -25,0 +26,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
6592993
68266
131
11
6
+ Addedbuild@^0.1.4
+ Addedlodash.get@^4.4.2
+ Added@colors/colors@1.6.0(transitive)
+ Added@dabh/diagnostics@2.0.3(transitive)
+ Added@types/triple-beam@1.3.5(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedbuild@0.1.4(transitive)
+ Addedcolor@3.2.1(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcolor-string@1.9.1(transitive)
+ Addedcolorspace@1.1.4(transitive)
+ Addedcssmin@0.3.2(transitive)
+ Addedenabled@2.0.0(transitive)
+ Addedfecha@4.2.3(transitive)
+ Addedfn.name@1.1.0(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-arrayish@0.3.2(transitive)
+ Addedis-stream@2.0.1(transitive)
+ Addedjs-yaml@0.3.7(transitive)
+ Addedjsmin@1.0.1(transitive)
+ AddedjxLoader@0.1.1(transitive)
+ Addedkuler@2.0.0(transitive)
+ Addedlodash.get@4.4.2(transitive)
+ Addedlogform@2.7.0(transitive)
+ Addedmakeerror@1.0.12(transitive)
+ Addedmoo-server@1.3.0(transitive)
+ Addedms@2.1.3(transitive)
+ Addedone-time@1.0.0(transitive)
+ Addedpromised-io@0.3.6(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafe-stable-stringify@2.5.0(transitive)
+ Addedsimple-swizzle@0.2.2(transitive)
+ Addedstack-trace@0.0.10(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedtext-hex@1.0.0(transitive)
+ Addedtimespan@2.3.0(transitive)
+ Addedtmpl@1.0.5(transitive)
+ Addedtriple-beam@1.4.1(transitive)
+ Addeduglify-js@1.3.5(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwalker@1.0.8(transitive)
+ Addedwinston@3.17.0(transitive)
+ Addedwinston-transport@4.9.0(transitive)
+ Addedwrench@1.3.9(transitive)