-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Labels
p2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)pr welcome
Description
Clear and concise description of the problem
Right now it's quite cumbersome to filter out tests when using a Vitest CLI. You need to know the name and the file:
vitest test/basic.test.ts -t "some-name"
It fails if there are multiple tests that have the same pattern, so you are forced to use the full name manually:
vitest test/basic.test.ts -t "test full some-name"
Suggested solution
Vitest 1.4.0 introduced includeTaskLocation option that adds a location property to every test. With this information, we can filter tests by the line number:
vitest test/basic.test.ts:20
Alternative
No response
Additional context
I am not sure what should happen when the line doesn't exist or there is no test at that line. Currently, we only know the location of a test, and we don't know when the body of a test ends, so it's tricky to implement a range support.
I think we should:
- Only run a test if the line is exactly equal to a location line
- If there is no test at that location, throw an error
- If range is used, throw an error (
test/basic.test.ts:20-30)
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.
yesmeck, fenghan34 and mzhubail
Metadata
Metadata
Assignees
Labels
p2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)pr welcome
Type
Projects
Status
Approved