---
name: mcp-vitest-ui-tester
description: >
  Configure, write, debug, and review Vitest unit, component, type, snapshot, benchmark, and coverage tests for frontend and shared JavaScript/TypeScript code. Use when a project uses Vitest or the user explicitly requests it, including mocks, environments, projects, reporters, filtering, concurrency, fixtures, and CI coverage. Preserve the existing Vite/Vitest version and environment contract. Use mcp-browser-automation for end-to-end browser flows and do not convert E2E behavior into fragile unit mocks.
---

# MCP Vitest UI Tester

Scrivere test che descrivono comportamento e contratti, mantenendo isolamento e compatibilita con configurazione, ambiente e versioni del progetto.

## Workflow

1. Rilevare Vitest/Vite version, config, environment, setup files, projects e package manager.
2. Definire il livello corretto: unit, component, integration, type, snapshot o benchmark.
3. Riutilizzare helper e fixture esistenti prima di crearne di nuovi.
4. Mockare soltanto i boundary esterni, ripristinando timer, moduli e globali.
5. Testare stati, errori, asincronia, cleanup e regressione osservata.
6. Eseguire il filtro piu stretto durante sviluppo e la suite pertinente prima della chiusura.
7. Valutare coverage per rischio, non come percentuale fine a se stessa.
8. Spostare flow browser reali a `mcp-browser-automation`.

## Regole permanenti

- Non usare snapshot grandi come sostituto di assertion significative.
- Non dipendere dall ordine dei test o da stato globale non ripristinato.
- Non mockare il codice oggetto del test.
- Non abilitare concorrenza su test che condividono risorse mutabili.
- Non cambiare ambiente jsdom/happy-dom/node senza motivazione e verifica.

## Output

1. detected test contract
2. test strategy and files
3. mocks/fixtures/environment decisions
4. commands and filters
5. coverage and regression result

## References

- [generation-notes](references/generation-notes.md)
- [advanced-environments](references/advanced-environments.md)
- [advanced-projects](references/advanced-projects.md)
- [advanced-type-testing](references/advanced-type-testing.md)
- [advanced-vi](references/advanced-vi.md)
- [core-cli](references/core-cli.md)
- [core-config](references/core-config.md)
- [core-describe](references/core-describe.md)
- [core-expect](references/core-expect.md)
- [core-hooks](references/core-hooks.md)
- [core-test-api](references/core-test-api.md)
- [features-benchmarking](references/features-benchmarking.md)
- [features-concurrency](references/features-concurrency.md)
- [features-context](references/features-context.md)
- [features-coverage](references/features-coverage.md)
- [features-filtering](references/features-filtering.md)
- [features-mocking](references/features-mocking.md)
- [features-reporters](references/features-reporters.md)
- [features-snapshots](references/features-snapshots.md)
- [features-test-tags](references/features-test-tags.md)
