You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Reconsider] Run behaviour for suites and tests using tags / marks #8672
I come from Pytest, and simply marking tests is a feature I greatly miss in most test frameworks.
There is one rejected proposal #5346; however, with v4 being around the corner, it would be great to reconsider.
The similar functionality for selecting tests is almost already there with only()
Suggested solution
// existing functionalityit.only('test',()=>{})test.skipIf(isDev)('prod only test',()=>{})// Atest.tags('domain1').it('should filter the data correctly',async()=>{/* ... */});// Btest.tags('domain1')('should filter the data correctly',async()=>{/* ... */});// extended Atest.tags('domain1').skipIf(isDev).it('should filter the data correctly',async()=>{/* ... */});// extended Btest.tags('domain1').skipIf(isDev)('should filter the data correctly',async()=>{/* ... */});
Original proposal
test('should filter the data correctly',{tags: ['domain1']},async()=>{/* ... */});
# Run tests for tasks having the tag "api" or "auth"
vitest --run --tag api --tag auth
# Run tests for tasks having the tag "api" and "auth"
vitest --run --tag api auth
# Pick test files that contain the word "user", exclude the tasks having the tag "api"
vitest user --run --no-tag api
# Prevent tasks with the tag "database" to be run in parallel
vitest --run --tag api --no-tag-parallelism database
The team decided to support tags, but we prefer the original proposal:
test('should filter the data correctly', { tags: ['domain1'] }, async () => { /* ... */});
vitest --tag api --tag auth
The tags should also be defined in the config file. Vitest will check that test tags are the same as the ones in the config file, and throw an error otherwise:
exportdefaultdefineConfig({test: {tags: [{name: 'api',description: 'API tests'},// maybe support TestOptions like "concurrent", "timeout", etc too{name: 'auth'},],},})
Tags should also be supported by project.createSpecification
Activity
sheremet-va commentedon Jan 13, 2026
The team decided to support
tags, but we prefer the original proposal:The tags should also be defined in the config file. Vitest will check that test tags are the same as the ones in the config file, and throw an error otherwise:
Tags should also be supported by
project.createSpecification