KC's Workspace
    Preparing search index...

    Construct a type with the properties of T except for those in type K.

    interface ResolvedConfig {
        alias: AliasOptions;
        allowOnly: boolean;
        api: ApiConfig & { token: string };
        attachmentsDir: string;
        bail?: number;
        base?: string;
        benchmark?: Required<
            Omit<BenchmarkUserOptions, "outputFile" | "compare" | "outputJson">,
        > & Pick<BenchmarkUserOptions, "outputFile" | "compare" | "outputJson">;
        browser: ResolvedBrowserOptions;
        cache: false | { dir: string };
        chaiConfig: ChaiConfig;
        changed: string | boolean;
        clearCache: boolean;
        clearMocks: boolean;
        clearScreen: boolean;
        cliExclude?: string[];
        color?: LabelColor;
        compare: string;
        config?: string;
        coverage: ResolvedCoverageOptions;
        css:
            | boolean
            | {
                exclude?: RegExp
                | RegExp[];
                include?: RegExp | RegExp[];
                modules?: { classNameStrategy?: CSSModuleScopeStrategy };
            };
        dangerouslyIgnoreUnhandledErrors: boolean;
        defines: Record<string, any>;
        deps: DepsOptions;
        diff?: string | SerializedDiffOptions;
        dir: string;
        disableConsoleIntercept: boolean;
        dom: boolean;
        dumpDir?: string;
        env: Partial<ProcessEnv>;
        environment: VitestEnvironment;
        environmentOptions: EnvironmentOptions;
        exclude: string[];
        execArgv: string[];
        expandSnapshotDiff: boolean;
        expect: {
            poll?: { interval?: number; timeout?: number };
            requireAssertions?: boolean;
        };
        experimental: {
            fsModuleCache?: boolean;
            fsModuleCachePath?: string;
            openTelemetry?: { enabled: boolean; sdkPath?: string };
            printImportBreakdown?: boolean;
        };
        fakeTimers: FakeTimerInstallOpts;
        filters?: string[];
        forceRerunTriggers: string[];
        globals: boolean;
        globalSetup: string
        | string[];
        hideSkippedTests: boolean;
        hookTimeout: number;
        include: string[];
        includeSource: string[];
        includeTaskLocation: boolean;
        inspect: string | boolean;
        inspectBrk: string | boolean;
        inspector: {
            enabled?: boolean;
            host?: string;
            port?: number;
            waitForDebugger?: boolean;
        };
        isolate: boolean;
        logHeapUsage: boolean;
        maxConcurrency: number;
        maxWorkers: number;
        mergeReports: string;
        mockReset: boolean;
        mode: VitestRunMode;
        name: string;
        onConsoleLog: (
            log: string,
            type: "stdout" | "stderr",
            entity: TestModule | TestCase | TestSuite | undefined,
        ) => boolean | void;
        onStackTrace: (error: TestError, frame: ParsedStack) => boolean | void;
        onUnhandledError: OnUnhandledErrorCallback;
        open: boolean;
        outputFile:
            | string
            | Partial<
                Record<
                    | "default"
                    | "blob"
                    | "verbose"
                    | "dot"
                    | "json"
                    | "tap"
                    | "tap-flat"
                    | "junit"
                    | "tree"
                    | "hanging-process"
                    | "github-actions",
                    string,
                >,
            > & Record<string, string>;
        outputJson: string;
        passWithNoTests: boolean;
        pool: Pool;
        poolRunner?: PoolRunnerInitializer;
        printConsoleTrace: boolean;
        project: string[];
        projects: TestProjectConfiguration[];
        provide: Partial<ProvidedContext>;
        related?: string[];
        reporters: (
            | Reporter
            | ["default", Partial<DefaultReporterOptions>]
            | ["blob", Partial<BlobOptions>]
            | ["verbose", Partial<DefaultReporterOptions>]
            | ["dot", Partial<BaseOptions>]
            | ["json", Partial<JsonOptions>]
            | ["tap", object]
            | ["tap-flat", object]
            | ["junit", Partial<JUnitOptions>]
            | ["tree", Partial<BaseOptions>]
            | ["hanging-process", object]
            | ["github-actions", Partial<GithubActionsReporterOptions>]
            | ["html", Partial<HTMLOptions>]
            | [string & {}, Record<string, unknown>]
        )[];
        restoreMocks: boolean;
        retry: number;
        root: string;
        runner?: string;
        sequence: {
            concurrent?: boolean;
            groupOrder: number;
            hooks: SequenceHooks;
            seed: number;
            sequencer: TestSequencerConstructor;
            setupFiles: SequenceSetupFiles;
            shuffle?: boolean;
        };
        server: {
            debug?: { dump?: string
            | true; load?: boolean };
            deps?: ServerDepsOptions;
        };
        setupFiles: string[];
        shard?: { count: number; index: number };
        silent: boolean | "passed-only";
        slowTestThreshold: number;
        snapshotEnvironment?: string;
        snapshotFormat: Omit<PrettyFormatOptions, "plugins" | "compareKeys"> & {
            compareKeys?: null;
        };
        snapshotOptions: SnapshotStateOptions;
        snapshotSerializers: string[];
        standalone: boolean;
        teardownTimeout: number;
        testNamePattern?: RegExp;
        testTimeout: number;
        typecheck: Omit<TypecheckConfig, "enabled"> & { enabled: boolean };
        ui: boolean;
        uiBase: string;
        unstubEnvs: boolean;
        unstubGlobals: boolean;
        update: boolean;
        vmMemoryLimit?: string | number;
        watch: boolean;
        watchTriggerPatterns: WatcherTriggerPattern[];
    }

    Hierarchy (View Summary)

    • Omit<
          Required<UserConfig>,

              | "project"
              | "config"
              | "filters"
              | "browser"
              | "coverage"
              | "testNamePattern"
              | "related"
              | "api"
              | "reporters"
              | "resolveSnapshotPath"
              | "benchmark"
              | "shard"
              | "cache"
              | "sequence"
              | "typecheck"
              | "runner"
              | "pool"
              | "cliExclude"
              | "diff"
              | "setupFiles"
              | "snapshotEnvironment"
              | "bail"
              | "name"
              | "vmMemoryLimit"
              | "fileParallelism",
      >
      • ResolvedConfig
    Index

    Properties

    Specifies an Object, or an Array of Object, which defines aliases used to replace values in import or require statements. Will be merged with the default aliases inside resolve.alias.

    allowOnly: boolean

    Allow tests and suites that are marked as only

    !process.env.CI
    
    api: ApiConfig & { token: string }
    attachmentsDir: string

    Directory path for storing attachments created by context.annotate

    '.vitest-attachments'
    
    bail?: number
    base?: string
    benchmark?: Required<
        Omit<BenchmarkUserOptions, "outputFile" | "compare" | "outputJson">,
    > & Pick<BenchmarkUserOptions, "outputFile" | "compare" | "outputJson">
    cache: false | { dir: string }

    Type Declaration

    • false
    • { dir: string }
      • dir: string
    chaiConfig: ChaiConfig

    Modify default Chai config. Vitest uses Chai for expect and assert matches. https://github.com/chaijs/chai/blob/4.x.x/lib/chai/config.js

    changed: string | boolean

    Runs tests that are affected by the changes in the repository, or between specified branch or commit hash Requires initialized git repository

    false
    
    clearCache: boolean

    Delete all Vitest caches, including experimental.fsModuleCache.

    clearMocks: boolean

    Will call .mockClear() on all spies before each test

    false
    
    clearScreen: boolean

    Override vite config's clearScreen from cli

    cliExclude?: string[]
    color?: LabelColor
    compare: string

    benchmark.compare option exposed at the top level for cli

    config?: string
    css:
        | boolean
        | {
            exclude?: RegExp
            | RegExp[];
            include?: RegExp | RegExp[];
            modules?: { classNameStrategy?: CSSModuleScopeStrategy };
        }

    Indicates if CSS files should be processed.

    When excluded, the CSS files will be replaced with empty strings to bypass the subsequent processing.

    { include: [], modules: { classNameStrategy: false } }
    
    dangerouslyIgnoreUnhandledErrors: boolean

    Ignore any unhandled errors that occur

    false
    
    defines: Record<string, any>

    Handling for dependencies inlining or externalizing

    diff?: string | SerializedDiffOptions
    dir: string

    Base directory to scan for the test files

    config.root

    disableConsoleIntercept: boolean

    By default, Vitest automatically intercepts console logging during tests for extra formatting of test file, test title, etc... This is also required for console log preview on Vitest UI. However, disabling such interception might help when you want to debug a code with normal synchronous terminal console logging.

    This option has no effect on browser pool since Vitest preserves original logging on browser devtools.

    false
    
    dom: boolean

    Use happy-dom

    dumpDir?: string

    Custom environment variables assigned to process.env before running tests.

    environment: VitestEnvironment

    Running environment

    Supports 'node', 'jsdom', 'happy-dom', 'edge-runtime'

    If used unsupported string, will try to load the package vitest-environment-${env}

    'node'
    
    environmentOptions: EnvironmentOptions

    Environment options.

    exclude: string[]

    Exclude globs for test files

    ['**/node_modules/**', '**/.git/**']
    
    execArgv: string[]

    Pass additional arguments to node process when spawning the worker.

    See Command-line API | Node.js for more information.

    Set to process.execArgv to pass all arguments of the current process.

    Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103

    [] // no execution arguments are passed
    
    expandSnapshotDiff: boolean

    Show full diff when snapshot fails instead of a patch.

    expect: {
        poll?: { interval?: number; timeout?: number };
        requireAssertions?: boolean;
    }

    Configuration options for expect() matches.

    Type Declaration

    • Optionalpoll?: { interval?: number; timeout?: number }

      Default options for expect.poll()

      • Optionalinterval?: number

        Polling interval in milliseconds

        50
        
      • Optionaltimeout?: number

        Timeout in milliseconds

        1000
        
    • OptionalrequireAssertions?: boolean

      Throw an error if tests don't have any expect() assertions.

    experimental: {
        fsModuleCache?: boolean;
        fsModuleCachePath?: string;
        openTelemetry?: { enabled: boolean; sdkPath?: string };
        printImportBreakdown?: boolean;
    }

    Experimental features

    Type Declaration

    • OptionalfsModuleCache?: boolean

      Enable caching of modules on the file system between reruns.

    • OptionalfsModuleCachePath?: string

      Path relative to the root of the project where the fs module cache will be stored.

      node_modules/.experimental-vitest-cache
      
    • OptionalopenTelemetry?: { enabled: boolean; sdkPath?: string }
    • OptionalprintImportBreakdown?: boolean

      Show imports (top 10) that take a long time.

      Enabling this will also show a breakdown by default in UI, but you can always press a button to toggle it.

    Options for @sinon/fake-timers

    filters?: string[]
    forceRerunTriggers: string[]

    Glob pattern of file paths that will trigger the whole suite rerun

    Useful if you are testing calling CLI commands

    ['**/package.json/**', '**/{vitest,vite}.config.*/**']
    
    globals: boolean

    Register apis globally

    false
    
    globalSetup: string | string[]

    Path to global setup files

    hideSkippedTests: boolean

    Hide logs for skipped tests

    false
    
    hookTimeout: number

    Default timeout of a hook in milliseconds

    10000
    
    include: string[]

    A list of glob patterns that match your test files.

    ['**/*.{test,spec}.?(c|m)[jt]s?(x)']
    
    includeSource: string[]

    Include globs for in-source test files

    []
    
    includeTaskLocation: boolean

    Include "location" property inside the test definition

    false
    
    inspect: string | boolean

    Debug tests by opening node:inspector in worker / child process. Provides similar experience as --inspect Node CLI argument.

    Requires fileParallelism: false.

    inspectBrk: string | boolean

    Debug tests by opening node:inspector in worker / child process and wait for debugger to connect. Provides similar experience as --inspect-brk Node CLI argument.

    Requires fileParallelism: false.

    inspector: {
        enabled?: boolean;
        host?: string;
        port?: number;
        waitForDebugger?: boolean;
    }

    Inspector options. If --inspect or --inspect-brk is enabled, these options will be passed to the inspector.

    Type Declaration

    • Optionalenabled?: boolean

      Enable inspector

    • Optionalhost?: string

      Host to run inspector on

    • Optionalport?: number

      Port to run inspector on

    • OptionalwaitForDebugger?: boolean

      Wait for debugger to connect before running tests

    isolate: boolean

    Run tests in an isolated environment. This option has no effect on vmThreads pool.

    Disabling this option improves performance if your code doesn't rely on side effects.

    true
    
    logHeapUsage: boolean

    Show heap usage after each test. Useful for debugging memory leaks.

    maxConcurrency: number

    A number of tests that are allowed to run at the same time marked with test.concurrent.

    5
    
    maxWorkers: number

    Maximum number or percentage of workers to run tests in.

    mergeReports: string

    Directory of blob reports to merge

    '.vitest-reports'
    
    mockReset: boolean

    Will call .mockReset() on all spies before each test

    false
    

    Overrides Vite mode

    'test'
    
    name: string
    onConsoleLog: (
        log: string,
        type: "stdout" | "stderr",
        entity: TestModule | TestCase | TestSuite | undefined,
    ) => boolean | void

    Custom handler for console.log in tests.

    Return false to ignore the log.

    onStackTrace: (error: TestError, frame: ParsedStack) => boolean | void

    Enable stack trace filtering. If absent, all stack trace frames will be shown.

    Return false to omit the frame.

    onUnhandledError: OnUnhandledErrorCallback

    A callback that can return false to ignore an unhandled error

    open: boolean

    Open UI automatically.

    !process.env.CI
    
    outputFile:
        | string
        | Partial<
            Record<
                | "default"
                | "blob"
                | "verbose"
                | "dot"
                | "json"
                | "tap"
                | "tap-flat"
                | "junit"
                | "tree"
                | "hanging-process"
                | "github-actions",
                string,
            >,
        > & Record<string, string>

    Write test results to a file when the --reporter=jsonor--reporter=junit` option is also specified. Also definable individually per reporter by using an object instead.

    outputJson: string

    benchmark.outputJson option exposed at the top level for cli

    passWithNoTests: boolean

    Pass with no tests

    pool: Pool
    printConsoleTrace: boolean

    Always print console stack traces.

    false
    
    project: string[]

    Options for projects

    Define variables that will be returned from inject in the test environment.

    // vitest.config.ts
    export default defineConfig({
    test: {
    provide: {
    someKey: 'someValue'
    }
    }
    })
    // test file
    import { inject } from 'vitest'
    const value = inject('someKey') // 'someValue'
    related?: string[]
    reporters: (
        | Reporter
        | ["default", Partial<DefaultReporterOptions>]
        | ["blob", Partial<BlobOptions>]
        | ["verbose", Partial<DefaultReporterOptions>]
        | ["dot", Partial<BaseOptions>]
        | ["json", Partial<JsonOptions>]
        | ["tap", object]
        | ["tap-flat", object]
        | ["junit", Partial<JUnitOptions>]
        | ["tree", Partial<BaseOptions>]
        | ["hanging-process", object]
        | ["github-actions", Partial<GithubActionsReporterOptions>]
        | ["html", Partial<HTMLOptions>]
        | [string & {}, Record<string, unknown>]
    )[]
    restoreMocks: boolean

    Will call .mockRestore() on all spies before each test

    false
    
    retry: number

    Retry the test specific number of times if it fails.

    0
    
    root: string

    Project root

    process.cwd()
    
    runner?: string
    sequence: {
        concurrent?: boolean;
        groupOrder: number;
        hooks: SequenceHooks;
        seed: number;
        sequencer: TestSequencerConstructor;
        setupFiles: SequenceSetupFiles;
        shuffle?: boolean;
    }
    server: {
        debug?: { dump?: string | true; load?: boolean };
        deps?: ServerDepsOptions;
    }
    setupFiles: string[]
    shard?: { count: number; index: number }
    silent: boolean | "passed-only"

    Silent mode

    Use 'passed-only' to see logs from failing tests only.

    false
    
    slowTestThreshold: number

    The number of milliseconds after which a test is considered slow and reported as such in the results.

    300
    
    snapshotEnvironment?: string
    snapshotFormat: Omit<PrettyFormatOptions, "plugins" | "compareKeys"> & {
        compareKeys?: null;
    }

    Format options for snapshot testing.

    snapshotOptions: SnapshotStateOptions
    snapshotSerializers: string[]

    Paths to snapshot serializer modules.

    standalone: boolean

    Do not run tests when Vitest starts.

    Vitest will only run tests if it's called programmatically or the test file changes.

    If CLI file filters are passed, standalone mode is ignored.

    teardownTimeout: number

    Default timeout to wait for close when Vitest shuts down, in milliseconds

    10000
    
    testNamePattern?: RegExp
    testTimeout: number

    Default timeout of a test in milliseconds

    5000
    
    typecheck: Omit<TypecheckConfig, "enabled"> & { enabled: boolean }
    ui: boolean

    Enable Vitest UI

    false
    
    uiBase: string

    Base url for the UI

    '/__vitest__/'
    
    unstubEnvs: boolean

    Will restore all env stubs to their original values before each test

    false
    
    unstubGlobals: boolean

    Will restore all global stubs to their original values before each test

    false
    
    update: boolean

    Update snapshot

    false
    
    vmMemoryLimit?: string | number
    watch: boolean

    Watch mode

    !process.env.CI
    
    watchTriggerPatterns: WatcherTriggerPattern[]

    Pattern configuration to rerun only the tests that are affected by the changes of specific files in the repository.