blob: 46df217ce0994e00674ed69ebe77419076258bbf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
Snapshot tests are written using the `.toMatchSnapshot()` matcher:
```ts
import { test, expect } from "bun:test";
test("snap", () => {
expect("foo").toMatchSnapshot();
});
```
The first time this test is run, the argument to `expect` will be serialized and written to a special snapshot file in a `__snapshots__` directory alongside the test file. On future runs, the argument is compared against the snapshot on disk. Snapshots can be re-generated with the following command:
```bash
$ bun test --update-snapshots
```
|