Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused variables #3061

Merged
merged 3 commits into from
Oct 27, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 5 additions & 12 deletions lib/reporters/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ exports.list = function (failures) {
var index = message ? stack.indexOf(message) : -1;
var actual = err.actual;
var expected = err.expected;
var escape = true;

if (index === -1) {
msg = message;
Expand All @@ -202,7 +201,6 @@ exports.list = function (failures) {
}
// explicitly show diff
if (err.showDiff !== false && sameType(actual, expected) && expected !== undefined) {
escape = false;
if (!(utils.isString(actual) && utils.isString(expected))) {
err.actual = actual = utils.stringify(actual);
err.expected = expected = utils.stringify(expected);
Expand All @@ -213,9 +211,9 @@ exports.list = function (failures) {
msg = '\n ' + color('error message', match ? match[1] : msg);

if (exports.inlineDiffs) {
msg += inlineDiff(err, escape);
msg += inlineDiff(err);
} else {
msg += unifiedDiff(err, escape);
msg += unifiedDiff(err);
}
}

Expand Down Expand Up @@ -366,11 +364,10 @@ function pad (str, len) {
*
* @api private
* @param {Error} err with actual/expected
* @param {boolean} escape
* @return {string} Diff
*/
function inlineDiff (err, escape) {
var msg = errorDiff(err, 'WordsWithSpace', escape);
function inlineDiff (err) {
var msg = errorDiff(err, 'WordsWithSpace', false);

// linenos
var lines = msg.split('\n');
Expand Down Expand Up @@ -400,15 +397,11 @@ function inlineDiff (err, escape) {
*
* @api private
* @param {Error} err with actual/expected
* @param {boolean} escape
* @return {string} The diff.
*/
function unifiedDiff (err, escape) {
function unifiedDiff (err) {
var indent = ' ';
function cleanUp (line) {
if (escape) {
line = escapeInvisibles(line);
}
if (line[0] === '+') {
return indent + colorLines('diff added', line);
}
Expand Down