diff --git a/lib/chai/assertion.js b/lib/chai/assertion.js index a5033d472..9a3846b4b 100644 --- a/lib/chai/assertion.js +++ b/lib/chai/assertion.js @@ -104,7 +104,7 @@ module.exports = function (_chai, util) { if (true !== config.showDiff) showDiff = false; if (!ok) { - var msg = util.getMessage(this, arguments) + msg = util.getMessage(this, arguments) , actual = util.getActual(this, arguments); throw new AssertionError(msg, { actual: actual diff --git a/lib/chai/core/assertions.js b/lib/chai/core/assertions.js index d0f9696d1..31a09e44c 100644 --- a/lib/chai/core/assertions.js +++ b/lib/chai/core/assertions.js @@ -1753,14 +1753,14 @@ module.exports = function (chai, _) { var contains = flag(this, 'contains'); var ordered = flag(this, 'ordered'); - var failMsg, failNegateMsg, lengthCheck; + var subject, failMsg, failNegateMsg, lengthCheck; if (contains) { - var subject = ordered ? 'an ordered superset' : 'a superset'; + subject = ordered ? 'an ordered superset' : 'a superset'; failMsg = 'expected #{this} to be ' + subject + ' of #{exp}'; failNegateMsg = 'expected #{this} to not be ' + subject + ' of #{exp}'; } else { - var subject = ordered ? 'ordered members' : 'members'; + subject = ordered ? 'ordered members' : 'members'; failMsg = 'expected #{this} to have the same ' + subject + ' as #{exp}'; failNegateMsg = 'expected #{this} to not have the same ' + subject + ' as #{exp}'; } diff --git a/lib/chai/utils/expectTypes.js b/lib/chai/utils/expectTypes.js index 4dd5b2971..59ac62da8 100644 --- a/lib/chai/utils/expectTypes.js +++ b/lib/chai/utils/expectTypes.js @@ -23,7 +23,7 @@ var flag = require('./flag'); var type = require('type-detect'); module.exports = function (obj, types) { - var obj = flag(obj, 'object'); + obj = flag(obj, 'object'); types = types.map(function (t) { return t.toLowerCase(); }); types.sort(); diff --git a/lib/chai/utils/inspect.js b/lib/chai/utils/inspect.js index 71297ee90..b82251502 100644 --- a/lib/chai/utils/inspect.js +++ b/lib/chai/utils/inspect.js @@ -99,6 +99,8 @@ function formatValue(ctx, value, recurseTimes) { var visibleKeys = getEnumerableProperties(value); var keys = ctx.showHidden ? getProperties(value) : visibleKeys; + var name, nameSuffix; + // Some type of object without properties can be shortcutted. // In IE, errors have a single `stack` property, or if they are vanilla `Error`, // a `stack` plus `description` property; ignore those for consistency. @@ -107,8 +109,8 @@ function formatValue(ctx, value, recurseTimes) { (keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack') ))) { if (typeof value === 'function') { - var name = getName(value); - var nameSuffix = name ? ': ' + name : ''; + name = getName(value); + nameSuffix = name ? ': ' + name : ''; return ctx.stylize('[Function' + nameSuffix + ']', 'special'); } if (isRegExp(value)) { @@ -132,8 +134,8 @@ function formatValue(ctx, value, recurseTimes) { // Make functions say that they are functions if (typeof value === 'function') { - var name = getName(value); - var nameSuffix = name ? ': ' + name : ''; + name = getName(value); + nameSuffix = name ? ': ' + name : ''; base = ' [Function' + nameSuffix + ']'; }