Navigation Menu

Skip to content

Commit

Permalink
Add Jasmine v2.1 focused specs, drop disabled specs
Browse files Browse the repository at this point in the history
  • Loading branch information
tlvince committed Jan 24, 2015
1 parent 4310738 commit 9c90602
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
node_modules
*.html
18 changes: 11 additions & 7 deletions docs/rules/no-exclusive-tests.md
@@ -1,21 +1,25 @@
# Disallow use of exclusive tests (no-exclusive-tests)

Jasmine uses `ddescribe` to only run a specific test suite and `iit` to only
run a specific spec. Whilst handy during development, these can cause
unexpected behaviour if accidently committed.
Jasmine uses `ddescribe` to run a specific test suite and `iit` to run
a specific spec exclusively ("[focused specs](focused)"; `fdescribe` and `fit`
as of Jasmine v2.1).

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

[focused]: http://jasmine.github.io/2.1/focused_specs.html

## Rule Details

This rule aims to warn whenever it encouters `ddescribe`, `iit`, `xdescribe`
and `xit`.
This rule aims to warn whenever it encounters `ddescribe`, `iit`, `fdescribe` and `fit`.

The following patterns are considered warnings:

```js
ddescribe('My exclusive suite', function() {});

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

```
Expand All @@ -25,7 +29,7 @@ The following patterns are not warnings:
```js
describe('My suite', function() {});
describe('My suite', function() {
it('My spec', function() {});
it('My spec', function() {});
});

```
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-exclusive-tests.js
Expand Up @@ -8,9 +8,9 @@
module.exports = function(context) {
var prohibited = [
'ddescribe',
'xdescribe',
'fdescribe',
'iit',
'xit'
'fit'
];

// Helpers
Expand Down
8 changes: 4 additions & 4 deletions test/rules/no-exclusive-tests.js
Expand Up @@ -26,16 +26,16 @@ eslintTester.addRuleTest('lib/rules/no-exclusive-tests', {
}]
},
{
code: 'xdescribe("My disabled suite", function() {});',
code: 'fdescribe("My focused suite", function() {});',
errors: [{
message: 'Unexpected xdescribe.',
message: 'Unexpected fdescribe.',
type: 'Identifier'
}]
},
{
code: 'xit("My disabled spec", function() {});',
code: 'fit("My focused spec", function() {});',
errors: [{
message: 'Unexpected xit.',
message: 'Unexpected fit.',
type: 'Identifier'
}]
}
Expand Down

0 comments on commit 9c90602

Please sign in to comment.