[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
vitest docs config testnamepattern.md
573 B · 26 lines
Markdown
at v4


title: testNamePattern | Config outline: deep #

testNamePattern {#testnamepattern} #

  • Type: string | RegExp
  • CLI: -t <pattern>, --testNamePattern=<pattern>, --test-name-pattern=<pattern>

Run tests with full names matching the pattern. If you add OnlyRunThis to this property, tests not containing the word OnlyRunThis in the test name will be skipped.

import { expect, test } from 'vitest'

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

// skipped
test('doNotRun', () => {
  expect(true).toBe(true)
})