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 PageincludeSource
Next Pageenv

#testNamePattern

  • Type: string | RegExp
  • Default: undefined
  • CLI: -t=<value>, --testNamePattern=<value>

Run only tests with a name that matches the regex / string.

If you set testNamePattern to bar, tests not containing the word bar in the test name will be skipped.

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);
});