Check for unused vars and params in specs
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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 '<number from ' + min + ' to ' + max + ' inclusive>';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user