From b1da6e39605801114de27340404fda261b9695e9 Mon Sep 17 00:00:00 2001 From: Elliot Nelson Date: Sat, 18 May 2019 08:11:47 -0400 Subject: [PATCH] Cleanup: unused vars, dangling commas, negation --- src/core/Env.js | 11 ++++------- src/core/Spec.js | 2 +- src/core/Suite.js | 2 +- src/core/matchers/matchersUtil.js | 5 ----- src/core/matchers/requireMatchers.js | 2 +- src/core/matchers/toBe.js | 2 +- src/core/matchers/toBeFalsy.js | 2 +- src/core/matchers/toHaveBeenCalledTimes.js | 2 +- src/core/util.js | 14 -------------- 9 files changed, 10 insertions(+), 32 deletions(-) diff --git a/src/core/Env.js b/src/core/Env.js index e06d7546..b0c09040 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -255,7 +255,7 @@ getJasmineRequireObj().Env = function(j$) { var defaultResourcesForRunnable = function(id, parentRunnableId) { var resources = {spies: [], customEqualityTesters: [], customMatchers: {}, customSpyStrategies: {}}; - if(runnableResources[parentRunnableId]){ + if(runnableResources[parentRunnableId]) { resources.customEqualityTesters = j$.util.clone(runnableResources[parentRunnableId].customEqualityTesters); resources.customMatchers = j$.util.clone(runnableResources[parentRunnableId].customMatchers); } @@ -307,9 +307,6 @@ getJasmineRequireObj().Env = function(j$) { return buildExpectationResult(attrs); }; - var maximumSpecCallbackDepth = 20; - var currentSpecCallbackDepth = 0; - /** * Sets whether Jasmine should throw an Error when an expectation fails. * This causes a spec to only have one expectation failure. @@ -666,7 +663,7 @@ getJasmineRequireObj().Env = function(j$) { } }); - this.allowRespy = function(allow){ + this.allowRespy = function(allow) { spyRegistry.allowRespy(allow); }; @@ -830,7 +827,7 @@ getJasmineRequireObj().Env = function(j$) { timeout: timeout || 0 }, throwOnExpectationFailure: config.oneFailurePerSpec, - timer: new j$.Timer(), + timer: new j$.Timer() }); return spec; @@ -879,7 +876,7 @@ getJasmineRequireObj().Env = function(j$) { return spec; }; - this.fit = function(description, fn, timeout){ + this.fit = function(description, fn, timeout) { ensureIsNotNested('fit'); ensureIsFunctionOrAsync(fn, 'fit'); var spec = specFactory(description, fn, currentDeclarationSuite, timeout); diff --git a/src/core/Spec.js b/src/core/Spec.js index 8adbacd7..4b31925d 100644 --- a/src/core/Spec.js +++ b/src/core/Spec.js @@ -40,7 +40,7 @@ getJasmineRequireObj().Spec = function(j$) { passedExpectations: [], deprecationWarnings: [], pendingReason: '', - duration: null, + duration: null }; } diff --git a/src/core/Suite.js b/src/core/Suite.js index e076e73f..bbb582a8 100644 --- a/src/core/Suite.js +++ b/src/core/Suite.js @@ -34,7 +34,7 @@ getJasmineRequireObj().Suite = function(j$) { fullName: this.getFullName(), failedExpectations: [], deprecationWarnings: [], - duration: null, + duration: null }; } diff --git a/src/core/matchers/matchersUtil.js b/src/core/matchers/matchersUtil.js index 3352fc30..14647dd6 100644 --- a/src/core/matchers/matchersUtil.js +++ b/src/core/matchers/matchersUtil.js @@ -225,7 +225,6 @@ getJasmineRequireObj().matchersUtil = function(j$) { }); for (i = 0; i < aLength || i < bLength; i++) { - var formatter = false; diffBuilder.withPath(i, function() { if (i >= bLength) { diffBuilder.record(a[i], void 0, actualArrayIsLongerFormatter); @@ -417,10 +416,6 @@ getJasmineRequireObj().matchersUtil = function(j$) { return extraKeys; } - function has(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); - } - function isFunction(obj) { return typeof obj === 'function'; } diff --git a/src/core/matchers/requireMatchers.js b/src/core/matchers/requireMatchers.js index c40df70e..e8b1fd58 100644 --- a/src/core/matchers/requireMatchers.js +++ b/src/core/matchers/requireMatchers.js @@ -28,7 +28,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) { 'toMatch', 'toThrow', 'toThrowError', - 'toThrowMatching', + 'toThrowMatching' ], matchers = {}; diff --git a/src/core/matchers/toBe.js b/src/core/matchers/toBe.js index 96b236a7..f92ed1ba 100644 --- a/src/core/matchers/toBe.js +++ b/src/core/matchers/toBe.js @@ -13,7 +13,7 @@ getJasmineRequireObj().toBe = function(j$) { return { compare: function(actual, expected) { var result = { - pass: actual === expected, + pass: actual === expected }; if (typeof expected === 'object') { diff --git a/src/core/matchers/toBeFalsy.js b/src/core/matchers/toBeFalsy.js index 7e06f55f..9ef75792 100644 --- a/src/core/matchers/toBeFalsy.js +++ b/src/core/matchers/toBeFalsy.js @@ -10,7 +10,7 @@ getJasmineRequireObj().toBeFalsy = function() { return { compare: function(actual) { return { - pass: !!!actual + pass: !actual }; } }; diff --git a/src/core/matchers/toHaveBeenCalledTimes.js b/src/core/matchers/toHaveBeenCalledTimes.js index 786b9547..b05ee8fe 100644 --- a/src/core/matchers/toHaveBeenCalledTimes.js +++ b/src/core/matchers/toHaveBeenCalledTimes.js @@ -20,7 +20,7 @@ getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) { var args = Array.prototype.slice.call(arguments, 0), result = { pass: false }; - if (!j$.isNumber_(expected)){ + if (!j$.isNumber_(expected)) { throw new Error(getErrorMsg('The expected times failed is a required argument and must be a number.')); } diff --git a/src/core/util.js b/src/core/util.js index 7bf93d3f..f885d2cb 100644 --- a/src/core/util.js +++ b/src/core/util.js @@ -100,18 +100,6 @@ getJasmineRequireObj().util = function(j$) { return Object.prototype.hasOwnProperty.call(obj, key); }; - function anyMatch(pattern, lines) { - var i; - - for (i = 0; i < lines.length; i++) { - if (lines[i].match(pattern)) { - return true; - } - } - - return false; - } - util.errorWithStack = function errorWithStack () { // Don't throw and catch if we don't have to, because it makes it harder // for users to debug their code with exception breakpoints. @@ -138,8 +126,6 @@ getJasmineRequireObj().util = function(j$) { var result; return function() { - var trace; - if (!result) { result = callerFile(); }