noIdenticalTestTitle
Summary
Section titled “Summary”- Rule available since:
v2.4.12 - Diagnostic Category:
lint/nursery/noIdenticalTestTitle - This rule doesn’t have a fix.
- The default severity of this rule is warning.
- This rule belongs to the following domains:
- Sources:
- Same as
jest/no-identical-title - Same as
vitest/no-identical-title
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noIdenticalTestTitle": "error" } } }}Description
Section titled “Description”Disallow identical titles in test suites and test cases.
Having identical titles for two different tests or test suites at the same level may create confusion. For example, when a test fails it is hard to tell which test exactly failed based on its title alone.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”it('should do bar', () => {});it('should do bar', () => {});code-block.js:2:1 lint/nursery/noIdenticalTestTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Duplicate test title found.
1 │ it(‘should do bar’, () => {});
> 2 │ it(‘should do bar’, () => {});
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 │
ℹ A test with this title already exists in the same scope.
ℹ Rename the test to give it a unique, descriptive title.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
describe('foo', () => { it('should do bar', () => {}); it('should do bar', () => {});});code-block.js:3:3 lint/nursery/noIdenticalTestTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Duplicate test title found.
1 │ describe(‘foo’, () => {
2 │ it(‘should do bar’, () => {});
> 3 │ it(‘should do bar’, () => {});
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 │ });
5 │
ℹ A test with this title already exists in the same scope.
ℹ Rename the test to give it a unique, descriptive title.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
describe('foo', () => {});describe('foo', () => {});code-block.js:2:1 lint/nursery/noIdenticalTestTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Duplicate describe title found.
1 │ describe(‘foo’, () => {});
> 2 │ describe(‘foo’, () => {});
│ ^^^^^^^^^^^^^^^^^^^^^^^^^
3 │
ℹ A describe with this title already exists in the same scope.
ℹ Rename the describe to give it a unique, descriptive title.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
describe('foo', () => { describe('baz', () => {}); describe('baz', () => {});});code-block.js:3:3 lint/nursery/noIdenticalTestTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Duplicate describe title found.
1 │ describe(‘foo’, () => {
2 │ describe(‘baz’, () => {});
> 3 │ describe(‘baz’, () => {});
│ ^^^^^^^^^^^^^^^^^^^^^^^^^
4 │ });
5 │
ℹ A describe with this title already exists in the same scope.
ℹ Rename the describe to give it a unique, descriptive title.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
describe('foo', () => { it('should do foo', () => {}); it('should do bar', () => {});});
describe('bar', () => {});describe('foo', () => { describe('baz', () => { it('should work', () => {}); }); describe('bar', () => { it('should work', () => {}); });});Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.