vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26k stars 1.79k forks source link

Docs: Vitest docs are both incorrect and incomplete #8790

Open AndreaPontrandolfo opened 1 month ago

AndreaPontrandolfo commented 1 month ago

What is the improvement or update you wish to see?

Fix docs around vitest CLI and improve docs around caching and file storing.

Is there any context that might help us understand?

In the Turborepo x Vitest there are these commands:

{
  "scripts": {
    "test": "vitest",
    "test:watch": "vitest --watch"
  }
}

Which are wrong. vitest does watch the files, while vitest run run the tests and then stop (thus being suitable for CI). Reference.

Am i misunderstanding something?

Also, vitest has docs for caching and docs for storing output files and coverage files.

it would be nice if Turborepo mentioned and gave guidance about these docs, here.

Does the docs page already exist? Please link to it.

https://turbo.build/repo/docs/guides/tools/vitest

anthonyshew commented 1 month ago

We break these up into two different commands since a bare vitest command has different behavior in different environments, as you've noted. That means we need two separate turbo tasks, as noted on the documentation.

You're right that the vitest invocations could be updated for better clarity! We can also add a link to the storing of coverage files documentation, since that's a common ask.

Let's avoid linking to that caching doc, since it looks like that happens by default, and I don't want to confuse folks about Turborepo caching vs. Vitest caching. Power users can reach for Vitest's caching options if they need them.

I'm happy to review a PR for this, if you'd like to make one! If not, I can get it handled but not sure if it will be soon. Let me know. 👍