Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/omkarsheral1989/tslint-rules-line-before-tests
tslint rules for checking lines before test cases
https://github.com/omkarsheral1989/tslint-rules-line-before-tests
jasmine jest mocha mochajs tslint tslint-rules
Last synced: 26 days ago
JSON representation
tslint rules for checking lines before test cases
- Host: GitHub
- URL: https://github.com/omkarsheral1989/tslint-rules-line-before-tests
- Owner: omkarsheral1989
- License: mit
- Created: 2019-03-16T10:33:41.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-03-16T19:12:01.000Z (over 5 years ago)
- Last Synced: 2024-10-01T06:29:51.947Z (about 1 month ago)
- Topics: jasmine, jest, mocha, mochajs, tslint, tslint-rules
- Language: TypeScript
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```json
{
"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 before `describe()`, `xdescribe()`. Default value = 2. To disable, set to -1.
* `"beforeIt"` minimum number of blank lines before `it()`, `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](https://github.com/omkarsheral1989/tslint-rules-line-before-tests/blob/master/tests/describe/bofore-describe-equals-2/before-describe-equals-2.test.ts.lint).
```
"line-before-tests": [true, {beforeDescribe: 2, beforeIt: -1}]
```For below configuration, check test file [here](https://github.com/omkarsheral1989/tslint-rules-line-before-tests/blob/master/tests/it/before-it-equals-1/before-it-equals-1.test.ts.lint).
```
"line-before-tests": [true, {beforeDescribe: -1, beforeIt: 1}]
```## Development
```sh
# build
yarn build# test
yarn test
```