unexpected
Advanced tools
Comparing version 11.12.1 to 11.13.0
@@ -667,2 +667,15 @@ var createStandardErrorMessage = require('./createStandardErrorMessage'); | ||
function calculateLimits(items) { | ||
var minimum = 0; | ||
var maximum = 0; | ||
items.forEach(function (item) { | ||
minimum += item.minimum; | ||
maximum += item.maximum; | ||
}); | ||
return { | ||
minimum: minimum, | ||
maximum: maximum | ||
}; | ||
} | ||
expectPrototype.addAssertion = function( | ||
@@ -753,2 +766,3 @@ patternOrPatterns, | ||
); | ||
var limits = calculateLimits(args); | ||
assertionHandlers.push({ | ||
@@ -762,3 +776,5 @@ handler: handler, | ||
declaration: pattern, | ||
expect: childExpect | ||
expect: childExpect, | ||
minimum: limits.minimum, | ||
maximum: limits.maximum | ||
}); | ||
@@ -1105,16 +1121,2 @@ }); | ||
function calculateLimits(items) { | ||
return items.reduce( | ||
function (result, ref) { | ||
var minimum = ref.minimum; | ||
var maximum = ref.maximum; | ||
result.minimum += minimum; | ||
result.maximum += maximum; | ||
return result; | ||
}, | ||
{ minimum: 0, maximum: 0 } | ||
); | ||
} | ||
expectPrototype.throwAssertionNotFoundError = function( | ||
@@ -1338,10 +1340,5 @@ subject, | ||
var requireArgumentsLength = calculateLimits(handler.args); | ||
if ( | ||
args.length < requireArgumentsLength.minimum || | ||
requireArgumentsLength.maximum < args.length | ||
) { | ||
if (args.length < handler.minimum || handler.maximum < args.length) { | ||
return false; | ||
} else if (args.length === 0 && requireArgumentsLength.maximum === 0) { | ||
} else if (args.length === 0 && handler.maximum === 0) { | ||
return true; | ||
@@ -1348,0 +1345,0 @@ } |
@@ -108,5 +108,7 @@ /* eslint-disable no-proto */ | ||
isArray: function isArray(ar) { | ||
return Object.prototype.toString.call(ar) === '[object Array]'; | ||
}, | ||
isArray: | ||
Array.isArray || | ||
function(obj) { | ||
return Object.prototype.toString.call(obj) === '[object Array]'; | ||
}, | ||
@@ -113,0 +115,0 @@ isPromise: function isPromise(obj) { |
@@ -611,2 +611,15 @@ const createStandardErrorMessage = require('./createStandardErrorMessage'); | ||
function calculateLimits(items) { | ||
let minimum = 0; | ||
let maximum = 0; | ||
items.forEach(item => { | ||
minimum += item.minimum; | ||
maximum += item.maximum; | ||
}); | ||
return { | ||
minimum, | ||
maximum | ||
}; | ||
} | ||
expectPrototype.addAssertion = function( | ||
@@ -684,2 +697,3 @@ patternOrPatterns, | ||
); | ||
const limits = calculateLimits(args); | ||
assertionHandlers.push({ | ||
@@ -693,3 +707,5 @@ handler, | ||
declaration: pattern, | ||
expect: childExpect | ||
expect: childExpect, | ||
minimum: limits.minimum, | ||
maximum: limits.maximum | ||
}); | ||
@@ -1034,13 +1050,2 @@ }); | ||
function calculateLimits(items) { | ||
return items.reduce( | ||
(result, { minimum, maximum }) => { | ||
result.minimum += minimum; | ||
result.maximum += maximum; | ||
return result; | ||
}, | ||
{ minimum: 0, maximum: 0 } | ||
); | ||
} | ||
expectPrototype.throwAssertionNotFoundError = function( | ||
@@ -1255,10 +1260,5 @@ subject, | ||
const requireArgumentsLength = calculateLimits(handler.args); | ||
if ( | ||
args.length < requireArgumentsLength.minimum || | ||
requireArgumentsLength.maximum < args.length | ||
) { | ||
if (args.length < handler.minimum || handler.maximum < args.length) { | ||
return false; | ||
} else if (args.length === 0 && requireArgumentsLength.maximum === 0) { | ||
} else if (args.length === 0 && handler.maximum === 0) { | ||
return true; | ||
@@ -1265,0 +1265,0 @@ } |
@@ -108,5 +108,7 @@ /* eslint-disable no-proto */ | ||
isArray(ar) { | ||
return Object.prototype.toString.call(ar) === '[object Array]'; | ||
}, | ||
isArray: | ||
Array.isArray || | ||
function(obj) { | ||
return Object.prototype.toString.call(obj) === '[object Array]'; | ||
}, | ||
@@ -113,0 +115,0 @@ isPromise(obj) { |
{ | ||
"name": "unexpected", | ||
"version": "11.12.1", | ||
"version": "11.13.0", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -22,3 +22,2 @@ "keywords": [ | ||
"update-examples": "generate-site --require ./bootstrap-unexpected-markdown.js --update-examples", | ||
"postupdate-examples": "npm run postgenerate-site", | ||
"version": "(test -n \"${IS_MAKE_RELEASE}\" || (echo Please run make release instead && exit 1)) && offline-github-changelog --next=${npm_package_version} > CHANGELOG.md && git add CHANGELOG.md" | ||
@@ -31,3 +30,3 @@ }, | ||
"detect-indent": "3.0.1", | ||
"diff": "4.0.1", | ||
"diff": "4.0.2", | ||
"greedy-interval-packer": "1.2.0", | ||
@@ -80,3 +79,3 @@ "magicpen": "^6.2.1", | ||
"unexpected-magicpen": "^2.1.0", | ||
"unexpected-markdown": "^4.0.0" | ||
"unexpected-markdown": "^5.0.0" | ||
}, | ||
@@ -83,0 +82,0 @@ "files": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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 not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
3146729
17068
+ Addeddiff@4.0.2(transitive)
- Removeddiff@4.0.1(transitive)
Updateddiff@4.0.2