Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 918 Bytes

no-empty-description.md

File metadata and controls

48 lines (32 loc) · 918 Bytes

Disallow empty test descriptions (mocha/no-empty-description)

💼 This rule is enabled in the ✅ recommended config.

This rule enforces you to specify the suite/test descriptions for each test.

Rule Details

This rule checks each mocha test function to have a non-empty description.

The following patterns are considered problems:

it();

suite('');

test(function () {});

test.only(' ', function () {});

These patterns would not be considered problems:

describe('foo', function () {
    it('bar');
});

suite('foo', function () {
    test('bar');
});

Options

Example of a custom rule configuration:

rules: {
    "mocha/no-empty-description": [ "warn", {
        testNames: ["it", "specify", "test", "mytestname"],
        message: 'custom error message'
    } ]
}