Test and suite titles serve as documentation for your test suite. They appear in test reports, command-line output, and IDE test runners. When titles are empty or contain only whitespace, it becomes difficult to:
Descriptive titles make your test suite more maintainable and help developers quickly understand the purpose of each test. They are especially important when tests fail, as they provide immediate context about what functionality is broken.
Replace empty or whitespace-only titles with a non-empty title that identifies the behavior under test.
it("", async () => {
const html = await renderMarkdown("**Hello**");
expect(html).toContain("<strong>Hello</strong>");
}); // Noncompliant
test(" ", async ({ page }) => {
await page.goto("/login");
await page.getByLabel("Email").fill("sam@example.com");
await page.getByRole("button", { name: "Send magic link" }).click();
await expect(page.getByText("Check your inbox")).toBeVisible();
}); // Noncompliant
describe(" ", () => { // Noncompliant
it("rejects expired invite links", () => {});
});
it("renders bold markdown as <strong> HTML", async () => {
const html = await renderMarkdown("**Hello**");
expect(html).toContain("<strong>Hello</strong>");
});
test("sends a magic link from the login page", async ({ page }) => {
await page.goto("/login");
await page.getByLabel("Email").fill("sam@example.com");
await page.getByRole("button", { name: "Send magic link" }).click();
await expect(page.getByText("Check your inbox")).toBeVisible();
});
describe("invite link validation", () => {
it("rejects expired invite links", () => {});
});
test(name, fn, timeout)