Giter VIP home page Giter VIP logo

eslint-plugin-mocha's Introduction

NPM Version GitHub Actions status Coverage Status NPM Downloads

eslint-plugin-mocha

ESLint rules for mocha.

Install and configure

This plugin requires ESLint 4.0.0 or later.

npm install --save-dev eslint-plugin-mocha

Then add a reference to this plugin and selected rules in your eslint config:

{
    "plugins": [
        "mocha"
    ]
}

Plugin Settings

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 Example:
{
    "rules": {
        "mocha/no-skipped-tests": "error",
        "mocha/no-exclusive-tests": "error"
    },
    "settings": {
        "mocha/additionalCustomNames": [
            { "name": "describeModule", "type": "suite", "interfaces": [ "BDD" ] },
            { "name": "testModule", "type": "testCase", "interfaces": [ "TDD" ] }
        ]
    }
}

Configs

recommended

This plugin exports a recommended config that enforces good practices.

Enable it with the extends option:

{
    "extends": [
        "plugin:mocha/recommended"
    ]
}

all

There's also a configuration that enables all of our rules.

See Configuring Eslint on eslint.org for more info.

Rules

πŸ’Ό 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 πŸ’Ό ⚠️ 🚫 πŸ”§
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 βœ…

eslint-plugin-mocha's People

Contributors

lo1tuma avatar jfmengels avatar papandreou avatar brettz9 avatar alecxe avatar greenkeeper[bot] avatar rhysd avatar greenkeeperio-bot avatar edg2s avatar bourgoismickael avatar szuend avatar screendriver avatar bmish avatar straub avatar 2fast2fourier avatar quarklemotion avatar lakitna avatar treythomas123 avatar pasieronen avatar alexlafroscia avatar pustovitdmytro avatar cruzdanilo avatar taymoork2 avatar manovotny avatar aldermoovel avatar jawadst avatar opravil-jan avatar ddzz avatar modosc avatar epmatsw avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.