[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

feat(cli): support -p shorthand for --project (#10826)

authored by

Vladimir and committed by
GitHub
(Jul 24, 2026, 1:46 PM +0200) 1adddde1 b7be7319

+30 -1
+1 -1
docs/guide/cli-generated.md
··· 794 794 795 795 ### project 796 796 797 - - **CLI:** `--project <name>` 797 + - **CLI:** `-p, --project <name>` 798 798 799 799 The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: `--project=1 --project=2`. You can also filter projects using wildcards like `--project=packages*`, and exclude projects with `--project=!pattern`. 800 800
+28
test/unit/test/cli-test.test.ts
··· 215 215 expect(getCLIOptions('--max-concurrency=1000')).toEqual({ maxConcurrency: 1000 }) 216 216 }) 217 217 218 + test('project is parsed correctly', () => { 219 + // cac copies the raw value to the shorthand key, it is ignored by vitest 220 + expect(getCLIOptions('--project space_1')).toEqual({ project: ['space_1'], p: 'space_1' }) 221 + expect(getCLIOptions('--project=space_1')).toEqual({ project: ['space_1'], p: 'space_1' }) 222 + expect(getCLIOptions('-p space_1')).toEqual({ project: ['space_1'], p: 'space_1' }) 223 + expect(getCLIOptions('-p=space_1')).toEqual({ project: ['space_1'], p: 'space_1' }) 224 + expect(getCLIOptions('-p space_1 -p space_2')).toEqual({ 225 + project: ['space_1', 'space_2'], 226 + p: ['space_1', 'space_2'], 227 + }) 228 + }) 229 + 218 230 test('injectCjsGlobals is parsed correctly', () => { 219 231 expect(getCLIOptions('--injectCjsGlobals')).toEqual({ injectCjsGlobals: true }) 220 232 expect(getCLIOptions('--inject-cjs-globals')).toEqual({ injectCjsGlobals: true }) ··· 446 458 filter: [], 447 459 options: { 448 460 'project': ['space_1', 'space_2'], 461 + 'p': ['space_1', 'space_2'], 462 + '--': [], 463 + 'color': true, 464 + }, 465 + }) 466 + 467 + expect(parseCLI('vitest -p space_1 -p space_2')).toEqual({ 468 + filter: [], 469 + options: { 470 + 'project': ['space_1', 'space_2'], 471 + 'p': ['space_1', 'space_2'], 449 472 '--': [], 450 473 'color': true, 451 474 }, ··· 455 478 filter: [], 456 479 options: { 457 480 'project': ['space 1'], 481 + 'p': '"space 1"', 458 482 '--': [], 459 483 'color': true, 460 484 }, ··· 464 488 filter: [], 465 489 options: { 466 490 'project': ['space 1'], 491 + 'p': 'space 1', 467 492 '--': [], 468 493 'color': true, 469 494 }, ··· 473 498 filter: [], 474 499 options: { 475 500 'project': ['space 1'], 501 + 'p': 'space 1', 476 502 '--': [], 477 503 'color': true, 478 504 }, ··· 482 508 filter: [], 483 509 options: { 484 510 'project': ['space 1', 'space 2'], 511 + 'p': ['"space 1"', '"space 2"'], 485 512 '--': [], 486 513 'color': true, 487 514 }, ··· 491 518 filter: ['./test-1.js', './test-2.js'], 492 519 options: { 493 520 'project': ['space 1', 'space 2', 'space 3'], 521 + 'p': ['"space 1"', '"space 2"', '"space 3"'], 494 522 '--': [], 495 523 'color': true, 496 524 },
+1
packages/vitest/src/node/cli/cli-config.ts
··· 743 743 }, 744 744 }, 745 745 project: { 746 + shorthand: 'p', 746 747 description: 747 748 'The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: `--project=1 --project=2`. You can also filter projects using wildcards like `--project=packages*`, and exclude projects with `--project=!pattern`.', 748 749 argument: '<name>',