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

test configuration & environments

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

environment flag specifies runner environment

The `--environment <name>` CLI flag specifies the runner environment when not running in browser. Default is `node`.

Vitest 5.0 requires Vite >= 6.4.0 and Node.js >= 22.12.0

Vitest 5.0 has minimum version requirements: Vite must be version 6.4.0 or higher, and Node.js must be version 22.12.0 or higher. Running Vitest 5.0 on older versions is not supported and may result in unexpected errors.

DOM environment global assignments update underlying Window

In Vitest 5.0, assignments to properties on globalThis or window in jsdom and happy-dom environments are propagated to the underlying DOM implementation. Mutable properties like innerWidth can now affect DOM APIs like matchMedia.

populateGlobal returns descriptors instead of plain values

In Vitest 5.0, the originals map returned by populateGlobal now holds property descriptors instead of plain values. This avoids invoking native lazy getters and restores them faithfully on teardown. Custom environments should use Object.defineProperty instead of assignment: originals.forEach((descriptor, key) => Object.defineProperty(global, key, descriptor)).

Deprecated packages in Vitest 5.0

As of Vitest 5.0, @vitest/runner and @vitest/ws-client are deprecated and no longer receive feature updates but will receive security fixes. The @vitest/browser-webdriverio provider has been moved to vitest-community organization and is now community-maintained.

Removed deprecated entry points in Vitest 5.0

Vitest 5.0 removes these deprecated entry points: vitest/coverage (use vitest/node), vitest/reporters (use vitest/node), vitest/environments (use vitest/runtime), vitest/snapshot (use vitest/runtime), vitest/runners (use TestRunner from vitest), vitest/suite (use TestRunner static methods), vitest/mocker (use @vitest/mocker directly), vitest/internal/module-runner.

Vitest globals option

Jest enables globals by default but Vitest does not. To enable globals in Vitest, set globals: true in test configuration or import from vitest module instead.

Vitest environment variables

Vitest sets NODE_ENV to 'test' by default. It provides VITEST_POOL_ID (1-based, less than or equal to maxWorkers) replacing Jest's JEST_WORKER_ID, and VITEST_WORKER_ID (unique per worker, not affected by maxWorkers).

Type imports from Vitest instead of jest namespace

Vitest doesn't have a jest namespace. Import types directly from vitest: import type { Mock } from 'vitest' and use Mock<(name: string) => number> instead of jest.Mock<(name: string) => number>.

Give your agent this brain