close
logo
Rstest
指南
配置
API
English
简体中文
指南
配置
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
📝 在 GitHub 上编辑此页
上一页snapshotFormat
下一页printConsoleTrace

#resolveSnapshotPath

  • 类型: (testPath: string, snapExtension: string) => string
  • 默认值: undefined

自定义快照路径。

默认情况下,Rstest 会将快照文件保存在与测试文件相同的目录下的 __snapshots__ 文件夹中。 你可以使用 resolveSnapshotPath 来自定义快照文件的存放位置。

例如,将快照存储在测试文件同级:

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

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