Skip to content

useLowercaseTestTitle (JavaScript)

Language JavaScript (and super languages)
biome.json
{
"linter": {
"rules": {
"nursery": {
"useLowercaseTestTitle": "error"
}
}
}
}

Require test and test suite titles to start with a lowercase letter.

Titles of describe, test, it, and bench blocks often read as a sentence, such as it("returns the cached value"). Starting every title with a lowercase letter keeps test reports consistent.

Only the first character of the title is checked, so names and acronyms later in the title can keep their capitalization. Titles built from a template literal with ${} placeholders are not checked.

The fix is unsafe because test runners use titles to name stored snapshots and to select which tests to run. Renaming a test can leave its stored snapshot orphaned.

it("Returns the cached value", () => {});
code-block.js:1:4 lint/nursery/useLowercaseTestTitle  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ This test title starts with an uppercase letter.

> 1 │ it("Returns the cached value", () => {});
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ Test titles that consistently start with a lowercase letter make test reports easier to read.

ℹ Change the first letter of the title to lowercase.

ℹ 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.

ℹ Unsafe fix: Lowercase the first letter of the title.

1 │ - it("Returns·the·cached·value",·()·=>·{});
1 │ + it("returns·the·cached·value",·()·=>·{});
2 2 │

describe(`Cache`, () => {});
code-block.js:1:10 lint/nursery/useLowercaseTestTitle  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ This test title starts with an uppercase letter.

> 1 │ describe(`Cache`, () => {});
│ ^^^^^^^
2 │

ℹ Test titles that consistently start with a lowercase letter make test reports easier to read.

ℹ Change the first letter of the title to lowercase.

ℹ 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.

ℹ Unsafe fix: Lowercase the first letter of the title.

1 │ - describe(`Cache`,·()·=>·{});
1 │ + describe(`cache`,·()·=>·{});
2 2 │

it("returns the cached value", () => {});
describe("cache", () => {});
test("parses JSON input", () => {});
test("123 is a number", () => {});

Type: string[]

Default: []

A list of prefixes. Titles that start with one of these prefixes are not checked. Uppercase and lowercase letters are treated as different, so the prefix GET doesn’t match a title that starts with Get.

biome.json
{
"linter": {
"rules": {
"nursery": {
"useLowercaseTestTitle": {
"level": "on",
"options": {
"allowedPrefixes": [
"GET",
"POST"
]
}
}
}
}
}
}
test("Returns the list of users", () => {});
code-block.js:1:6 lint/nursery/useLowercaseTestTitle  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ This test title starts with an uppercase letter.

> 1 │ test("Returns the list of users", () => {});
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ Test titles that consistently start with a lowercase letter make test reports easier to read.

ℹ Change the first letter of the title to lowercase.

ℹ 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.

ℹ Unsafe fix: Lowercase the first letter of the title.

1 │ - test("Returns·the·list·of·users",·()·=>·{});
1 │ + test("returns·the·list·of·users",·()·=>·{});
2 2 │

test("GET /users returns the list of users", () => {});
describe("POST /users", () => {});