From d6700bbd895e63776263b206ec73ccbb858a1b94 Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Tue, 28 May 2024 17:15:06 +0800 Subject: [PATCH] fix: repeatable `--exclude` option (#5782) --- packages/vitest/src/node/cli/cli-config.ts | 1 + test/core/test/cli-test.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/packages/vitest/src/node/cli/cli-config.ts b/packages/vitest/src/node/cli/cli-config.ts index 1ab5b2e28a70..93acfa2e0740 100644 --- a/packages/vitest/src/node/cli/cli-config.ts +++ b/packages/vitest/src/node/cli/cli-config.ts @@ -519,6 +519,7 @@ export const cliOptionsConfig: VitestCLIOptions = { exclude: { description: 'Additional file globs to be excluded from test', argument: '', + array: true, }, expandSnapshotDiff: { description: 'Show full diff when snapshot fails', diff --git a/test/core/test/cli-test.test.ts b/test/core/test/cli-test.test.ts index 841657df52b8..0de6b9437469 100644 --- a/test/core/test/cli-test.test.ts +++ b/test/core/test/cli-test.test.ts @@ -392,4 +392,13 @@ test('public parseCLI works correctly', () => { 'color': true, }, }) + + expect(parseCLI('vitest --exclude=docs --exclude=demo')).toEqual({ + filter: [], + options: { + 'exclude': ['docs', 'demo'], + '--': [], + 'color': true, + }, + }) })