Test Tags in Vitest
From the Vitest cheat sheet ยท Filtering & Tags ยท verified Nov 2026
Test Tags
Label tests with shared options and filter runs with tag expressions (4.1+)
typescript
// vitest.config.ts
test: {
tags: [
{ name: 'db', timeout: 60_000 },
{ name: 'flaky', retry: process.env.CI ? 2 : 0 },
],
}
// user.test.ts
test('saves a user', { tags: ['db'] }, async () => { /* ... */ })
// vitest run --tags-filter=db๐ Tags arrived in 4.1; undeclared tags fail unless strictTags is off
๐ก Put timeout and retry on a tag instead of repeating them per test
โก --tags-filter accepts !, && (and) and || (or) expressions
๐ Use tags for categories, projects for different runtime settings
tagsfilter
Continue with Vitest
Save the full cheat sheet or work through every related task.