···300300# Run tests that match (unit OR e2e) AND are NOT slow
301301vitest --tags-filter="unit || e2e" --tags-filter="!slow"
302302```
303303+304304+### Checking Tags Filter at Runtime
305305+306306+You can use `TestRunner.matchesTagsFilter` (since Vitest 4.1.1) to check whether the current tags filter matches a set of tags. This is useful for conditionally running expensive setup logic only when relevant tests are included:
307307+308308+```ts
309309+import { beforeAll, TestRunner } from 'vitest'
310310+311311+beforeAll(async () => {
312312+ // Seed database when "vitest --tags-filter db" is used
313313+ if (TestRunner.matchesTagsFilter(['db'])) {
314314+ await seedDatabase()
315315+ }
316316+})
317317+```
318318+319319+The method accepts an array of tags and returns `true` if the current `--tags-filter` would include a test with those tags. If no tags filter is active, it always returns `true`.