Skip to content

Configuration ​

Configuration options can be passed when registering the file matchers in the setup file:

vitest-setup.ts
ts
registerFileSnapshotMatchers({
  testDir: "src",
});

Available Options ​

OptionDefault ValueDescription
testDir.Base directory for tests. The paths of snapshot files will be relative to this directory.
validationDirdata/test/validationDirectory in which golden masters are stored.
outputDirdata/test/outputDirectory in which file snapshots from test runs are stored.
indentSize2Indentation size in spaces used for serializing snapshots.
resolveFilePathresolveNameAsFileCustom resolver for the file path used to store snapshots. See File Path Resolvers.