Defining Projects in Vitest

From the Vitest cheat sheet ยท Test Projects ยท verified Nov 2026

Defining Projects

Split tests into named projects with their own environment, include, and browser settings

typescript
export default defineConfig({
  test: {
    projects: [
      { test: { name: 'unit', include: ['src/**/*.unit.test.ts'], environment: 'node' } },
      { test: { name: 'dom', include: ['src/**/*.dom.test.ts'], environment: 'jsdom' } },
    ],
  },
})

// vitest run -p unit
๐Ÿ“Œ v5: inline projects inherit the root config by default
โš ๏ธ Arrays merge, so a project's setupFiles add to the root ones
๐Ÿ’ก Every project needs a unique name; set one on inline configs
๐Ÿ” Root-only options like reporters and coverage can't go in a project
projectsworkspaceconfig

Continue with Vitest

Save the full cheat sheet or work through every related task.

More Vitest tasks

Back to the full Vitest cheat sheet