tap-mocha-reporter
Advanced tools
Comparing version 3.0.7 to 3.0.8
@@ -395,4 +395,6 @@ /** | ||
} | ||
var msg = diff.createPatch('string', err.actual, err.expected); | ||
var lines = msg.split('\n').splice(4); | ||
var lines = (err.diff.split('\n').slice(2) || | ||
diff.createPatch('string', err.actual, err.expected) | ||
.split('\n').slice(4)); | ||
return '\n ' | ||
@@ -399,0 +401,0 @@ + colorLines('diff added', '+ expected') + ' ' |
@@ -23,3 +23,3 @@ exports = module.exports = Classic | ||
function doDiff (found, wanted, palette) { | ||
function doDiff (found, wanted, patch) { | ||
// TODO: Make this a configurable thing or something? | ||
@@ -54,3 +54,3 @@ // | ||
// TODO: add a TrueColor one that looks nicer | ||
palette = colorSupport.has256 ? 6 : 1 | ||
var palette = colorSupport.has256 ? 6 : 1 | ||
@@ -152,5 +152,8 @@ var plain = '' | ||
var patch = diff.createPatch('', wanted, found) | ||
//console.error(patch) | ||
var width = 0 | ||
patch = patch || ( | ||
['--- wanted', '+++ found'].concat( | ||
diff.createPatch('', wanted, found).split(/\n/).slice(5) | ||
).join('\n')) | ||
patch = patch.split('\n').map(function (line, index) { | ||
@@ -165,5 +168,5 @@ if (uclen(line) > width) | ||
}).filter(function (line, i) { | ||
return line && i > 4 | ||
return line | ||
}).map(function (line) { | ||
if (uclen(line) < width) | ||
if (uclen(line) <= width) | ||
line += repeat(width - uclen(line) + 1, ' ') | ||
@@ -180,13 +183,3 @@ return line | ||
var pref = | ||
bg + added + '+++ found' + | ||
(Base.useColors | ||
? repeat(width - '+++ found'.length + 1, ' ') | ||
: '') + | ||
reset + '\n' + | ||
bg + removed + '--- wanted' + | ||
(Base.useColors | ||
? repeat(width - '--- wanted'.length + 1, ' ') | ||
: '') + | ||
reset + '\n' | ||
var pref ='' | ||
@@ -285,7 +278,9 @@ return pref + patch | ||
if (hasOwnProperty(t.diag, 'found') && | ||
hasOwnProperty(t.diag, 'wanted')) { | ||
hasOwnProperty(t.diag, 'wanted') || | ||
hasOwnProperty(t.diag, 'diff')) { | ||
printDiff = true | ||
var found = t.diag.found | ||
var wanted = t.diag.wanted | ||
failMsg += indent(doDiff(found, wanted), 2) + '\n' | ||
var diff = doDiff(found, wanted, t.diag.diff) | ||
failMsg += indent(diff, 2) + '\n' | ||
} | ||
@@ -297,3 +292,3 @@ | ||
// Don't re-print what we already showed in the diff | ||
if (printDiff && ( i === 'found' || i === 'wanted')) | ||
if (printDiff && ( i === 'found' || i === 'wanted' || i === 'pattern' || i === 'diff')) | ||
continue | ||
@@ -300,0 +295,0 @@ o[i] = t.diag[i] |
@@ -334,3 +334,7 @@ // A facade from the tap-parser to the Mocha "Runner" object. | ||
var hasWanted = diag.hasOwnProperty('wanted') | ||
var hasDiff = diag.hasOwnProperty('diff') | ||
if (hasDiff) | ||
err.diff = diag.diff | ||
if (hasFound) | ||
@@ -342,3 +346,3 @@ err.actual = diag.found | ||
if (hasFound && hasWanted) | ||
if (hasFound && hasWanted || hasDiff) | ||
err.showDiff = true | ||
@@ -345,0 +349,0 @@ } |
{ | ||
"name": "tap-mocha-reporter", | ||
"version": "3.0.7", | ||
"version": "3.0.8", | ||
"description": "Format a TAP stream using Mocha's set of reporters", | ||
@@ -30,3 +30,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"tap": "^6.2.0" | ||
"tap": "^12.5.3" | ||
}, | ||
@@ -33,0 +33,0 @@ "bin": "index.js", |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure 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
160998
41
3242
1