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 · Config reference · all subjects

config/deps

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.

deps.optimizer type and purpose

The deps.optimizer config option has type { ssr?, client? } and is used to enable dependency optimization. When enabled, external libraries listed in include will be bundled into a single file using esbuild and imported as a whole module. This improves performance for tests with many dependencies by reducing import costs, especially for UI libraries not designed to run in Node.js, and ensures alias configuration is respected inside bundled packages.

deps.optimizer.enabled type and default

deps.optimizer.{mode}.enabled has type boolean and a default value of false. It controls whether dependency optimization is enabled for the specified mode (ssr or client).

deps.client type and purpose

deps.client has type { transformAssets?, ... } and provides options applied to external files when the environment is set to client. By default, jsdom and happy-dom use client environment, while node and edge use ssr. These options also affect files in server.deps.external.

deps.client.transformAssets type and default

deps.client.transformAssets has type boolean and a default value of true. When enabled, Vitest processes assets (.png, .svg, .jpg, etc) files and resolves them like Vite does in the browser, providing a default export equal to the path to the asset if no query is specified. This option currently only works with vmThreads and vmForks pools.

deps.client.transformCss type and default

deps.client.transformCss has type boolean and a default value of true. When enabled, Vitest processes CSS (.css, .scss, .sass, etc) files and resolves them like Vite does in the browser. If CSS files are disabled with css options, this option silences ERR_UNKNOWN_FILE_EXTENSION errors. This option currently only works with vmThreads and vmForks pools.

deps.client.transformGlobPattern type and default

deps.client.transformGlobPattern has type RegExp | RegExp[] and a default value of []. It specifies a regexp pattern to match external files that should be transformed. By default, files inside node_modules are externalized and not transformed, unless they are CSS or assets with corresponding options not disabled. This option currently only works with vmThreads and vmForks pools.

deps.interopDefault type and default

deps.interopDefault has type boolean and a default value of true. When enabled, it interprets CommonJS module's default export as named exports. This prevents errors when importing CJS-only dependencies using named export syntax in Node environment. By default, Vitest assumes a bundler is used to bypass this issue and will not fail.

deps.moduleDirectories type and default

deps.moduleDirectories has type string[] and a default value of ['node_modules']. It specifies a list of directories treated as module directories. This affects vi.mock behavior: when no factory is provided and the path being mocked matches one of these values, Vitest tries to resolve the mock by looking for a __mocks__ folder in the project root. It also affects whether files are treated as modules when externalizing dependencies. Setting this option overrides the default, so include 'node_modules' if you wish to keep it.

deps.moduleDirectories example configuration

Example showing how to configure deps.moduleDirectories to include both node_modules and a custom packages directory: ```ts import { defineConfig } from 'vitest/config' export default defineConfig({ test: { deps: { moduleDirectories: ['node_modules', path.resolve('../../packages')], } }, }) ```

Give your agent this brain