From f2df6b733cb7545385f64603f23737623e9c5804 Mon Sep 17 00:00:00 2001 From: Han Feng Date: Thu, 22 Feb 2024 08:46:35 +0800 Subject: [PATCH 1/2] fix: repeatable `--project` option --- packages/vitest/src/node/cli/cli-config.ts | 1 + 1 file changed, 1 insertion(+) 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)', From bb60342cc51fd3a872de596d9efd6940bf7d3bec Mon Sep 17 00:00:00 2001 From: Han Feng Date: Thu, 22 Feb 2024 08:53:52 +0800 Subject: [PATCH 2/2] test: add test --- test/core/test/cli-test.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) 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, + }, + }) })