diff --git a/README.md b/README.md
index ebe757d..c9fdbbd 100644
--- a/README.md
+++ b/README.md
@@ -65,8 +65,9 @@ This rule supports opt-in autofixing when the `fix` option is set to `true` to a
## Options
-Option | Type | Description
----|---|---
-`block` | `string[]` | Specify the block names that your testing framework uses. Add a `*` to the end of any string to enable prefix matching (ie. `test*` will match `testExample.only`)
Defaults to `["describe", "it", "context", "test", "tape", "fixture", "serial", "Feature", "Scenario", "Given", "And", "When", "Then"]`
-`focus` | `string[]` | Specify the focus scope that your testing framework uses.
Defaults to `["only"]`
-`fix` | `boolean` | Enable this rule to auto-fix violations, useful for a pre-commit hook, not recommended for users with auto-fixing enabled in their editor.
Defaults to `false`
+| Option | Type | Description |
+| ----------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `block` | `string[]` | Specify the block names that your testing framework uses. Add a `*` to the end of any string to enable prefix matching (ie. `test*` will match `testExample.only`)
Defaults to `["describe", "it", "context", "test", "tape", "fixture", "serial", "Feature", "Scenario", "Given", "And", "When", "Then"]` |
+| `focus` | `string[]` | Specify the focus scope that your testing framework uses.
Defaults to `["only"]` |
+| `functions` | `string[]` | Specify not permitted functions. Good examples are `fit` or `xit`.
Defaults to `[]` (disabled) |
+| `fix` | `boolean` | Enable this rule to auto-fix violations, useful for a pre-commit hook, not recommended for users with auto-fixing enabled in their editor.
Defaults to `false` |
diff --git a/rules/no-only-tests.js b/rules/no-only-tests.js
index aa63734..9c9f3cd 100644
--- a/rules/no-only-tests.js
+++ b/rules/no-only-tests.js
@@ -10,8 +10,23 @@
//------------------------------------------------------------------------------
const defaultOptions = {
- block: ['describe', 'it', 'context', 'test', 'tape', 'fixture', 'serial', 'Feature', 'Scenario', 'Given', 'And', 'When', 'Then'],
+ block: [
+ 'describe',
+ 'it',
+ 'context',
+ 'test',
+ 'tape',
+ 'fixture',
+ 'serial',
+ 'Feature',
+ 'Scenario',
+ 'Given',
+ 'And',
+ 'When',
+ 'Then',
+ ],
focus: ['only'],
+ functions: [],
fix: false,
};
@@ -44,6 +59,14 @@ module.exports = {
uniqueItems: true,
default: defaultOptions.focus,
},
+ functions: {
+ type: 'array',
+ items: {
+ type: 'string',
+ },
+ uniqueItems: true,
+ default: defaultOptions.functions,
+ },
fix: {
type: 'boolean',
default: defaultOptions.fix,
@@ -57,10 +80,18 @@ module.exports = {
const options = Object.assign({}, defaultOptions, context.options[0]);
const blocks = options.block || [];
const focus = options.focus || [];
+ const functions = options.functions || [];
const fix = !!options.fix;
return {
Identifier(node) {
+ if (functions.length && functions.indexOf(node.name) > -1) {
+ context.report({
+ node,
+ message: node.name + ' not permitted',
+ });
+ }
+
const parentObject = node.parent && node.parent.object;
if (parentObject == null) return;
if (focus.indexOf(node.name) === -1) return;