Repository navigation
feat: add vitest doctor - #10710
feat: add vitest doctor#10710
vitest doctor#10710Conversation
| } | ||
|
|
||
| // provenance must be captured before the defaults are merged in | ||
| const providedOptions = captureProvidedOptions(viteConfigTest, options) |
There was a problem hiding this comment.
All the config shenanigans would look better after we merge the config refactor
4acf60a to
4caa27d
Compare
25bc8ae to
5ed9d9e
Compare
5ed9d9e to
12ca18c
Compare
✅ Deploy Preview for vitest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
9aed419 to
12ca18c
Compare
|
@hi-ogawa forgot to ask for review 😢 |
Technically, it should also remove the time it takes to load the module graph
Should also note that on CI this doesn't help. Plus it's not longer in experimental
We should manually update the config for every project (do we have APIs that could do that?), "all projects use jsdom" is pretty useless as one will probably use a combination of environments
We should always run all tests. isolation also affects browser mode, for example. |
vitest doctorvitest doctor
81d33e8 to
58ea253
Compare
5971d13 to
fd3342a
Compare
Measures how much faster the suite runs under alternative configurations by running it under each of them, and recommends the fastest with a ready-to-paste config snippet. Candidates run through a generated runner script so the happy-dom candidate can swap the environment of jsdom projects only; every measured run includes browser projects.
58ea253 to
54b77d0
Compare
offer each vm pool whenever the suite does not already run it - vmForks can beat vmThreads (per-process heap and GC)
Part 3 of 3 of the perf discoverability work. Stacked on #10821 (performance hints), which is stacked on #10820 (duration breakdown percentages) — only the last commits are new here.
vitest doctorturns the hints' estimate into a measurement: resolves the config, prunes candidates from it (threads,vmThreadsfor DOM suites,environment: 'happy-dom'for jsdom projects,isolate: false,threads + isolate: falseas the honest competitor for vm-pool configs, andfsModuleCache: truewhen the cache is off), runs the suite under each, and recommends with a ready-to-paste snippet:isolate: falseis validated with two shuffled-order runs (explicit distinct seeds, so a user-pinnedsequence.seedcan't silently produce the same order twice); a failing validation excludes the candidate and reports which tests depend on isolation.createVitest+ JSON overrides) instead of the CLI binary, so the baseline and every candidate pay the identical entry cost, and candidates can express what CLI flags cannot:environment: 'happy-dom'swaps the environment of jsdom projects only — other projects keep theirs (covered by a fixture whose node project fails if the swap leaks). Offered whenever any project runs jsdom and the package actually resolves — checked withimport.meta.resolvefrom the vitest package, which is exactly how the environment imports it. A recommendation comes with a "happy-dom implements the DOM differently" caveat.fsModuleCache: truegets one untimed priming run before its measured reps (candidates supportprimeRuns), so the reported number is what repeated runs pay with a populated cache — consistent with the warm steady state everything else is measured in.isolate: falseaffects browser mode too, and a recommendation is only honest when measured on the run the user actually pays for. Candidates that cannot affect browser projects (pool,environment, the fs cache) are still picked from the node-side projects only, and a browser-only workspace still gets theisolate: falsecandidate and themaxWorkersprobes. Candidates are killed after 4× the baseline duration; SIGINT/SIGTERM kills the active child.maxWorkersvalues on top of the winning configuration - every worker funnels transforms through the single main-thread Vite server, so past a certain count more workers are slower. Greedy descent from half the current count, keeping a step only when it's ≥5% faster:Docs:
vitest doctorincli.md, plus the doctor pointers inimproving-performance.mdandconfig/experimental.md.