KC's Workspace
    Preparing search index...
    Index

    Constructors

    • Parameters

      Returns TestProject

    Properties

    browser?: ProjectBrowser

    Browser instance if the browser is enabled. This is initialized when the tests run for the first time.

    globalConfig: ResolvedConfig

    Resolved global configuration. If there are no workspace projects, this will be the same as config.

    provide: <T extends never>(key: T, value: ProvidedContext[T]) => void

    Provide a value to the test context. This value will be available to all tests with inject.

    tmpDir: string

    Temporary directory for the project. This is unique for each project. Vitest stores transformed content here.

    vitest: Vitest

    The global Vitest instance.

    Accessors

    • get color(): LabelColor | undefined

      The color used when reporting tasks of this project.

      Returns LabelColor | undefined

    • get config(): ResolvedConfig

      Resolved project configuration.

      Returns ResolvedConfig

    • get hash(): string

      The unique hash of this project. This value is consistent between the reruns.

      It is based on the root of the project (not consistent between OS) and its name.

      Returns string

    • get name(): string

      The name of the project or an empty string if not set.

      Returns string

    • get serializedConfig(): SerializedConfig

      Serialized project configuration. This is the config that tests receive.

      Returns SerializedConfig

    • get vite(): ViteDevServer

      Vite's dev server instance. Every workspace project has its own server.

      Returns ViteDevServer

    Methods

    • Closes the project and all associated resources. This can only be called once; the closing promise is cached until the server restarts. If the resources are needed again, create a new project.

      Returns Promise<void>

    • Creates a new test specification. Specifications describe how to run tests.

      Parameters

      Returns TestSpecification

    • Get the provided context. The project context is merged with the global context.

      Returns ProvidedContext

    • Get all files in the project that match the globs in the config and the filters.

      Parameters

      • Optionalfilters: string[]

        String filters to match the test files.

      Returns Promise<{ testFiles: string[]; typecheckTestFiles: string[] }>

    • Import a file using Vite module runner.

      Type Parameters

      • T

      Parameters

      • moduleId: string

        The ID of the module in Vite module graph

      Returns Promise<T>

    • Returns boolean

    • Check if this is the root project. The root project is the one that has the root config.

      Returns boolean

    • Test if a file matches the test globs. This does the actual glob matching if the test is not cached, unlike isCachedTestFile.

      Parameters

      • moduleId: string
      • Optionalsource: () => string

      Returns boolean

    • Parameters

      Returns void

    • Returns SerializedTestProject