New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-test-groups

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-test-groups

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

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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:

  • Writing custom TypeScript ESLint rules: How I learned to love the AST
  • AST Explorer
    • Set language 'JavaScript'
    • Set parser to '@typescript-eslint/parser'

License

MIT

FAQs

Package last updated on 08 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc