-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Clear and concise description of the problem
I usually organize my tests per domain. Often, one domain can be tested in one file, so it can be picked using the CLI.
When a domain is too big so we try to split it into sub-domains, each being tested within a file.
And sometimes, those sub-domains cannot be tested concurrently, because they would conflict during integration tests with the database for example.
Suggested solution
Be able to add tags to tasks using object syntax :
test('should filter the data correctly', { tags: ['domain1'] }, async () => { /* ... */});Then using the CLI, I can pick or exclude tasks :
# 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 databaseI realize that because there is an option -t / --testNamePattern, the name tag can cause some confusion and maybe there is a better name to be given to this tag system.
Alternative
Lock mechanism with the database. But vitest could schedule the tasks so they are less likely to block each others.
Additional context
No response
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.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status