Comparing version 2.3.0 to 3.0.0
@@ -256,3 +256,6 @@ class Format { | ||
arrayIsEmpty () { | ||
return this.object.length === 0 | ||
const obj = Array.isArray(this.object) | ||
? this.object : Array.from(this.object) | ||
return obj.length === 0 | ||
} | ||
@@ -259,0 +262,0 @@ arrayEmpty () { |
@@ -5,5 +5,2 @@ const Same = require('./same.js') | ||
arrayBody () { | ||
if (this.object.length === this.expect.length) | ||
return super.arrayBody() | ||
const obj = Array.isArray(this.object) | ||
@@ -15,2 +12,5 @@ ? this.object : Array.from(this.object) | ||
if (obj.length === exp.length) | ||
return super.arrayBody() | ||
// only need to handle missing values, not extra ones | ||
@@ -17,0 +17,0 @@ let out = '' |
const Format = require('./format.js') | ||
const frag = require('diff-frag') | ||
@@ -70,3 +71,3 @@ class Same extends Format { | ||
if (!this.options.cleanerDiffs) | ||
return pretty.concat(difflines).join('\n') | ||
return frag(pretty.concat(difflines).join('\n')) | ||
@@ -97,3 +98,3 @@ // unsure on whether this is a good idea. | ||
pretty.push.apply(pretty, hunkp) | ||
return pretty.join('\n') | ||
return frag(pretty.join('\n')) | ||
} | ||
@@ -192,6 +193,2 @@ | ||
arrayBody () { | ||
// just need to handle extra/missing values | ||
if (this.object.length === this.expect.length) | ||
return super.arrayBody() | ||
const obj = Array.isArray(this.object) | ||
@@ -203,2 +200,6 @@ ? this.object : Array.from(this.object) | ||
// just need to handle extra/missing values | ||
if (obj.length === exp.length) | ||
return super.arrayBody() | ||
let out = '' | ||
@@ -413,2 +414,4 @@ let key = 0 | ||
childExpect (key) { | ||
const exp = this.isArray() && !Array.isArray(this.expect) | ||
? Array.from(this.expect) : this.expect | ||
// if we get here, we know that both expect and actual | ||
@@ -419,3 +422,3 @@ // are collections of the same type. Otherwise, they | ||
: this.isMap() ? this.expect.get(key) | ||
: this.isArray() ? this.expect[key] | ||
: this.isArray() ? exp[key] | ||
: this.expect[key] | ||
@@ -422,0 +425,0 @@ } |
{ | ||
"name": "tcompare", | ||
"version": "2.3.0", | ||
"version": "3.0.0", | ||
"description": "A comprehensive comparison library, for use in test frameworks", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"tap": "^13.1.7" | ||
"tap": "^14.9.2" | ||
}, | ||
@@ -30,3 +30,6 @@ "scripts": { | ||
"coverage-map": "map.js" | ||
}, | ||
"dependencies": { | ||
"diff-frag": "^1.0.1" | ||
} | ||
} |
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
38481
1107
1
+ Addeddiff-frag@^1.0.1
+ Addeddiff-frag@1.1.1(transitive)