vitest

Installation
SKILL.md

For E2E tests: Use prowler-test-ui skill (Playwright). This skill covers unit/integration tests with Vitest + React Testing Library.

Prowler UI Test Projects (ui/vitest.config.ts)

Project Files Environment Setup
unit **/*.test.{ts,tsx} (excludes tests/**, *.integration.test.*) jsdom, no React Compiler vitest.setup.ts (jest-dom matchers, storage mock)
integration **/*.integration.test.{ts,tsx} Vitest browser mode, Playwright Chromium, React Compiler vitest.integration.setup.ts (MSW worker, globals.css, mocks for @/auth.config, next/cache, server-only)
  • Tests are co-located next to the code (foo.ts -> foo.test.ts); shared fixtures live in ui/__tests__/.
  • Config sets globals, restoreMocks, mockReset, unstubEnvs, unstubGlobals: do not add afterEach(vi.restoreAllMocks) boilerplate.
  • Integration tests import page/userEvent from vitest/browser, render with @/__tests__/render-browser, and mock HTTP with MSW (ui/__tests__/msw/), not vi.mock of fetch.

Test Structure (REQUIRED)

Use Given/When/Then (AAA) pattern with comments:

Installs
68
GitHub Stars
15.2K
First Seen
Feb 18, 2026