# vitest/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 that's a string equal to a name the file imports. A title like `slugify.name` is reported too. If your config sets `settings.vitest.typecheck` to `true`, strings aren't reported.

`--fix` replaces the title with the name, unless the import is type-only.

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

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

## Examples

Reported:

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

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

{/* bad */}
```ts
import { describe } from "vitest";
import { slugify } from "./slugify";

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

Not reported:

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

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

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