Permalink
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (30 sloc) 1.14 KB

Disallow use of focused tests (no-focused-tests)

Jasmine uses fdescribe and fit ("focused specs") to run a suite/spec exclusively.

Whilst handy during development, these can cause unexpected behaviour if accidentally committed to source control.

Note: fdescribe and fit are known as ddescribe and iit in previous Jasmine versions (<2.1). This rule checks for both syntaxes.

Rule details

This rule triggers an error (is set to 2 by default) whenever it encounters fdescribe, fit, ddescribe and iit.

The following patterns are considered warnings:

ddescribe('My focused suite', function() {});

describe('My suite', function() {
  iit('My focused spec', function() {});
});

The following patterns are not warnings:

describe('My suite', function() {});
describe('My suite', function() {
  it('My spec', function() {});
});

When not to use it

  • You have alternatives steps in place to prevent focused tests (e.g. a Git pre-commit hook)

Further Reading