-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
enhancement: pending triagep2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)
Description
Clear and concise description of the problem
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 functionality
it.only('test', () => {})
test.skipIf(isDev)('prod only test', () => {})
// A
test.tags('domain1').it('should filter the data correctly', async () => { /* ... */});
// B
test.tags('domain1')('should filter the data correctly', async () => { /* ... */});
// extended A
test.tags('domain1').skipIf(isDev).it('should filter the data correctly', async () => { /* ... */});
// extended B
test.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 databaseAdditional context
- https://docs.pytest.org/en/stable/example/markers.html
- https://vitest.dev/guide/filtering.html#selecting-suites-and-tests-to-run
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Bonjour123
Metadata
Metadata
Assignees
Labels
enhancement: pending triagep2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)
Type
Projects
Status
P2 - 5