An issue is raised when two tests in the same suite have the same title.
Duplicate test titles make failures ambiguous. Test reports, CI logs, and IDE integrations usually identify a test by its suite path and title. If two tests in the same suite share a title, the failure output does not clearly show which test failed.
Developers spend more time locating the failing test, which slows debugging and reduces confidence in the test suite.
Give each test in a suite a distinct title.
This applies to test suites written with Bun’s bun:test runner and Node.js’s built-in node:test module, as well as the
other supported JavaScript test frameworks.
describe('shopping cart', () => {
it('adds an item', () => {});
it('adds an item', () => {}); // Noncompliant
});
describe('shopping cart', () => {
it('adds an item to an empty cart', () => {});
it('adds an item to an existing cart', () => {});
});
test(name, fn, timeout)testtest(title, body)