diff --git a/packages/vitest/src/node/cli/cli-config.ts b/packages/vitest/src/node/cli/cli-config.ts index 75ae83eecbbe..b5e16b9f526c 100644 --- a/packages/vitest/src/node/cli/cli-config.ts +++ b/packages/vitest/src/node/cli/cli-config.ts @@ -551,8 +551,11 @@ export const cliOptionsConfig: VitestCLIOptions = { subcommands: { dir: null, }, + default: true, // cache can only be "false" or an object transform(cache) { + if (typeof cache !== 'boolean' && cache) + throw new Error('--cache.dir is deprecated') if (cache) return {} return cache diff --git a/test/core/test/cli-test.test.ts b/test/core/test/cli-test.test.ts index 9b602548ff32..1d4a3ce636cf 100644 --- a/test/core/test/cli-test.test.ts +++ b/test/core/test/cli-test.test.ts @@ -213,6 +213,7 @@ test('maxConcurrency is parsed correctly', () => { test('cache is parsed correctly', () => { expect(getCLIOptions('--cache')).toEqual({ cache: {} }) expect(getCLIOptions('--no-cache')).toEqual({ cache: false }) + expect(() => getCLIOptions('--cache.dir=./cache')).toThrowError('--cache.dir is deprecated') }) test('shuffle is parsed correctly', () => {