---
title: "lint/pest/prefer-dedicated-expectation"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/pest/prefer-dedicated-expectation" />

In the [`coding-style`](/docs/rules/sets/coding-style) set. Unsafe fix: it can change behaviour. Runs when pest is installed.

## What it does

Use dedicated Pest matchers (toBeArray(), toStartWith(), toHaveCount(), ...) instead of expect(fn(...))->toBeTrue().

## Configuration

```toml title="pun.toml"
[lint.rules]
"pest/prefer-dedicated-expectation" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`Pun/use_dedicated_expectation`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/) (pun)
- [`use-dedicated-expectation`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#use-dedicated-expectation) (mago-linter)

[More lint/pest rules](/docs/rules/lint/pest) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
