🍃 Leaf

Vitest

Installation

npm i -D vitest

More at Adding Vitest to your Project (vitest.dev).

Usage

vitest <command> [options]
# Use with npx
npx vitest [option]
# Use with npm scripts
npm run test
npm run coverage
// package.json e.g.:
{
  "scripts": {
    "test": "vitest",
    "coverage": "vitest run --coverage"
  }
}

Commands:

Options :

More at Command Line Interface.

Configuration

// vite.config.json e.g.:
import { defineConfig } from 'vitest/config';

export  default defineConfig({
  test: {
    // ...
  }
});

More at Configuring Vitest.