# eslint-plugin-test-comments **Repository Path**: mirrors_allegro/eslint-plugin-test-comments ## Basic Information - **Project Name**: eslint-plugin-test-comments - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-22 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # eslint-plugin-test-comments Enforces BDD style comments (given/when/then) in your JavaScript tests! Rule is inspired by [Spock framework](https://spockframework.org/spock/docs/2.0/all_in_one.html#_blocks). # Installation with npm: ``` npm i -D eslint-plugin-test-comments ``` or yarn: ``` yarn add -D eslint-plugin-test-comments ``` ## Configuration ```json "plugins": [ "test-comments" ], "rules": { "test-comments/test-comments": "error" } ``` ## Options This rule accepts one boolean option: `allowNoComments`: does not report any errors when there are no BDD comments in a test, defaults with `false`. For example: ```jsonc { "test-comments/test-comments": ["error", { allowNoComments: true }] } ``` ## Rule Details Examples of **incorrect** code. ```ts it('test', () => { // given // and // given }); ``` ```ts it('test', () => { // and // given // when }); ``` ```ts it('test', () => {}); ``` Examples of **correct** code ```ts it('test', () => { // given // and // when // then }); ``` ```ts it('test', () => { // given something // and something else // when something occurs // then something should work // some other comment }); ``` Examples of **correct** code with `allowNoComments` option. ```ts it('test', () => {}); ```