vitest-dev / vitest-dev/vitest

Make `.vitest` artifact directory configurable

Open
#11,269 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement: pending triage p2-to-be-discussed
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.