From 482dc883eb37356485df2f9254cc8de82e4928aa Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Sat, 16 Apr 2022 10:58:25 -0700 Subject: [PATCH] Check for unused vars and params in specs --- spec/.eslintrc.js | 5 ++- spec/core/AsyncExpectationSpec.js | 2 +- spec/core/ClockSpec.js | 3 +- spec/core/DeprecatorSpec.js | 1 - spec/core/EnvSpec.js | 1 + spec/core/PrettyPrintSpec.js | 8 ++-- spec/core/QueueRunnerSpec.js | 6 +++ spec/core/SpyRegistrySpec.js | 2 +- spec/core/SpySpec.js | 6 +++ spec/core/TreeProcessorSpec.js | 2 +- spec/core/UtilSpec.js | 2 +- .../AsymmetricEqualityTestersSpec.js | 2 +- .../integration/CustomAsyncMatchersSpec.js | 2 +- spec/core/integration/CustomMatchersSpec.js | 3 +- spec/core/integration/EnvSpec.js | 45 +++++++++---------- spec/core/integration/MatchersSpec.js | 3 -- spec/core/integration/SpecRunningSpec.js | 43 +++++++++--------- spec/core/matchers/matchersUtilSpec.js | 16 +++---- spec/core/matchers/toEqualSpec.js | 6 --- .../matchers/toHaveBeenCalledTimesSpec.js | 3 +- 20 files changed, 81 insertions(+), 80 deletions(-) diff --git a/spec/.eslintrc.js b/spec/.eslintrc.js index 20f58dfa..bafb67ca 100644 --- a/spec/.eslintrc.js +++ b/spec/.eslintrc.js @@ -7,10 +7,13 @@ module.exports = { semi: 'off', 'key-spacing': 'off', 'space-before-blocks': 'off', - 'no-unused-vars': 'off', 'no-trailing-spaces': 'off', 'block-spacing': 'off', + // Additionally, check for unused fn args + // TODO: consider doing this in src files as well as specs + 'no-unused-vars': ['error', { args: 'after-used' }], + // Since linting is done at the end of the process and doesn't stop us // from running tests, it makes sense to fail if debugger statements // or console references are present. diff --git a/spec/core/AsyncExpectationSpec.js b/spec/core/AsyncExpectationSpec.js index 60dc2f01..c624c831 100644 --- a/spec/core/AsyncExpectationSpec.js +++ b/spec/core/AsyncExpectationSpec.js @@ -781,6 +781,6 @@ describe('AsyncExpectation', function() { }); function dummyPromise() { - return new Promise(function(resolve, reject) {}); + return new Promise(function() {}); } }); diff --git a/spec/core/ClockSpec.js b/spec/core/ClockSpec.js index 69c05fc4..9046ece0 100644 --- a/spec/core/ClockSpec.js +++ b/spec/core/ClockSpec.js @@ -960,8 +960,7 @@ describe('Clock (acceptance)', function() { return delayedFunctionScheduler; }, mockDate - ), - env = jasmineUnderTest.getEnv(); + ); expect(() => clock.mockDate(12345)).toThrowError( 'The argument to jasmine.clock().mockDate(), if specified, should be ' + diff --git a/spec/core/DeprecatorSpec.js b/spec/core/DeprecatorSpec.js index bfd1761c..4be31dbe 100644 --- a/spec/core/DeprecatorSpec.js +++ b/spec/core/DeprecatorSpec.js @@ -212,7 +212,6 @@ describe('Deprecator', function() { 'addDeprecationWarning', 'getFullName' ]); - var exceptionFormatter = new jasmineUnderTest.ExceptionFormatter(); var deprecation, originalStack; try { diff --git a/spec/core/EnvSpec.js b/spec/core/EnvSpec.js index dd8698b2..e835f923 100644 --- a/spec/core/EnvSpec.js +++ b/spec/core/EnvSpec.js @@ -193,6 +193,7 @@ describe('Env', function() { it('throws an error when given arguments', function() { expect(function() { + // eslint-disable-next-line no-unused-vars env.describe('done method', function(done) {}); }).toThrowError('describe does not expect any arguments'); }); diff --git a/spec/core/PrettyPrintSpec.js b/spec/core/PrettyPrintSpec.js index 3b74e0de..0853b7ab 100644 --- a/spec/core/PrettyPrintSpec.js +++ b/spec/core/PrettyPrintSpec.js @@ -500,7 +500,7 @@ describe('PrettyPrinter', function() { describe('Custom object formatters', function() { it('should use the first custom object formatter that does not return undefined', function() { var customObjectFormatters = [ - function(obj) { + function() { return undefined; }, function(obj) { @@ -518,7 +518,7 @@ describe('PrettyPrinter', function() { it('should fall back to built in logic if all custom object formatters return undefined', function() { var customObjectFormatters = [ - function(obj) { + function() { return undefined; } ], @@ -532,7 +532,7 @@ describe('PrettyPrinter', function() { describe('#customFormat_', function() { it('should use the first custom object formatter that does not return undefined', function() { var customObjectFormatters = [ - function(obj) { + function() { return undefined; }, function(obj) { @@ -550,7 +550,7 @@ describe('PrettyPrinter', function() { it('should return undefined if all custom object formatters return undefined', function() { var customObjectFormatters = [ - function(obj) { + function() { return undefined; } ], diff --git a/spec/core/QueueRunnerSpec.js b/spec/core/QueueRunnerSpec.js index b098f378..40c83c99 100644 --- a/spec/core/QueueRunnerSpec.js +++ b/spec/core/QueueRunnerSpec.js @@ -262,6 +262,7 @@ describe('QueueRunner', function() { it("sets a timeout if requested for asynchronous functions so they don't go on forever", function() { var timeout = 3, + // eslint-disable-next-line no-unused-vars beforeFn = { fn: function(done) {}, type: 'before', timeout: timeout }, queueableFn = { fn: jasmine.createSpy('fn'), type: 'queueable' }, onComplete = jasmine.createSpy('onComplete'), @@ -309,6 +310,7 @@ describe('QueueRunner', function() { }); it('by default does not set a timeout for asynchronous functions', function() { + // eslint-disable-next-line no-unused-vars var beforeFn = { fn: function(done) {} }, queueableFn = { fn: jasmine.createSpy('fn') }, onComplete = jasmine.createSpy('onComplete'), @@ -331,6 +333,7 @@ describe('QueueRunner', function() { it('clears the timeout when an async function throws an exception, to prevent additional exception reporting', function() { var queueableFn = { + // eslint-disable-next-line no-unused-vars fn: function(done) { throw new Error('error!'); } @@ -434,6 +437,7 @@ describe('QueueRunner', function() { it('continues running functions when an exception is thrown in async code without timing out', function() { var queueableFn = { + // eslint-disable-next-line no-unused-vars fn: function(done) { throwAsync(); }, @@ -605,6 +609,7 @@ describe('QueueRunner', function() { it('issues an error if the function also takes a parameter', function() { var queueableFn = { + // eslint-disable-next-line no-unused-vars fn: function(done) { return new StubPromise(); } @@ -691,6 +696,7 @@ describe('QueueRunner', function() { it('continues running the functions even after an exception is thrown in an async spec', function() { var queueableFn = { + // eslint-disable-next-line no-unused-vars fn: function(done) { throw new Error('error'); } diff --git a/spec/core/SpyRegistrySpec.js b/spec/core/SpyRegistrySpec.js index 11d1e5dd..bfb66b99 100644 --- a/spec/core/SpyRegistrySpec.js +++ b/spec/core/SpyRegistrySpec.js @@ -337,7 +337,7 @@ describe('SpyRegistry', function() { }); Object.defineProperty(subject, 'notSpied4', { configurable: false, - set: function(val) { + set: function() { /**/ }, get: function() { diff --git a/spec/core/SpySpec.js b/spec/core/SpySpec.js index bfc08e98..68fb29de 100644 --- a/spec/core/SpySpec.js +++ b/spec/core/SpySpec.js @@ -97,11 +97,17 @@ describe('Spies', function() { it('preserves arity of original function', function() { var functions = [ function nullary() {}, + // eslint-disable-next-line no-unused-vars function unary(arg) {}, + // eslint-disable-next-line no-unused-vars function binary(arg1, arg2) {}, + // eslint-disable-next-line no-unused-vars function ternary(arg1, arg2, arg3) {}, + // eslint-disable-next-line no-unused-vars function quaternary(arg1, arg2, arg3, arg4) {}, + // eslint-disable-next-line no-unused-vars function quinary(arg1, arg2, arg3, arg4, arg5) {}, + // eslint-disable-next-line no-unused-vars function senary(arg1, arg2, arg3, arg4, arg5, arg6) {} ]; diff --git a/spec/core/TreeProcessorSpec.js b/spec/core/TreeProcessorSpec.js index c33a0000..ac5b4ee4 100644 --- a/spec/core/TreeProcessorSpec.js +++ b/spec/core/TreeProcessorSpec.js @@ -82,7 +82,7 @@ describe('TreeProcessor', function() { processor = new jasmineUnderTest.TreeProcessor({ tree: leaf, runnableIds: [leaf.id], - excludeNode: function(node) { + excludeNode: function() { return true; } }), diff --git a/spec/core/UtilSpec.js b/spec/core/UtilSpec.js index 7cf638a4..d0c8fe32 100644 --- a/spec/core/UtilSpec.js +++ b/spec/core/UtilSpec.js @@ -39,7 +39,7 @@ describe('jasmineUnderTest.util', function() { }; beforeEach(function() { - mockNativePromise = new Promise(function(res, rej) {}); + mockNativePromise = new Promise(function() {}); mockPromiseLikeObject = new mockPromiseLike(); }); diff --git a/spec/core/integration/AsymmetricEqualityTestersSpec.js b/spec/core/integration/AsymmetricEqualityTestersSpec.js index cf71329c..4a6e761f 100644 --- a/spec/core/integration/AsymmetricEqualityTestersSpec.js +++ b/spec/core/integration/AsymmetricEqualityTestersSpec.js @@ -1,5 +1,5 @@ describe('Asymmetric equality testers (Integration)', function() { - function verifyPasses(expectations, setup) { + function verifyPasses(expectations) { it('passes', function(done) { var env = new jasmineUnderTest.Env(); env.it('a spec', function() { diff --git a/spec/core/integration/CustomAsyncMatchersSpec.js b/spec/core/integration/CustomAsyncMatchersSpec.js index 36fe3fde..637e348e 100644 --- a/spec/core/integration/CustomAsyncMatchersSpec.js +++ b/spec/core/integration/CustomAsyncMatchersSpec.js @@ -85,7 +85,7 @@ describe('Custom Async Matchers (Integration)', function() { }); it('passes the jasmine utility to the matcher factory', function(done) { - var matcherFactory = function(util) { + var matcherFactory = function() { return { compare: function() { return Promise.resolve({ pass: true }); diff --git a/spec/core/integration/CustomMatchersSpec.js b/spec/core/integration/CustomMatchersSpec.js index 643451ef..a5b8ac62 100644 --- a/spec/core/integration/CustomMatchersSpec.js +++ b/spec/core/integration/CustomMatchersSpec.js @@ -1,6 +1,5 @@ describe('Custom Matchers (Integration)', function() { var env; - var fakeTimer; beforeEach(function() { env = new jasmineUnderTest.Env(); @@ -211,7 +210,7 @@ describe('Custom Matchers (Integration)', function() { }); it('passes the jasmine utility to the matcher factory', function(done) { - var matcherFactory = function(util) { + var matcherFactory = function() { return { compare: function() { return { pass: true }; diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js index e29a6bd1..fe169fb5 100644 --- a/spec/core/integration/EnvSpec.js +++ b/spec/core/integration/EnvSpec.js @@ -792,6 +792,7 @@ describe('Env integration', function() { env.describe('my suite', function() { env.it('my spec', function() {}); + // eslint-disable-next-line no-unused-vars env.afterAll(function(afterAllDone) { throw error; }); @@ -959,9 +960,7 @@ describe('Env integration', function() { it('Allows filtering out specs and suites to run programmatically', function(done) { var calls = [], - suiteCallback = jasmine.createSpy('suite callback'), - firstSpec, - secondSuite; + suiteCallback = jasmine.createSpy('suite callback'); env.addReporter({ suiteDone: suiteCallback }); @@ -974,7 +973,7 @@ describe('Env integration', function() { }); }); - secondSuite = env.describe('second suite', function() { + env.describe('second suite', function() { env.it('third spec', function() { calls.push('third spec'); }); @@ -1086,8 +1085,6 @@ describe('Env integration', function() { env.it('spec 0', function() { env.spyOn(foo, 'bar'); - var error = null; - expect(function() { env.spyOn(foo, 'bar'); }).not.toThrow(); @@ -1296,6 +1293,7 @@ describe('Env integration', function() { env.addReporter(reporter); jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = 8414; + // eslint-disable-next-line no-unused-vars env.it("async spec that doesn't call done", function(underTestCallback) { env.expect(true).toBeTruthy(); jasmine.clock().tick(8416); @@ -1374,6 +1372,7 @@ describe('Env integration', function() { }, 100); }); env.describe('beforeAll', function() { + // eslint-disable-next-line no-unused-vars env.beforeAll(function(innerDone) { realSetTimeout(function() { jasmine.clock().tick(5001); @@ -1389,6 +1388,7 @@ describe('Env integration', function() { }); env.describe('afterAll', function() { + // eslint-disable-next-line no-unused-vars env.afterAll(function(innerDone) { realSetTimeout(function() { jasmine.clock().tick(2001); @@ -1404,6 +1404,7 @@ describe('Env integration', function() { }); env.describe('beforeEach', function() { + // eslint-disable-next-line no-unused-vars env.beforeEach(function(innerDone) { realSetTimeout(function() { jasmine.clock().tick(1001); @@ -1419,6 +1420,7 @@ describe('Env integration', function() { }); env.describe('afterEach', function() { + // eslint-disable-next-line no-unused-vars env.afterEach(function(innerDone) { realSetTimeout(function() { jasmine.clock().tick(4001); @@ -1435,6 +1437,7 @@ describe('Env integration', function() { env.it( 'it times out', + // eslint-disable-next-line no-unused-vars function(innerDone) { realSetTimeout(function() { jasmine.clock().tick(6001); @@ -1910,7 +1913,7 @@ describe('Env integration', function() { env.describe('testing custom equality testers', function() { env.it('with a custom tester', function() { - env.addCustomEqualityTester(function(a, b) { + env.addCustomEqualityTester(function() { return true; }); env.expect('a').toEqual('b'); @@ -1940,7 +1943,7 @@ describe('Env integration', function() { env.describe('testing custom equality testers', function() { env.beforeAll(function() { - env.addCustomEqualityTester(function(a, b) { + env.addCustomEqualityTester(function() { return true; }); }); @@ -1981,7 +1984,7 @@ describe('Env integration', function() { env.describe('testing custom equality testers', function() { env.it('with a custom tester', function() { - env.addCustomEqualityTester(function(a, b) { + env.addCustomEqualityTester(function() { return true; }); env.expect(['a']).toContain('b'); @@ -2026,7 +2029,7 @@ describe('Env integration', function() { env.describe('testing custom equality testers', function() { env.beforeAll(function() { - env.addCustomEqualityTester(function(a, b) { + env.addCustomEqualityTester(function() { return true; }); }); @@ -2128,13 +2131,12 @@ describe('Env integration', function() { }); it('throws an exception if you try to add a matcher outside of a runnable', function(done) { - var obj = { fn: function() {} }, - exception; + let exception; env.describe('a suite', function() { try { env.addMatchers({ - myMatcher: function(actual, expected) { + myMatcher: function() { return false; } }); @@ -2153,12 +2155,11 @@ describe('Env integration', function() { }); it('throws an exception if you try to add a custom equality outside of a runnable', function(done) { - var obj = { fn: function() {} }, - exception; + let exception; env.describe('a suite', function() { try { - env.addCustomEqualityTester(function(first, second) { + env.addCustomEqualityTester(function() { return true; }); } catch (e) { @@ -2265,6 +2266,7 @@ describe('Env integration', function() { env.addReporter(reporter); env.describe('async suite', function() { + // eslint-disable-next-line no-unused-vars env.afterAll(function(innerDone) { setTimeout(function() { throw new Error('suite'); @@ -2277,6 +2279,7 @@ describe('Env integration', function() { env.describe('suite', function() { env.it( 'async spec', + // eslint-disable-next-line no-unused-vars function(innerDone) { setTimeout(function() { throw new Error('spec'); @@ -2877,7 +2880,7 @@ describe('Env integration', function() { function fail(innerDone) { var resolve; - var p = new Promise(function(res, rej) { + var p = new Promise(function(res) { resolve = res; }); env @@ -3328,19 +3331,15 @@ describe('Env integration', function() { }); it('sends debug logs to the reporter when the spec fails', function(done) { - var reporter = jasmine.createSpyObj('reporter', ['specDone']), - startTime, - endTime; + const reporter = jasmine.createSpyObj('reporter', ['specDone']); env.addReporter(reporter); env.configure({ random: false }); env.it('fails', function() { - startTime = new Date().getTime(); env.debugLog('message 1'); env.debugLog('message 2'); env.expect(1).toBe(2); - endTime = new Date().getTime(); }); env.it('passes', function() { @@ -3353,7 +3352,7 @@ describe('Env integration', function() { asymmetricMatch: function(compareTo) { return compareTo >= min && compareTo <= max; }, - jasmineToString: function(pp) { + jasmineToString: function() { return ''; } }; diff --git a/spec/core/integration/MatchersSpec.js b/spec/core/integration/MatchersSpec.js index 30a9e656..ce5e370e 100755 --- a/spec/core/integration/MatchersSpec.js +++ b/spec/core/integration/MatchersSpec.js @@ -678,7 +678,6 @@ describe('Matchers (Integration)', function() { return '|' + val + '|'; }, expectations: function(env) { - var spy = env.createSpy('foo'); env .expect(function() { throw 'x'; @@ -707,7 +706,6 @@ describe('Matchers (Integration)', function() { return '|' + val + '|'; }, expectations: function(env) { - var spy = env.createSpy('foo'); env .expect(function() { throw 'x'; @@ -740,7 +738,6 @@ describe('Matchers (Integration)', function() { return '|' + val + '|'; }, expectations: function(env) { - var spy = env.createSpy('foo'); env .expect(function() { throw new Error('nope'); diff --git a/spec/core/integration/SpecRunningSpec.js b/spec/core/integration/SpecRunningSpec.js index 2ce28901..77c4762b 100644 --- a/spec/core/integration/SpecRunningSpec.js +++ b/spec/core/integration/SpecRunningSpec.js @@ -35,7 +35,7 @@ describe('spec running', function() { var bar = 0; var baz = 0; var quux = 0; - var nested = env.describe('suite', function() { + env.describe('suite', function() { env.describe('nested', function() { env.it('should run nested suites', function() { foo++; @@ -497,12 +497,12 @@ describe('spec running', function() { }); it("shouldn't run disabled suites", function(done) { - var specInADisabledSuite = jasmine.createSpy('specInADisabledSuite'), - suite = env.describe('A Suite', function() { - env.xdescribe('with a disabled suite', function() { - env.it('spec inside a disabled suite', specInADisabledSuite); - }); + const specInADisabledSuite = jasmine.createSpy('specInADisabledSuite'); + env.describe('A Suite', function() { + env.xdescribe('with a disabled suite', function() { + env.it('spec inside a disabled suite', specInADisabledSuite); }); + }); env.execute(null, function() { expect(specInADisabledSuite).not.toHaveBeenCalled(); @@ -511,16 +511,16 @@ describe('spec running', function() { }); it("shouldn't run before/after functions in disabled suites", function(done) { - var shouldNotRun = jasmine.createSpy('shouldNotRun'), - suite = env.xdescribe('A disabled Suite', function() { - // None of the before/after functions should run. - env.beforeAll(shouldNotRun); - env.beforeEach(shouldNotRun); - env.afterEach(shouldNotRun); - env.afterAll(shouldNotRun); + var shouldNotRun = jasmine.createSpy('shouldNotRun'); + env.xdescribe('A disabled Suite', function() { + // None of the before/after functions should run. + env.beforeAll(shouldNotRun); + env.beforeEach(shouldNotRun); + env.afterEach(shouldNotRun); + env.afterAll(shouldNotRun); - env.it('spec inside a disabled suite', shouldNotRun); - }); + env.it('spec inside a disabled suite', shouldNotRun); + }); env.execute(null, function() { expect(shouldNotRun).not.toHaveBeenCalled(); @@ -547,11 +547,10 @@ describe('spec running', function() { }); it('should set all pending specs to pending when a suite is run', function(done) { - var pendingSpec, - suite = env.describe('default current suite', function() { - pendingSpec = env.it('I am a pending spec'); - }), - reporter = jasmine.createSpyObj('reporter', ['specDone']); + env.describe('default current suite', function() { + env.it('I am a pending spec'); + }); + const reporter = jasmine.createSpyObj('reporter', ['specDone']); env.addReporter(reporter); @@ -886,6 +885,7 @@ describe('spec running', function() { const actions = []; env.describe('Something', function() { + // eslint-disable-next-line no-unused-vars env.beforeEach(function(innerDone) { actions.push('beforeEach'); }, 1); @@ -1299,8 +1299,7 @@ describe('spec running', function() { describe('when stopOnSpecFailure is on', function() { it('does not run further specs when one fails', function(done) { - var actions = [], - config; + const actions = []; env.describe('wrapper', function() { env.it('fails', function() { diff --git a/spec/core/matchers/matchersUtilSpec.js b/spec/core/matchers/matchersUtilSpec.js index b9dc1727..558a6612 100644 --- a/spec/core/matchers/matchersUtilSpec.js +++ b/spec/core/matchers/matchersUtilSpec.js @@ -392,7 +392,7 @@ describe('matchersUtil', function() { it('passes when an asymmetric equality tester returns true', function() { var tester = { - asymmetricMatch: function(other) { + asymmetricMatch: function() { return true; } }, @@ -404,7 +404,7 @@ describe('matchersUtil', function() { it('fails when an asymmetric equality tester returns false', function() { var tester = { - asymmetricMatch: function(other) { + asymmetricMatch: function() { return false; } }, @@ -424,7 +424,7 @@ describe('matchersUtil', function() { }); it('passes when a custom equality matcher returns true', function() { - var tester = function(a, b) { + var tester = function() { return true; }, matchersUtil = new jasmineUnderTest.MatchersUtil({ @@ -441,7 +441,7 @@ describe('matchersUtil', function() { }); describe("when a custom equality matcher returns 'undefined'", function() { - var tester = function(a, b) { + var tester = function() { return jasmine.undefined; }; @@ -455,7 +455,7 @@ describe('matchersUtil', function() { }); it('fails for equivalents when a custom equality matcher returns false', function() { - var tester = function(a, b) { + var tester = function() { return false; }, matchersUtil = new jasmineUnderTest.MatchersUtil({ @@ -468,11 +468,11 @@ describe('matchersUtil', function() { it('passes for an asymmetric equality tester that returns true when a custom equality tester return false', function() { var asymmetricTester = { - asymmetricMatch: function(other) { + asymmetricMatch: function() { return true; } }, - symmetricTester = function(a, b) { + symmetricTester = function() { return false; }, matchersUtil = new jasmineUnderTest.MatchersUtil({ @@ -1009,7 +1009,7 @@ describe('matchersUtil', function() { }); it('uses custom equality testers if actual is an Array', function() { - var customTester = function(a, b) { + var customTester = function() { return true; }, matchersUtil = new jasmineUnderTest.MatchersUtil({ diff --git a/spec/core/matchers/toEqualSpec.js b/spec/core/matchers/toEqualSpec.js index 0a4c0643..36a3506c 100644 --- a/spec/core/matchers/toEqualSpec.js +++ b/spec/core/matchers/toEqualSpec.js @@ -368,9 +368,6 @@ describe('toEqual', function() { }); it('reports mismatches between objects with their own constructor property', function() { - function Foo() {} - function Bar() {} - var actual = { x: { constructor: 'blerf' } }, expected = { x: { constructor: 'ftarrh' } }, message = "Expected $.x.constructor = 'blerf' to equal 'ftarrh'."; @@ -379,9 +376,6 @@ describe('toEqual', function() { }); it('reports mismatches between an object with a real constructor and one with its own constructor property', function() { - function Foo() {} - function Bar() {} - var actual = { x: {} }, expected = { x: { constructor: 'ftarrh' } }, message = diff --git a/spec/core/matchers/toHaveBeenCalledTimesSpec.js b/spec/core/matchers/toHaveBeenCalledTimesSpec.js index 12075ad8..2af579a8 100644 --- a/spec/core/matchers/toHaveBeenCalledTimesSpec.js +++ b/spec/core/matchers/toHaveBeenCalledTimesSpec.js @@ -18,8 +18,7 @@ describe('toHaveBeenCalledTimes', function() { it('fails when expected numbers is not supplied', function() { var matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(), - spy = new jasmineUnderTest.Spy('spy'), - result; + spy = new jasmineUnderTest.Spy('spy'); spy(); expect(function() {