Registry / testing / eslint-plugin-bdd

eslint-plugin-bdd

JSON →
library2.1.1jsnpmunverified

This ESLint plugin provides rules to enforce best practices and prevent common mistakes in BDD-style test suites, such as accidentally leaving focused tests (fit, fdescribe, etc.) or excluded tests (xit, xdescribe). Version 2.1.1 is the current stable release, with a lightweight peer dependency on ESLint >=0.8.0. Unlike similar plugins targeting specific frameworks (mocha, jasmine), this plugin covers multiple BDD frameworks with generic rules.

npm install eslint-plugin-bdd
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-BDD
E
eslint-plugin-bdd
testingjavascriptv2.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Plugin object
import plugin from 'eslint-plugin-bdd' // or const plugin = require('eslint-plugin-bdd')
The plugin is typically used via ESLint configuration file, not imported directly. Use plugins: ['bdd'] in .eslintrc or import for custom rule configuration.
Rules
// Configure rules in .eslintrc: rules: { 'bdd/focus': 2, 'bdd/exclude': 1 }
rules: { 'focus': 2 } // Missing plugin prefix
Rules must be referenced with the plugin prefix 'bdd/' in your ESLint configuration.

Shows how to configure eslint-plugin-bdd in .eslintrc and demonstrates rule detection of a focused test.

// .eslintrc.json { "plugins": ["bdd"], "rules": { "bdd/focus": "error", "bdd/exclude": "warn" } } // Example test file that will be flagged: describe('suite', () => { it('test', () => { /* ... */ }); fit('focused test', () => { /* ... */ }); // Error: focused test });
Debug
Known issues
gotchaThe plugin only provides two rules (focus and exclude). It does not cover all BDD anti-patterns or framework-specific features.
fix
Consider supplementing with framework-specific plugins for more comprehensive coverage.
affects: >=2.0.0
gotchaThe focus rule may produce false positives for legitimate test names containing 'fit' or 'fdescribe' as substrings.
fix
Use ESLint comment overrides or configure rule options if available. Check docs for regex options.
affects: >=1.0.0
gotchaThe exclude rule treats 'xit', 'xdescribe', etc. as errors, but these are sometimes intentionally used during development.
fix
Set rule severity to 'warn' or disable it during development.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'eslint-plugin-bdd'
Package not installed or not in node_modules.
fix
Run npm install eslint-plugin-bdd --save-dev
Configuration for rule "bdd/focus" is invalid: Severity should be one of the following: 0 = off, 1 = warn, 2 = error
Invalid severity value in ESLint config.
fix
Use 0, 1, 2 or 'off', 'warn', 'error' (as string) for rule severity.
ESLint couldn't find the plugin "eslint-plugin-bdd".
Plugin not listed in plugins array or package not installed.
fix
Add "bdd" to plugins array in .eslintrc and ensure package is installed.
Upgrade
Version history
2.1.1latest on npm
Audit
Dependencies
eslintrequiredRequired as a peer dependency to provide the ESLint runtime environment for the plugin rules.
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-bdd — npm install eslint-plugin-bdd · libregistry