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 上编辑此页
上一页includeSource
下一页env

#testNamePattern

  • 类型: string | RegExp
  • 默认值: undefined
  • CLI: -t=<value>, --testNamePattern=<value>

仅运行测试名称中匹配正则表达式或字符串的测试。

如果将 testNamePattern 设置为 bar,则测试名称中不包含 bar 的测试将被跳过。

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

export default defineConfig({
  testNamePattern: 'bar',
});
// skipped
test('test foo', () => {
  expect(true).toBe(true);
});

// run
test('test bar', () => {
  expect(true).toBe(true);
});