eslint-plugin-mocha
Advanced tools
Comparing version 10.1.0 to 10.2.0
@@ -21,3 +21,3 @@ 'use strict'; | ||
docs: { | ||
description: 'Limit the number of top-level suites in a single file', | ||
description: 'Enforce the number of top-level suites in a single file', | ||
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/max-top-level-suites.md' | ||
@@ -24,0 +24,0 @@ }, |
@@ -49,5 +49,2 @@ 'use strict'; | ||
}, | ||
messages: { | ||
error: ERROR_MESSAGE | ||
}, | ||
schema: [ | ||
@@ -54,0 +51,0 @@ { |
@@ -11,3 +11,3 @@ 'use strict'; | ||
docs: { | ||
description: 'Disallow tests to be nested within other tests ', | ||
description: 'Disallow tests to be nested within other tests', | ||
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-nested-tests.md' | ||
@@ -14,0 +14,0 @@ }, |
@@ -53,3 +53,3 @@ 'use strict'; | ||
docs: { | ||
description: 'Match suite descriptions against a pre-configured regular expression', | ||
description: 'Require suite descriptions to match a pre-configured regular expression', | ||
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/valid-suite-description.md' | ||
@@ -56,0 +56,0 @@ }, |
@@ -52,3 +52,3 @@ 'use strict'; | ||
docs: { | ||
description: 'Match test descriptions against a pre-configured regular expression', | ||
description: 'Require test descriptions to match a pre-configured regular expression', | ||
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/valid-test-description.md' | ||
@@ -55,0 +55,0 @@ }, |
@@ -34,2 +34,5 @@ 'use strict'; | ||
} | ||
if (node.type === 'CallExpression') { | ||
return `${getNodeName(node.callee)}()`; | ||
} | ||
if (node.type === 'MemberExpression') { | ||
@@ -36,0 +39,0 @@ return `${getNodeName(node.object)}.${getPropertyName(node.property)}`; |
{ | ||
"name": "eslint-plugin-mocha", | ||
"version": "10.1.0", | ||
"version": "10.2.0", | ||
"description": "Eslint rules for mocha.", | ||
@@ -18,2 +18,3 @@ "engines": { | ||
"lint:docs": "markdownlint \"**/*.md\"", | ||
"lint:eslint-docs": "npm-run-all \"update:eslint-docs -- --check\"", | ||
"lint:js": "eslint .", | ||
@@ -25,21 +26,25 @@ "test": "npm-run-all test:unit:with-coverage test:bench", | ||
"coveralls": "cat ./build/coverage/lcov.info | coveralls", | ||
"changelog": "pr-log" | ||
"changelog": "pr-log", | ||
"update:eslint-docs": "eslint-doc-generator --ignore-config all --url-configs \"https://github.com/lo1tuma/eslint-plugin-mocha#configs\"", | ||
"release": "release-it" | ||
}, | ||
"dependencies": { | ||
"eslint-utils": "^3.0.0", | ||
"rambda": "^7.1.0" | ||
"rambda": "^7.4.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.3.6", | ||
"chai": "^4.3.7", | ||
"coveralls": "^3.1.1", | ||
"eslint": "^8.13.0", | ||
"eslint-plugin-eslint-plugin": "^4.1.0", | ||
"eslint": "^8.29.0", | ||
"eslint-doc-generator": "^1.0.2", | ||
"eslint-plugin-eslint-plugin": "^5.0.6", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-unicorn": "^37.0.1", | ||
"markdownlint-cli": "^0.31.1", | ||
"mocha": "^9.2.2", | ||
"eslint-plugin-unicorn": "^45.0.1", | ||
"markdownlint-cli": "^0.32.2", | ||
"mocha": "^10.0.0", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^15.1.0", | ||
"pr-log": "^4.0.0", | ||
"semver": "^7.3.6" | ||
"pr-log": "^5.0.0", | ||
"release-it": "^16.2.0", | ||
"semver": "^7.3.8" | ||
}, | ||
@@ -46,0 +51,0 @@ "peerDependencies": { |
104
README.md
@@ -32,22 +32,52 @@ [![NPM Version](https://img.shields.io/npm/v/eslint-plugin-mocha.svg?style=flat)](https://www.npmjs.org/package/eslint-plugin-mocha) | ||
* `additionalCustomNames`: This allows rules to check additional function names when looking for suites or test cases. This might be used with a custom Mocha extension, such as [`ember-mocha`](https://github.com/switchfly/ember-mocha) | ||
**Example:** | ||
* `additionalCustomNames`: This allows rules to check additional function names when looking for suites or test cases. This might be used with a custom Mocha extension, such as [`ember-mocha`](https://github.com/switchfly/ember-mocha) or [`mocha-each`](https://github.com/ryym/mocha-each). | ||
```json | ||
{ | ||
"rules": { | ||
"mocha/no-skipped-tests": "error", | ||
"mocha/no-exclusive-tests": "error" | ||
}, | ||
"settings": { | ||
"mocha/additionalCustomNames": [ | ||
{ "name": "describeModule", "type": "suite", "interfaces": [ "BDD" ] }, | ||
{ "name": "testModule", "type": "testCase", "interfaces": [ "TDD" ] } | ||
] | ||
**Example:** | ||
```json | ||
{ | ||
"rules": { | ||
"mocha/no-skipped-tests": "error", | ||
"mocha/no-exclusive-tests": "error" | ||
}, | ||
"settings": { | ||
"mocha/additionalCustomNames": [ | ||
{ "name": "describeModule", "type": "suite", "interfaces": [ "BDD" ] }, | ||
{ "name": "testModule", "type": "testCase", "interfaces": [ "TDD" ] } | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
``` | ||
### Recommended config | ||
The `name` property can be in any of the following forms: | ||
* A plain name e.g. `describeModule`, which allows: | ||
```javascript | ||
describeModule("example", function() { ... }); | ||
``` | ||
* A dotted name, e.g. `describe.modifier`, which allows: | ||
```javascript | ||
describe.modifier("example", function() { ... }); | ||
``` | ||
* A name with parentheses, e.g. `forEach().describe`, which allows: | ||
```javascript | ||
forEach([ 1, 2, 3 ]) | ||
.describe("example", function(n) { ... }); | ||
``` | ||
* Any combination of the above, e.g. `forEach().describeModule.modifier`, which allows: | ||
```javascript | ||
forEach([ 1, 2, 3 ]) | ||
.describeModule.modifier("example", function(n) { ... }); | ||
``` | ||
## Configs | ||
### `recommended` | ||
This plugin exports a recommended config that enforces good practices. | ||
@@ -65,6 +95,44 @@ | ||
### `all` | ||
There's also a configuration that enables all of our rules. | ||
See [Configuring Eslint](http://eslint.org/docs/user-guide/configuring) on [eslint.org](http://eslint.org) for more info. | ||
## Rules documentation | ||
## Rules | ||
The documentation of the rules [can be found here](docs/rules). | ||
<!-- begin auto-generated rules list --> | ||
πΌ [Configurations](https://github.com/lo1tuma/eslint-plugin-mocha#configs) enabled in.\ | ||
β οΈ [Configurations](https://github.com/lo1tuma/eslint-plugin-mocha#configs) set to warn in.\ | ||
π« [Configurations](https://github.com/lo1tuma/eslint-plugin-mocha#configs) disabled in.\ | ||
β Set in the `recommended` [configuration](https://github.com/lo1tuma/eslint-plugin-mocha#configs).\ | ||
π§ Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix). | ||
| NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Description | πΌ | β οΈ | π« | π§ | | ||
| :----------------------------------------------------------------- | :---------------------------------------------------------------------- | :- | :- | :- | :- | | ||
| [handle-done-callback](docs/rules/handle-done-callback.md) | Enforces handling of callbacks for async tests | β | | | | | ||
| [max-top-level-suites](docs/rules/max-top-level-suites.md) | Enforce the number of top-level suites in a single file | β | | | | | ||
| [no-async-describe](docs/rules/no-async-describe.md) | Disallow async functions passed to describe | β | | | π§ | | ||
| [no-empty-description](docs/rules/no-empty-description.md) | Disallow empty test descriptions | β | | | | | ||
| [no-exclusive-tests](docs/rules/no-exclusive-tests.md) | Disallow exclusive tests | | β | | | | ||
| [no-exports](docs/rules/no-exports.md) | Disallow exports from test files | β | | | | | ||
| [no-global-tests](docs/rules/no-global-tests.md) | Disallow global tests | β | | | | | ||
| [no-hooks](docs/rules/no-hooks.md) | Disallow hooks | | | β | | | ||
| [no-hooks-for-single-case](docs/rules/no-hooks-for-single-case.md) | Disallow hooks for a single test or test suite | | | β | | | ||
| [no-identical-title](docs/rules/no-identical-title.md) | Disallow identical titles | β | | | | | ||
| [no-mocha-arrows](docs/rules/no-mocha-arrows.md) | Disallow arrow functions as arguments to mocha functions | β | | | π§ | | ||
| [no-nested-tests](docs/rules/no-nested-tests.md) | Disallow tests to be nested within other tests | β | | | | | ||
| [no-pending-tests](docs/rules/no-pending-tests.md) | Disallow pending tests | | β | | | | ||
| [no-return-and-callback](docs/rules/no-return-and-callback.md) | Disallow returning in a test or hook function that uses a callback | β | | | | | ||
| [no-return-from-async](docs/rules/no-return-from-async.md) | Disallow returning from an async test or hook | | | β | | | ||
| [no-setup-in-describe](docs/rules/no-setup-in-describe.md) | Disallow setup in describe blocks | β | | | | | ||
| [no-sibling-hooks](docs/rules/no-sibling-hooks.md) | Disallow duplicate uses of a hook at the same level inside a describe | β | | | | | ||
| [no-skipped-tests](docs/rules/no-skipped-tests.md) | Disallow skipped tests | | β | | | | ||
| [no-synchronous-tests](docs/rules/no-synchronous-tests.md) | Disallow synchronous tests | | | β | | | ||
| [no-top-level-hooks](docs/rules/no-top-level-hooks.md) | Disallow top-level hooks | | β | | | | ||
| [prefer-arrow-callback](docs/rules/prefer-arrow-callback.md) | Require using arrow functions for callbacks | | | β | π§ | | ||
| [valid-suite-description](docs/rules/valid-suite-description.md) | Require suite descriptions to match a pre-configured regular expression | | | β | | | ||
| [valid-test-description](docs/rules/valid-test-description.md) | Require test descriptions to match a pre-configured regular expression | | | β | | | ||
<!-- end auto-generated rules list --> |
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
90416
137
14
Updatedrambda@^7.4.0