-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from lo1tuma/refactor-names
New option `ignoreSkipped` for `handle-done-callback` rule
- Loading branch information
Showing
7 changed files
with
389 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
'use strict'; | ||
|
||
const chain = require('ramda/src/chain'); | ||
|
||
const suiteNames = [ | ||
'describe', | ||
'context', | ||
'suite' | ||
]; | ||
|
||
const suiteModifiers = { | ||
skip: [ | ||
'describe.skip', | ||
'context.skip', | ||
'suite.skip', | ||
'xdescribe', | ||
'xcontext', | ||
'xsuite' | ||
], | ||
only: [ | ||
'describe.only', | ||
'context.only', | ||
'suite.only' | ||
] | ||
}; | ||
|
||
const testCaseNames = [ | ||
'it', | ||
'test', | ||
'specify' | ||
]; | ||
|
||
const testCaseModifiers = { | ||
skip: [ | ||
'it.skip', | ||
'test.skip', | ||
'specify.skip', | ||
'xit', | ||
'xspecify' | ||
], | ||
only: [ | ||
'it.only', | ||
'test.only', | ||
'specify.only' | ||
] | ||
}; | ||
|
||
function getTestCaseNames(options = {}) { | ||
const { modifiers = [], baseNames = true } = options; | ||
const names = baseNames ? testCaseNames : []; | ||
|
||
return names.concat(chain((modifierName) => { | ||
if (testCaseModifiers[modifierName]) { | ||
return testCaseModifiers[modifierName]; | ||
} | ||
|
||
return []; | ||
}, modifiers)); | ||
} | ||
|
||
function getSuiteNames(options = {}) { | ||
const { modifiers = [], baseNames = true, additionalSuiteNames = [] } = options; | ||
const names = baseNames ? suiteNames.concat(additionalSuiteNames) : []; | ||
|
||
return names.concat(chain((modifierName) => { | ||
if (suiteModifiers[modifierName]) { | ||
return suiteModifiers[modifierName]; | ||
} | ||
|
||
return []; | ||
}, modifiers)); | ||
} | ||
|
||
module.exports = { | ||
getTestCaseNames, | ||
getSuiteNames | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.