# Quick Start (/docs)



Introduction [#introduction]

`vitest-snap` like its name suggest is a Snapshot testing library based on the [Vitest](https://vitest.dev/) testing framework.

Features [#features]

* **Auto-naming** — snapshot filenames are derived from the test name automatically; no boilerplate required
* **Parameterised snapshots** — pass `args` to generate distinct snapshot files per test input
* **Filtering & redactions** — scrub, replace, remove or sort values before snapshotting with a composable DSL
* **Date redaction by default** — `Date` instances are replaced with `[Date_1]`, `[Date_2]`, … out of the box
* **Undefined filtered by default** — `undefined` props are removed from objects to unclutter test snahpsots
* **Rich selector syntax** — target nested paths, array indices, slices, wildcards, and deep matches; with full TypeScript support
* **Zero config** — works with your existing Vitest setup

Installation [#installation]

<CodeBlockTabs defaultValue="npm">
  <CodeBlockTabsList>
    <CodeBlockTabsTrigger value="npm">
      npm
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="pnpm">
      pnpm
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="yarn">
      yarn
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="bun">
      bun
    </CodeBlockTabsTrigger>
  </CodeBlockTabsList>

  <CodeBlockTab value="npm">
    ```bash
    npm i vitest-snap -D
    ```
  </CodeBlockTab>

  <CodeBlockTab value="pnpm">
    ```bash
    pnpm add vitest-snap -D
    ```
  </CodeBlockTab>

  <CodeBlockTab value="yarn">
    ```bash
    yarn add vitest-snap --dev
    ```
  </CodeBlockTab>

  <CodeBlockTab value="bun">
    ```bash
    bun add vitest-snap --dev
    ```
  </CodeBlockTab>
</CodeBlockTabs>

Then register the matchers in your Vitest setup file:

```ts title="vitest.setup.ts"
import "vitest-snap";
```

```ts title="vitest.config.ts"
import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    setupFiles: ["./vitest.setup.ts"],
  },
});
```

Agent Skills [#agent-skills]

AI coding agents (Claude Code, Cursor, Copilot, etc.) can install vitest-snap skills to get
accurate, pattern-aware guidance for this library:

```sh
npx @tanstack/intent@latest install vitest-snap
```
