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
eslint-plugin-no-only-tests
ESLint rule for .only blocks in mocha tests
eslint-plugin-ava
ESLint rules for AVA
eslint-plugin-mocha-no-only
Warns when a .only function call is chained to a Mocha JavaScript test
eslint-plugin-tags-validator
Validates tags applied to Mocha tests, primarily as defined using @cypress/grep
npm install eslint-plugin-mocha
86.6
Supply Chain
94.2
Quality
83.6
Maintenance
100
Vulnerability
95.1
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
281 Stars
681 Commits
61 Forks
7 Watching
7 Branches
47 Contributors
Updated on 31 Oct 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-6.8%
237,388
Compared to previous day
Last week
5.1%
1,416,198
Compared to previous week
Last month
25.2%
5,301,458
Compared to previous month
Last year
11.1%
52,908,530
Compared to previous year
3
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 the new eslint configuration format (flat config):
1import mochaPlugin from "eslint-plugin-mocha"; 2 3export default [ 4 mochaPlugin.configs.flat.recommended, // or `mochaPlugin.configs.flat.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-skipped-tests": "error", 4 "mocha/no-exclusive-tests": "error" 5 }, 6 "settings": { 7 "mocha/additionalCustomNames": [ 8 { 9 "name": "describeModule", 10 "type": "suite", 11 "interfaces": ["BDD"] 12 }, 13 { 14 "name": "testModule", 15 "type": "testCase", 16 "interfaces": ["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) { ... });
recommended
This plugin exports a recommended config that enforces good practices.
Enable it with the extends option:
1{ 2 "extends": ["plugin:mocha/recommended"] 3}
all
There's also a configuration that enables all of our rules.
See Configuring Eslint on eslint.org for more info.
💼 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-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-describe | Disallow async functions passed to describe | ✅ | 🔧 | ||
no-empty-description | 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 describe | ✅ | |||
no-skipped-tests | Disallow skipped tests | ✅ | |||
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-description | Require suite descriptions to match a pre-configured regular expression | ✅ | |||
valid-test-description | Require test descriptions to match a pre-configured regular expression | ✅ |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 10/11 approved changesets -- score normalized to 9
Reason
4 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
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 2024-11-18
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