Skip to content

Commit

Permalink
chore: intercept the --cache.dir command option
Browse files Browse the repository at this point in the history
  • Loading branch information
fenghan34 committed Mar 15, 2024
1 parent f0bab3b commit 8af373b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/vitest/src/node/cli/cli-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/core/test/cli-test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 8af373b

Please sign in to comment.