new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

Vitest · Config reference · all subjects

config/test

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

testNamePattern option type and CLI flags

The testNamePattern option has type string | RegExp. CLI flags: -t <pattern>, --testNamePattern=<pattern>, --test-name-pattern=<pattern>.

testNamePattern matching behavior

testNamePattern runs tests with full names matching the pattern. If the pattern is set, tests not containing the pattern text in their full test name will be skipped.

testNamePattern full name matching with nested suites

The pattern is matched against the test's full name, which is the enclosing suite names and the test name joined with ' > '. For example, a test within describe('math') with name 'adds' has full name 'math > adds' and matches patterns like -t 'math > adds' or -t adds.

testNamePattern separator change in Vitest 5

Before Vitest 5, the segments in the full test name were joined with a single space (e.g., 'math adds') to mirror Jest. Starting with Vitest 5, they are joined with ' > '.

testNamePattern example

Example showing testNamePattern usage: import { describe, expect, test } from 'vitest' describe('math', () => { test('adds', () => { expect(1 + 1).toBe(2) }) })

Give your agent this brain