# bun:test/prefer-describe-function-title

> Require `describe(fn, ...)` instead of a string with the name of an imported function

`describe` accepts a function or a class as its title and prints its name. A string that repeats the name isn't updated when you rename the function, so the test output keeps showing a name that no longer exists.

The rule reports a `describe` title when it's a string equal to a name the file imports. A title like `slugify.name` is reported too. A name that's only imported as a type isn't reported, because there's no value to pass.

`--fix-suggestions` replaces the title with the name. `--fix` doesn't, because the import might not be a function or a class.

{/* 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-describe-function-title" = "error" # or "warn"
```

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

## Examples

Reported:

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

describe("slugify", () => {
  test("replaces spaces", () => {
    expect(slugify("a b")).toBe("a-b");
  });
});
```

{/* bad */}
```ts
import { describe } from "bun:test";
import { slugify } from "./slugify";

describe(slugify.name, () => {});
```

Not reported:

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

describe(slugify, () => {
  test("replaces spaces", () => {
    expect(slugify("a b")).toBe("a-b");
  });
});

describe("slugify with options", () => {});
```

{/* good */}
```ts
import { describe } from "bun:test";
import type { Slug } from "./slugify";

describe("Slug", () => {});
```
