vitest-dev / vitest-dev/vitest
Make `.vitest` artifact directory configurable
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
Vitest 5 moved its shared artifacts to .vitest/, but the directory is currently hard-coded in createReport() as resolve(config.root, '.vitest'). Individual outputs can still be configured with attachmentsDir, outputFile, outputDir, etc., but there is no way to change the root for artifacts created through createReport(). This also affects third-party reporters using the new API.
Suggested solution
Add an artifactsDir option with .vitest as the default.
createReport() and the default paths for attachmentsDir, mergeReports, and the blob/json/junit/html outputs should derive from it. Explicit paths should continue to take precedence.
Also add a matching --artifactsDir CLI option for CI.
Alternative
Configure each output separately. This doesn't cover createReport() artifacts and means maintaining a bunch of unrelated path settings.
Additional context
We keep tool caches and artifacts under one git-ignored directory. Vitest coverage already supports this via coverage.reportsDirectory.
Having a configurable artifact root would let .vitest follow the same convention instead of requiring another ignore entry per project.
AI assistance (Claude) was used to help draft this issue; the issue and proposed feature are from me.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that requests 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
Start by tracing createReport() and the current .vitest default paths for attachmentsDir, mergeReports, and the blob, JSON, JUnit, and HTML outputs. Then inspect the CLI option handling for the matching --artifactsDir option. Done means an artifactsDir default of .vitest is configurable, explicit output paths still take precedence, and CI can set it through the CLI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100