close
logo
Rstest
Guide
Config
API
English
简体中文
Guide
Config
API
English
简体中文
logo
Rstest
Overview

Test Configurations

root
name
include
exclude
setupFiles
projects
update
globals
passWithNoTests
includeSource
testNamePattern
env
retry
testTimeout
hookTimeout
maxConcurrency
pool
isolate
testEnvironment
clearMocks
resetMocks
restoreMocks
unstubEnvs
unstubGlobals
coverage
reporters
hideSkippedTests
slowTestThreshold
snapshotFormat
resolveSnapshotPath
printConsoleTrace
onConsoleLog
disableConsoleIntercept

Build Configurations

plugins
source
output
resolve
tools
dev
performance
📝 Edit this page on GitHub
Previous PagesnapshotFormat
Next PageprintConsoleTrace

#resolveSnapshotPath

  • Type: (testPath: string, snapExtension: string) => string
  • Default: undefined

Custom handler for resolving snapshot paths in tests.

By default, Rstest saves snapshot files in the same directory as the test files, under a __snapshots__ folder.

You can use resolveSnapshotPath to customize this behavior and specify a different location for your snapshot files.

For example, store snapshots next to test files:

rstest.config.ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  resolveSnapshotPath: (testPath, snapshotExtension) =>
    testPath + snapshotExtension,
});