Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(cli): respect inline config dir (#2550)
  • Loading branch information
antfu committed Dec 21, 2022
1 parent 84f98e7 commit f6b592a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/vitest/src/node/cli.ts
Expand Up @@ -105,22 +105,28 @@ async function typecheck(cliFilters: string[] = [], options: CliOptions = {}) {
await start('typecheck', cliFilters, options)
}

function normalizeOptions(argv: CliOptions): CliOptions {
function normalizeCliOptions(argv: CliOptions): CliOptions {
if (argv.root)
argv.root = normalize(argv.root)
else
delete argv.root

if (argv.config)
argv.config = normalize(argv.config)
else
delete argv.config

if (argv.dir)
argv.dir = normalize(argv.dir)
else
delete argv.dir

return argv
}

async function start(mode: VitestRunMode, cliFilters: string[], options: CliOptions): Promise<Vitest | undefined> {
try {
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeOptions(options))
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options))
if (!ctx?.config.watch)
await ctx?.exit()
return ctx
Expand Down

0 comments on commit f6b592a

Please sign in to comment.