# bun:test/prefer-lowercase-title

> Require the titles of tests and `describe` blocks to start with a lowercase letter

`bun test` prints a title after the titles of the blocks around it, as in `cart > adds an item`. A capital in the middle of that line reads like the start of a new sentence, and a mix of both styles is harder to scan.

`--fix` makes the first letter lowercase. It doesn't touch titles in a file that uses `toMatchSnapshot()` or `toThrowErrorMatchingSnapshot()`, because snapshots are stored under their test's title.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"bun:test/prefer-lowercase-title" = "error" # or "warn"
```

Every option, set to its default:

```toml bunfig.toml
[lint.rules]
"bun:test/prefer-lowercase-title" = ["error", {
  ignore = [], # list of "describe", "it" or "test"
  allowedPrefixes = [], # list of strings
  ignoreTopLevelDescribe = false,
  lowercaseFirstCharacterOnly = true,
}]
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```ts
import { expect, test } from "bun:test";

test("Adds an item", () => {
  expect(cart.add(item)).toBe(1);
});
```

Not reported:

{/* good */}
```ts
import { expect, test } from "bun:test";

test("adds an item", () => {
  expect(cart.add(item)).toBe(1);
});
```

## Options

| Option | Default | What it does |
| --- | --- | --- |
| `ignore` | `[]` | Functions to skip: `"describe"`, `"test"`, `"it"`. `"test"` doesn't cover `it`. |
| `allowedPrefixes` | `[]` | Allow a title that starts with one of these strings. |
| `ignoreTopLevelDescribe` | `false` | Allow a capital in a `describe` that isn't inside another block. |
| `lowercaseFirstCharacterOnly` | `true` | Set it to `false` to report an uppercase letter anywhere in the title. `--fix` then makes the whole title lowercase. |

`allowedPrefixes` is for titles that start with a name you can't change:

{/* good {"options": [{"allowedPrefixes": ["GET", "POST"]}]} */}
```ts
import { test } from "bun:test";

test("GET /users returns a list", () => {});
```

With `ignoreTopLevelDescribe`, the outer `describe` can be named after a class or a component. Only `"Checkout"` is reported here:

{/* bad {"options": [{"ignoreTopLevelDescribe": true}], "count": 1} */}
```ts
import { describe, test } from "bun:test";

describe("Cart", () => {
  describe("Checkout", () => {
    test("adds an item", () => {});
  });
});
```

With `{ "lowercaseFirstCharacterOnly": false }`:

{/* bad {"options": [{"lowercaseFirstCharacterOnly": false}]} */}
```ts
import { test } from "bun:test";

test("adds an Item", () => {});
```
