Comparing version 5.0.2 to 5.0.3
@@ -170,2 +170,18 @@ 'use strict'; | ||
/** | ||
* Returns a diff between 2 strings with coloured ANSI output. | ||
* | ||
* The diff will be either inline or unified dependant on the value | ||
* of `Base.inlineDiff`. | ||
* | ||
* @param {string} actual | ||
* @param {string} expected | ||
* @return {string} Diff | ||
*/ | ||
var generateDiff = exports.generateDiff = function (actual, expected) { | ||
return exports.inlineDiffs | ||
? inlineDiff(actual, expected) | ||
: unifiedDiff(actual, expected); | ||
}; | ||
/** | ||
* Output the given `failures` as a list. | ||
@@ -219,7 +235,3 @@ * | ||
if (exports.inlineDiffs) { | ||
msg += inlineDiff(err); | ||
} else { | ||
msg += unifiedDiff(err); | ||
} | ||
msg += generateDiff(err.actual, err.expected); | ||
} | ||
@@ -373,10 +385,11 @@ | ||
/** | ||
* Returns an inline diff between 2 strings with coloured ANSI output | ||
* Returns an inline diff between 2 strings with coloured ANSI output. | ||
* | ||
* @api private | ||
* @param {Error} err with actual/expected | ||
* @param {String} actual | ||
* @param {String} expected | ||
* @return {string} Diff | ||
*/ | ||
function inlineDiff (err) { | ||
var msg = errorDiff(err); | ||
function inlineDiff (actual, expected) { | ||
var msg = errorDiff(actual, expected); | ||
@@ -407,9 +420,10 @@ // linenos | ||
/** | ||
* Returns a unified diff between two strings. | ||
* Returns a unified diff between two strings with coloured ANSI output. | ||
* | ||
* @api private | ||
* @param {Error} err with actual/expected | ||
* @param {String} actual | ||
* @param {String} expected | ||
* @return {string} The diff. | ||
*/ | ||
function unifiedDiff (err) { | ||
function unifiedDiff (actual, expected) { | ||
var indent = ' '; | ||
@@ -434,3 +448,3 @@ function cleanUp (line) { | ||
} | ||
var msg = diff.createPatch('string', err.actual, err.expected); | ||
var msg = diff.createPatch('string', actual, expected); | ||
var lines = msg.split('\n').splice(5); | ||
@@ -448,7 +462,8 @@ return '\n ' + | ||
* @api private | ||
* @param {Error} err | ||
* @return {string} | ||
* @param {String} actual | ||
* @param {String} expected | ||
* @return {string} the diff | ||
*/ | ||
function errorDiff (err) { | ||
return diff.diffWordsWithSpace(err.actual, err.expected).map(function (str) { | ||
function errorDiff (actual, expected) { | ||
return diff.diffWordsWithSpace(actual, expected).map(function (str) { | ||
if (str.added) { | ||
@@ -455,0 +470,0 @@ return colorLines('diff added', str.value); |
{ | ||
"name": "mocha", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "simple, flexible, fun test framework", | ||
@@ -312,3 +312,3 @@ "keywords": [ | ||
"debug": "3.1.0", | ||
"diff": "3.3.1", | ||
"diff": "3.5.0", | ||
"escape-string-regexp": "1.0.5", | ||
@@ -315,0 +315,0 @@ "glob": "7.1.2", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
850386
19132
+ Addeddiff@3.5.0(transitive)
- Removeddiff@3.3.1(transitive)
Updateddiff@3.5.0