Gathering detailed insights and metrics for eslint-plugin-mocha
Gathering detailed insights and metrics for eslint-plugin-mocha
Gathering detailed insights and metrics for eslint-plugin-mocha
Gathering detailed insights and metrics for eslint-plugin-mocha
npm install eslint-plugin-mocha
Typescript
Module System
Node Version
TypeScript (98.22%)
JavaScript (1.78%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
286 Stars
717 Commits
66 Forks
6 Watchers
7 Branches
47 Contributors
Updated on May 30, 2025
Latest Version
11.1.0
Package Id
eslint-plugin-mocha@11.1.0
Unpacked Size
120.11 kB
Size
22.57 kB
File Count
46
Node Version
22.14.0
Published on
May 24, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
1
ESLint rules for mocha.
This plugin requires ESLint 9.0.0
or later.
1npm install --save-dev eslint-plugin-mocha
eslint.config.js
To use this plugin with eslint flat configuration format:
1import mochaPlugin from "eslint-plugin-mocha"; 2 3export default [ 4 mochaPlugin.configs.recommended, // or `mochaPlugin.configs.all` to enable all 5 // ... Your configurations here 6];
This plugin supports the following settings, which are used by multiple rules:
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
or mocha-each
.
Example:
1{ 2 "rules": { 3 "mocha/no-pending-tests": "error", 4 "mocha/no-exclusive-tests": "error" 5 }, 6 "settings": { 7 "mocha/additionalCustomNames": [ 8 { 9 "name": "describeModule", 10 "type": "suite", 11 "interface": "BDD" 12 }, 13 { 14 "name": "testModule", 15 "type": "testCase", 16 "interface": "TDD" 17 } 18 ] 19 } 20}
The name
property can be in any of the following forms:
A plain name e.g. describeModule
, which allows:
1describeModule("example", function() { ... });
A dotted name, e.g. describe.modifier
, which allows:
1describe.modifier("example", function() { ... });
A name with parentheses, e.g. forEach().describe
, which allows:
1forEach([ 1, 2, 3 ]) 2 .describe("example", function(n) { ... });
Any combination of the above, e.g. forEach().describeModule.modifier
, which allows:
1forEach([ 1, 2, 3 ]) 2 .describeModule.modifier("example", function(n) { ... });
interface
: This allows to select either TDD
, BDD
(default) or exports
. When using exports
mocha variables are resolved from named import
statements instead of global variables.
💼 Configurations enabled in.
⚠️ Configurations set to warn in.
🚫 Configurations disabled in.
✅ Set in the recommended
configuration.
🔧 Automatically fixable by the --fix
CLI option.
Name | Description | 💼 | ⚠️ | 🚫 | 🔧 |
---|---|---|---|---|---|
consistent-interface | Enforces consistent use of mocha interfaces | ||||
consistent-spacing-between-blocks | Require consistent spacing between blocks | ✅ | 🔧 | ||
handle-done-callback | Enforces handling of callbacks for async tests | ✅ | |||
max-top-level-suites | Enforce the number of top-level suites in a single file | ✅ | |||
no-async-suite | Disallow async functions passed to a suite | ✅ | 🔧 | ||
no-empty-title | Disallow empty test descriptions | ✅ | |||
no-exclusive-tests | Disallow exclusive tests | ✅ | |||
no-exports | Disallow exports from test files | ✅ | |||
no-global-tests | Disallow global tests | ✅ | |||
no-hooks | Disallow hooks | ✅ | |||
no-hooks-for-single-case | Disallow hooks for a single test or test suite | ✅ | |||
no-identical-title | Disallow identical titles | ✅ | |||
no-mocha-arrows | Disallow arrow functions as arguments to mocha functions | ✅ | 🔧 | ||
no-nested-tests | Disallow tests to be nested within other tests | ✅ | |||
no-pending-tests | Disallow pending tests | ✅ | |||
no-return-and-callback | Disallow returning in a test or hook function that uses a callback | ✅ | |||
no-return-from-async | Disallow returning from an async test or hook | ✅ | |||
no-setup-in-describe | Disallow setup in describe blocks | ✅ | |||
no-sibling-hooks | Disallow duplicate uses of a hook at the same level inside a suite | ✅ | |||
no-synchronous-tests | Disallow synchronous tests | ✅ | |||
no-top-level-hooks | Disallow top-level hooks | ✅ | |||
prefer-arrow-callback | Require using arrow functions for callbacks | ✅ | 🔧 | ||
valid-suite-title | Require suite descriptions to match a pre-configured regular expression | ✅ | |||
valid-test-title | Require test descriptions to match a pre-configured regular expression | ✅ |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
24 commit(s) and 6 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 11/16 approved changesets -- score normalized to 6
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
8 existing vulnerabilities detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More