Skip to content

Commit d670f40

Browse files
Add filenames to code snippets under Setup docs page (#540)
1 parent 30a420e commit d670f40

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

website/docs/getting-started/setup.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ sidebar_position: 2
1010

1111
Create a setup script with the following:
1212

13-
```javascript
14-
// ./testSetup.js
13+
```javascript title="testSetup.js"
1514

1615
// add all jest-extended matchers
1716
import * as matchers from 'jest-extended';
@@ -24,15 +23,15 @@ expect.extend({ toBeArray, toBeSealed });
2423

2524
Add your setup script to your Jest `setupFilesAfterEnv` configuration. [See for help](https://jestjs.io/docs/en/configuration.html#setupfilesafterenv-array)
2625

27-
```json
26+
```json title="package.json"
2827
"jest": {
2928
"setupFilesAfterEnv": ["./testSetup.js"]
3029
}
3130
```
3231

3332
To automatically extend `expect` with all matchers, you can use
3433

35-
```json
34+
```json title="package.json"
3635
"jest": {
3736
"setupFilesAfterEnv": ["jest-extended/all"]
3837
}
@@ -42,15 +41,15 @@ To automatically extend `expect` with all matchers, you can use
4241

4342
`jest-extended` works with `vitest` because their `expect.extend` API is compatible. In your setup script:
4443

45-
```javascript
44+
```javascript title="testSetup.js"
4645
import {expect} from "vitest";
4746
import * as matchers from "jest-extended";
4847
expect.extend(matchers);
4948
```
5049

5150
Add this setup script to your `vitest.config.js`:
5251

53-
```javascript
52+
```javascript title="vitest.config.js"
5453
export default defineConfig({
5554
test: {
5655
setupFiles: ["./testSetup.js"],

0 commit comments

Comments
 (0)