Comparing version 1.3.2 to 1.3.3
@@ -8,4 +8,10 @@ 'use strict'; | ||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); | ||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); | ||
var _utils = require('./utils'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var __serialize = function __serialize(o) { | ||
@@ -43,7 +49,7 @@ var alreadySerialized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
} | ||
alreadySerialized.push(o); | ||
var serialized = [].concat((0, _toConsumableArray3.default)(alreadySerialized), [o]); | ||
if (oClass === '[object Array]') { | ||
var _results = []; | ||
for (var i = 0; i < o.length; i++) { | ||
_results.push(__serialize(o[i], alreadySerialized)); | ||
_results.push(__serialize(o[i], serialized)); | ||
} | ||
@@ -57,3 +63,3 @@ return '[' + _results.join(', ') + ']'; | ||
var key = oKeys[_i]; | ||
results.push(key + ': ' + __serialize(o[key], alreadySerialized)); | ||
results.push(key + ': ' + __serialize(o[key], serialized)); | ||
} | ||
@@ -60,0 +66,0 @@ var objectType = o.constructor.name; |
@@ -12,2 +12,6 @@ 'use strict'; | ||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); | ||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -65,2 +69,12 @@ | ||
var mergeArrays = function mergeArrays(arr1, arr2) { | ||
var result = [].concat((0, _toConsumableArray3.default)(arr1)); | ||
forEach(arr2, function (key, val) { | ||
if (arr1.indexOf(val) === -1) { | ||
result.push(val); | ||
} | ||
}); | ||
return result; | ||
}; | ||
/** | ||
@@ -101,5 +115,8 @@ * This symbol serves as replacement to ignore any | ||
} | ||
if (a === undefined || a === null || b === undefined || b === null) { | ||
return 'null or undefined did not match'; | ||
if (a === undefined || b === undefined) { | ||
return 'one was undefined'; | ||
} | ||
if (a === null || b === null) { | ||
return 'one was null'; | ||
} | ||
var aClass = Object.prototype.toString.call(a); | ||
@@ -137,4 +154,2 @@ var bClass = Object.prototype.toString.call(b); | ||
} | ||
var aKeys = objectKeys(a); | ||
var bKeys = objectKeys(b); | ||
if (useOwnEquals && a.equals instanceof Function) { | ||
@@ -149,7 +164,7 @@ if (a.equals(b)) { | ||
} | ||
alreadyComparedArray.push(a); | ||
var keys = aKeys.length > bKeys.length ? aKeys : bKeys; | ||
var compared = [].concat((0, _toConsumableArray3.default)(alreadyComparedArray), [a]); | ||
var keys = mergeArrays(objectKeys(a), objectKeys(b)); | ||
for (var i = 0; i < keys.length; i++) { | ||
var _key2 = keys[i]; | ||
var diffStr = __diff(a[_key2], b[_key2], false, useOwnEquals, alreadyComparedArray); | ||
var diffStr = __diff(a[_key2], b[_key2], false, useOwnEquals, compared); | ||
if (diffStr !== undefined) { | ||
@@ -156,0 +171,0 @@ return (initial ? '--> ' + _key2 : '' + _key2) + ' / ' + diffStr; |
{ | ||
"name": "spy4js", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "Smart, compact and powerful spy test framework", | ||
@@ -5,0 +5,0 @@ "jest": { |
@@ -440,3 +440,3 @@ [![npm package][npm-image]][npm-url] | ||
call 4: [42, "test"] | ||
--> 2 / null or undefined did not match | ||
--> 2 / one was undefined | ||
``` | ||
@@ -443,0 +443,0 @@ There you can see that the arguments of the fact (displayed above all others) does not |
Sorry, the diff of this file is not supported yet
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
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
84754
975