Skip to content

Ensures tests are marked with a '@group' doc comment.

License

Notifications You must be signed in to change notification settings

bytescale/eslint-plugin-test-groups

Repository files navigation

ESLint Rule: require-groups-for-tests

Requires return types on lambdas that return object literals.

Installation

npm install --save-dev eslint-plugin-test-groups

.eslintrc.yaml:

root: true
parser: "@typescript-eslint/parser"
parserOptions:
  project: "./tsconfig.json"
plugins:
  - "@typescript-eslint"
  - "test-groups" # ← Add this
rules:
  # ↓ And this:
  "test-groups/require-groups-for-tests":
    - error
    - groupWhitelist:
        - "some-test-group"
        - "another-test-group"

Examples

/**
 * If the 'group' attribute is not declared, then this ESLint rule will return an error.
 *
 * Furthermore, the 'group' attribute must match one the configured groups for the rule (you define these).
 *
 * @group some-test-group
 */
describe("Some Tests", () => {

})

Benefits

Ensures every test is assigned to a group.

Restricting the groups to known values allows you to easily keep your CI pipelines in sync, for example, if you're running tests in parallel and need to list each group individually in your CI config.

Credits

The following resources were very useful when writing this plugin:

License

MIT

About

Ensures tests are marked with a '@group' doc comment.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published