eslint-plugin-jest
Advanced tools
Comparing version 23.16.0 to 23.17.0
@@ -0,1 +1,8 @@ | ||
# [23.17.0](https://github.com/jest-community/eslint-plugin-jest/compare/v23.16.0...v23.17.0) (2020-06-23) | ||
### Features | ||
* **lowercase-name:** support `ignoreTopLevelDescribe` option ([#611](https://github.com/jest-community/eslint-plugin-jest/issues/611)) ([36fdcc5](https://github.com/jest-community/eslint-plugin-jest/commit/36fdcc553ca40bc2ca2e9ca7e04f8e9e4a315274)), closes [#247](https://github.com/jest-community/eslint-plugin-jest/issues/247) | ||
# [23.16.0](https://github.com/jest-community/eslint-plugin-jest/compare/v23.15.0...v23.16.0) (2020-06-21) | ||
@@ -2,0 +9,0 @@ |
@@ -89,1 +89,19 @@ # Enforce lowercase test names (`lowercase-name`) | ||
``` | ||
### `ignoreTopLevelDescribe` | ||
This option can be set to allow only the top-level `describe` blocks to have a | ||
title starting with an upper-case letter. | ||
Example of **correct** code for the `{ "ignoreTopLevelDescribe": true }` option: | ||
```js | ||
/* eslint jest/lowercase-name: ["error", { "ignoreTopLevelDescribe": true }] */ | ||
describe('MyClass', () => { | ||
describe('#myMethod', () => { | ||
it('does things', () => { | ||
// | ||
}); | ||
}); | ||
}); | ||
``` |
@@ -61,2 +61,6 @@ "use strict"; | ||
additionalItems: false | ||
}, | ||
ignoreTopLevelDescribe: { | ||
type: 'boolean', | ||
default: false | ||
} | ||
@@ -69,3 +73,4 @@ }, | ||
ignore: [], | ||
allowedPrefixes: [] | ||
allowedPrefixes: [], | ||
ignoreTopLevelDescribe: false | ||
}], | ||
@@ -75,4 +80,6 @@ | ||
ignore = [], | ||
allowedPrefixes = [] | ||
allowedPrefixes = [], | ||
ignoreTopLevelDescribe | ||
}]) { | ||
let numberOfDescribeBlocks = 0; | ||
return { | ||
@@ -84,2 +91,10 @@ CallExpression(node) { | ||
if ((0, _utils.isDescribe)(node)) { | ||
numberOfDescribeBlocks++; | ||
if (ignoreTopLevelDescribe && numberOfDescribeBlocks === 1) { | ||
return; | ||
} | ||
} | ||
const erroneousMethod = jestFunctionName(node, allowedPrefixes); | ||
@@ -86,0 +101,0 @@ |
{ | ||
"name": "eslint-plugin-jest", | ||
"version": "23.16.0", | ||
"version": "23.17.0", | ||
"description": "Eslint rules for Jest", | ||
@@ -105,5 +105,5 @@ "keywords": [ | ||
"@types/dedent": "^0.7.0", | ||
"@types/eslint": "^6.1.3", | ||
"@types/jest": "^25.1.0", | ||
"@types/node": "^12.6.6", | ||
"@types/prettier": "^1.19.0", | ||
"@typescript-eslint/eslint-plugin": "^2.5.0", | ||
@@ -110,0 +110,0 @@ "@typescript-eslint/parser": "^2.5.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
225148
3792