2.0.0 • Published 7 years ago
tslint-rules-line-before-tests v2.0.0
tslint-rules-line-before-tests
TSLint rule to check and fix the minimum number of lines before test cases.
i.e. describe(), xdescribe(), it(), xit(), test(), xtest().
Install
Install the package using NPM:
npm install tslint-rules-line-before-tests --save-devUpdate your tslint.json file to extend this package:
{
"rulesDirectory": [
"tslint-rules-line-before-tests"
],
"rules": {
"line-before-tests": true
}
}Rules
line-before-tests
Checks minimum number of lines before test cases.
Has Fixer
Yes
Config
Takes optional object with following optional properties:
"beforeDescribe"minimum number of blank lines beforedescribe(),xdescribe(). Default value = 2. To disable, set to -1."beforeIt"minimum number of blank lines beforeit(),xit(),test(),xtest(). Default value = 1. To disable, set to -1.
Config examples
"line-before-tests": true"line-before-tests": [true, {beforeDescribe: 2, beforeIt: 1}]"line-before-tests": [true, {beforeDescribe: 2}]"line-before-tests": [true, {beforeIt: 1}]"line-before-tests": [true, {beforeDescribe: 2, beforeIt: -1}]"line-before-tests": [true, {beforeDescribe: -1, beforeIt: 1}]Test files
If you are interested to see exactly where it will throw error, you can take a look at tests:
For below configuration, check test file here.
"line-before-tests": [true, {beforeDescribe: 2, beforeIt: -1}]For below configuration, check test file here.
"line-before-tests": [true, {beforeDescribe: -1, beforeIt: 1}]Development
# build
yarn build
# test
yarn test