{"record":{"id":"6a55383271b29f87","repo":"vitest-dev/vitest","slug":"the-test-workspace-option-was-removed-in-vitest","errorCode":null,"errorMessage":"The `test.workspace` option was removed in Vitest 4. Please, migrate to `test.projects` instead. See https://vitest.dev/guide/projects for examples.","messagePattern":"The `test\\.workspace` option was removed in Vitest 4\\. Please, migrate to `test\\.projects` instead\\. See https://vitest\\.dev/guide/projects for examples\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/config/resolveConfig.ts","lineNumber":277,"sourceCode":"    )\n\n    resolved.retry = {\n      ...resolved.retry,\n      condition: undefined,\n    }\n  }\n\n  if (options.pool && typeof options.pool !== 'string') {\n    resolved.pool = options.pool.name\n    resolved.poolRunner = options.pool\n  }\n\n  if ('poolOptions' in resolved) {\n    logger.deprecate('`test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://v4.vitest.dev/guide/migration#pool-rework')\n  }\n\n  if ('workspace' in resolved) {\n    throw new Error('The `test.workspace` option was removed in Vitest 4. Please, migrate to `test.projects` instead. See https://vitest.dev/guide/projects for examples.')\n  }\n\n  resolved.pool ??= 'forks'\n\n  resolved.project = toArray(resolved.project)\n  resolved.provide ??= {}\n\n  // shallow copy tags array to avoid mutating user config\n  resolved.tags = [...resolved.tags || []]\n  const definedTags = new Set<string>()\n  resolved.tags.forEach((tag) => {\n    if (!tag.name || typeof tag.name !== 'string') {\n      throw new Error(`Each tag defined in \"test.tags\" must have a \"name\" property, received: ${JSON.stringify(tag)}`)\n    }\n    if (definedTags.has(tag.name)) {\n      throw new Error(`Tag name \"${tag.name}\" is already defined in \"test.tags\". Tag names must be unique.`)\n    }\n    if (/\\s/.test(tag.name)) {","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/config/resolveConfig.ts#L259-L295","documentation":"Vitest 4 removed `test.workspace` in favor of `test.projects`. During resolution, the presence of a `workspace` key on the resolved config is treated as a hard error (not a warning) and points the user to the migration guide. The same block deprecates `poolOptions`, signalling the broader v4 pool/project rework.","triggerScenarios":"A config file with `test: { workspace: [...] }`, a CLI/programmatic merge that injects `workspace`, or a shared base config from a pre-v4 preset still carrying the key.","commonSituations":"Upgrading Vitest 3→4; monorepo configs that used `workspace` to list sub-projects; tooling (Nx, Turborepo) that emits the v3 workspace shape.","solutions":["Rename `test.workspace` to `test.projects` with the same array contents.","Follow https://vitest.dev/guide/projects for the canonical `test.projects` examples.","Search the whole config chain (including presets and environment-specific overrides) for any lingering `workspace` key and remove it."],"exampleFix":"// before (v3)\nexport default defineConfig({ test: { workspace: ['packages/*'] } })\n\n// after (v4)\nexport default defineConfig({ test: { projects: ['packages/*'] } })","handlingStrategy":"validation","validationCode":"import type { InlineConfig } from 'vitest/config'\n\nfunction migrateWorkspace(cfg: any): InlineConfig['test'] {\n  if (cfg?.test?.workspace) {\n    return { ...cfg.test, projects: cfg.test.projects ?? cfg.test.workspace, workspace: undefined }\n  }\n  return cfg.test\n}","typeGuard":"function isV4Config(test: any): boolean {\n  return !('workspace' in (test ?? {}))\n}","tryCatchPattern":null,"preventionTips":["Run the v4 migration codemod/grep for `workspace` before bumping the major.","Audit shared config presets after upgrading — they often lag the user project.","Treat the v4 changelog as a checklist of removed keys."],"tags":["config","workspace","vitest-4","migration","deprecation"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}