Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

eslint-plugin-mocha

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-mocha - npm Package Compare versions

Comparing version 10.1.0 to 10.2.0

2

lib/rules/max-top-level-suites.js

@@ -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": {

@@ -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 -->
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc