new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Vitest · Guide · all subjects

cli

8 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Watch mode behavior by default

Vitest starts in watch mode by default in development environment and run mode in CI environment when process.env.CI is present. You can explicitly specify the desired mode with vitest watch or vitest run commands.

Shared config between test, dev and build

Vitest uses Vite's config, transformers, resolvers, and plugins. The same setup from your app is used to run tests, enabling consistent configuration across development, testing, and production builds.

View all CLI options with npx vitest --help

To see a full list of CLI options, run npx vitest --help or see the CLI guide.

Duration phases mapping to configuration

The Duration phases map to configuration options: environment (creating test environment like jsdom or happy-dom for test files), transform (waiting for Vite to resolve and transform imported modules), import (evaluating test files and their modules, excluding transform wait), setup (running setupFiles), worker (preparing test runner in each worker), tests (running the tests themselves).

Duration summary breakdown phases

The Duration line of the summary breaks down the test run into phases as percentages of all tracked time. Example: 'Duration 3.76s (environment 79%, import 13%, transform 6%, tests 1%, setup 1%)'. The percentages are relative to the sum of all tracked phases, not wall-clock time, since phases run in parallel workers and their sum is usually larger than the run itself.

Vitest test execution time metrics breakdown

Vitest reports five time metrics when running tests: Transform (time spent transforming files), Setup (time for setupFiles), Import (time to import test files and dependencies, including test collection but not dynamic imports), Tests (actual test execution time), and Environment (test environment setup like JSDOM).

Identify slow file transforms with barrel files

File Transform profiling helps identify unnecessary transforms caused by barrel files (index.ts files that re-export many other modules). If the transform logs show files that shouldn't be loaded for a test, barrel files may be importing unnecessarily. Import directly from specific modules instead of barrel file exports to reduce transform overhead by up to ~85%.

Optimize slow imports by using specific entry points

Many libraries ship multiple entry points. Instead of importing from the main entry point (often a barrel file), import directly from the specific module. For example, import date-fns functions from their individual files: import { format } from 'date-fns/format' instead of import { format } from 'date-fns'.

Give your agent this brain