Skip to content

Instantly share code, notes, and snippets.

@CarmeloRicarte
Last active November 28, 2022 15:41
Show Gist options
  • Save CarmeloRicarte/bc810a623ae28275d858c73ac153a763 to your computer and use it in GitHub Desktop.
Save CarmeloRicarte/bc810a623ae28275d858c73ac153a763 to your computer and use it in GitHub Desktop.
Vitest - Testing Library - React config for Javascript
  1. Instalaciones
    yarn add -D vitest jsdom @vitest/ui @testing-library/react @vitest/coverage-c8
  2. Configuraciones
    2.1 En vite.config.js, añadir lo siguiente al defineConfig:
    test: { environment: 'jsdom', globals: true }
    2.2 En package.json, añadir lo siguiente dentro de scripts:
    "test": "vitest",
    "test:ui": "vitest --ui",
    "coverage": "vitest run --coverage"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment