vitest-dev / vitest-dev/vitest
Watch mode test target tracking for file path+line input
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Clear and concise description of the problem
I am using Zed tasks (but could be VSCode etc.) and have this config:
{
"label": "vitest line (watch)",
"command": "npx vitest",
"args": ["$ZED_FILE:$ZED_ROW"],
}
This works initially. However if the test file is changed such that the test no longer begins on line $ZED_ROW then Vitest will say that no test is found in the given file. Is there a strong reason for this behaviour being desirable and reasonable?
Suggested solution
In watch mode if Vitest receives a <file path>:line input, then it should cache what fully qualified test this evaluates to (describe > describe > ... > it etc.) and from then on be running based on:
- Full test file path
- Full test name
I would accept that Vitest watch fails to track the following:
- I change the test file path
- I change the test path (its name, or ancestor describe names)
Alternative
No response
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or test is named. Start by reproducing the issue with npx vitest : in watch mode, then trace how file-and-line inputs are resolved and retained between runs. Done means watch mode follows the originally resolved full test path and name after line changes, while documented path or test-name changes may stop tracking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100