diff --git a/docs/guide/workspace.md b/docs/guide/workspace.md index 2e2156fbb5eb..285c579f359c 100644 --- a/docs/guide/workspace.md +++ b/docs/guide/workspace.md @@ -96,6 +96,7 @@ Workspace projects don't support all configuration properties. For better type s :::code-group ```ts [packages/a/vitest.config.ts] twoslash +// @errors: 2769 import { defineProject } from 'vitest/config' export default defineProject({ diff --git a/netlify.toml b/netlify.toml index e7848797fbad..29eeea9bced9 100755 --- a/netlify.toml +++ b/netlify.toml @@ -1,7 +1,7 @@ [build] publish = "docs/.vitepress/dist" command = "pnpm ci:docs" -ignore = "git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- docs/ package.json pnpm-lock.yaml" +ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF docs/ package.json pnpm-lock.yaml" [build.environment] NODE_VERSION = "20" diff --git a/packages/vitest/src/config.ts b/packages/vitest/src/config.ts index 6b80fd38df45..4662621393d8 100644 --- a/packages/vitest/src/config.ts +++ b/packages/vitest/src/config.ts @@ -48,12 +48,22 @@ export function defineConfig(config: UserConfigExport): UserConfigExport { return config } -export function defineProject(config: T): T { +export function defineProject(config: UserWorkspaceConfig): UserWorkspaceConfig +export function defineProject(config: Promise): Promise +export function defineProject(config: UserProjectConfigFn): UserProjectConfigFn +export function defineProject(config: UserProjectConfigExport): UserProjectConfigExport +export function defineProject(config: UserProjectConfigExport): UserProjectConfigExport { return config } -type Workspace = string | (UserProjectConfigExport & { extends?: string }) +type WorkspaceProjectConfiguration = string | (UserProjectConfigExport & { + /** + * Relative path to the extendable config. All other options will be merged with this config. + * @example '../vite.config.ts' + */ + extends?: string +}) -export function defineWorkspace(config: Workspace[]): Workspace[] { +export function defineWorkspace(config: WorkspaceProjectConfiguration[]): WorkspaceProjectConfiguration[] { return config }