diff --git a/packages/vitest/src/node/cli/cli-config.ts b/packages/vitest/src/node/cli/cli-config.ts index aeefab1f4d6c..ce0c7120ef84 100644 --- a/packages/vitest/src/node/cli/cli-config.ts +++ b/packages/vitest/src/node/cli/cli-config.ts @@ -526,6 +526,7 @@ export const cliOptionsConfig: VitestCLIOptions = { project: { description: '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', argument: '', + array: true, }, slowTestThreshold: { description: 'Threshold in milliseconds for a test to be considered slow (default: 300)', diff --git a/test/core/test/cli-test.test.ts b/test/core/test/cli-test.test.ts index a3addf3749e2..0cf5b61b3847 100644 --- a/test/core/test/cli-test.test.ts +++ b/test/core/test/cli-test.test.ts @@ -321,4 +321,13 @@ test('public parseCLI works correctly', () => { expect(() => { parseCLI('node --test --coverage --browser --typecheck') }).toThrowError(`Expected "vitest" as the first argument, received "node"`) + + expect(parseCLI('vitest --project=space_1 --project=space_2')).toEqual({ + filter: [], + options: { + 'project': ['space_1', 'space_2'], + '--': [], + 'color': true, + }, + }) })