@@ -2284,22 +2284,32 @@ export default defineConfig({
2284
2284
### diff
2285
2285
2286
2286
- ** Type:** ` string `
2287
- - ** CLI:** ` --diff=<value > `
2287
+ - ** CLI:** ` --diff=<path > `
2288
2288
2289
- Path to a diff config that will be used to generate diff interface. Useful if you want to customize diff display.
2289
+ ` DiffOptions ` object or a path to a module which exports ` DiffOptions ` . Useful if you want to customize diff display.
2290
+
2291
+ For example, as a config object:
2290
2292
2291
2293
::: code-group
2292
- ``` ts [vitest.diff.ts ]
2293
- import type { DiffOptions } from ' vitest'
2294
- import c from ' tinyrainbow '
2294
+ ``` ts [vitest.config.js ]
2295
+ import { defineConfig } from ' vitest/config '
2296
+ import c from ' picocolors '
2295
2297
2296
- export default {
2297
- aIndicator: c .bold (' --' ),
2298
- bIndicator: c .bold (' ++' ),
2299
- omitAnnotationLines: true ,
2300
- } satisfies DiffOptions
2298
+ export default defineConfig ({
2299
+ test: {
2300
+ diff: {
2301
+ aIndicator: c .bold (' --' ),
2302
+ bIndicator: c .bold (' ++' ),
2303
+ omitAnnotationLines: true ,
2304
+ }
2305
+ }
2306
+ })
2301
2307
```
2308
+ :::
2302
2309
2310
+ Or as a module:
2311
+
2312
+ ::: code-group
2303
2313
``` ts [vitest.config.js]
2304
2314
import { defineConfig } from ' vitest/config'
2305
2315
@@ -2309,12 +2319,32 @@ export default defineConfig({
2309
2319
}
2310
2320
})
2311
2321
```
2322
+
2323
+ ``` ts [vitest.diff.ts]
2324
+ import type { DiffOptions } from ' vitest'
2325
+ import c from ' picocolors'
2326
+
2327
+ export default {
2328
+ aIndicator: c .bold (' --' ),
2329
+ bIndicator: c .bold (' ++' ),
2330
+ omitAnnotationLines: true ,
2331
+ } satisfies DiffOptions
2332
+ ```
2312
2333
:::
2313
2334
2335
+ #### diff.expand
2336
+
2337
+ - ** Type** : ` boolean `
2338
+ - ** Default** : ` true `
2339
+ - ** CLI:** ` --diff.expand=false `
2340
+
2341
+ Expand all common lines.
2342
+
2314
2343
#### diff.truncateThreshold
2315
2344
2316
2345
- ** Type** : ` number `
2317
2346
- ** Default** : ` 0 `
2347
+ - ** CLI:** ` --diff.truncateThreshold=<path> `
2318
2348
2319
2349
The maximum length of diff result to be displayed. Diffs above this threshold will be truncated.
2320
2350
Truncation won't take effect with default value 0.
@@ -2323,6 +2353,7 @@ Truncation won't take effect with default value 0.
2323
2353
2324
2354
- ** Type** : ` string `
2325
2355
- ** Default** : ` '... Diff result is truncated' `
2356
+ - ** CLI:** ` --diff.truncateAnnotation=<annotation> `
2326
2357
2327
2358
Annotation that is output at the end of diff result if it's truncated.
2328
2359
@@ -2333,6 +2364,13 @@ Annotation that is output at the end of diff result if it's truncated.
2333
2364
2334
2365
Color of truncate annotation, default is output with no color.
2335
2366
2367
+ #### diff.printBasicPrototype
2368
+
2369
+ - ** Type** : ` boolean `
2370
+ - ** Default** : ` true `
2371
+
2372
+ Print basic prototype ` Object ` and ` Array ` in diff output
2373
+
2336
2374
### fakeTimers
2337
2375
2338
2376
- ** Type:** ` FakeTimerInstallOpts `
0 commit comments