Skip to content

presets/auto

vitest-plugin-vis/presets/auto is a setup file. It has no named export. You import it for its effect.

Its whole content is:

import { vis } from '../setup.ts'
vis.setup({ auto: true })

The effect is that every test that renders content gets an automatic snapshot, as vis.setup({ auto: true }) does.

You rarely add it yourself. vis() adds it to test.setupFiles when preset is 'auto', and 'auto' is the preset of vis() with no options.

vitest.config.ts
import { vis } from 'vitest-plugin-vis/config'
export default defineConfig({
plugins: [vis()], // same as vis({ preset: 'auto' })
})

To list it yourself, set preset: 'custom' and put the file in test.setupFiles:

export default defineConfig({
plugins: [vis({ preset: 'custom' })],
test: {
setupFiles: ['vitest-plugin-vis/presets/auto'],
},
})

To decide per test, themes or conditions, call vis.setup() in your own setup file instead. See Automatic snapshots and Themes.

The sibling preset is presets/manual.