@@ -2284,22 +2284,32 @@ export default defineConfig({
22842284### diff
22852285
22862286- ** Type:** ` string `
2287- - ** CLI:** ` --diff=<value > `
2287+ - ** CLI:** ` --diff=<path > `
22882288
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:
22902292
22912293::: 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 '
22952297
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+ })
23012307```
2308+ :::
23022309
2310+ Or as a module:
2311+
2312+ ::: code-group
23032313``` ts [vitest.config.js]
23042314import { defineConfig } from ' vitest/config'
23052315
@@ -2309,12 +2319,32 @@ export default defineConfig({
23092319 }
23102320})
23112321```
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+ ```
23122333:::
23132334
2335+ #### diff.expand
2336+
2337+ - ** Type** : ` boolean `
2338+ - ** Default** : ` true `
2339+ - ** CLI:** ` --diff.expand=false `
2340+
2341+ Expand all common lines.
2342+
23142343#### diff.truncateThreshold
23152344
23162345- ** Type** : ` number `
23172346- ** Default** : ` 0 `
2347+ - ** CLI:** ` --diff.truncateThreshold=<path> `
23182348
23192349The maximum length of diff result to be displayed. Diffs above this threshold will be truncated.
23202350Truncation won't take effect with default value 0.
@@ -2323,6 +2353,7 @@ Truncation won't take effect with default value 0.
23232353
23242354- ** Type** : ` string `
23252355- ** Default** : ` '... Diff result is truncated' `
2356+ - ** CLI:** ` --diff.truncateAnnotation=<annotation> `
23262357
23272358Annotation that is output at the end of diff result if it's truncated.
23282359
@@ -2333,6 +2364,13 @@ Annotation that is output at the end of diff result if it's truncated.
23332364
23342365Color of truncate annotation, default is output with no color.
23352366
2367+ #### diff.printBasicPrototype
2368+
2369+ - ** Type** : ` boolean `
2370+ - ** Default** : ` true `
2371+
2372+ Print basic prototype ` Object ` and ` Array ` in diff output
2373+
23362374### fakeTimers
23372375
23382376- ** Type:** ` FakeTimerInstallOpts `
0 commit comments