Skip to content

Commit

Permalink
fix(cli): normalize argument path (#2180)
Browse files Browse the repository at this point in the history
* fix: cli-path

* feat: normalizeOptions
  • Loading branch information
poyoho committed Oct 31, 2022
1 parent fe71946 commit 2815372
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/vitest/src/node/cli.ts
@@ -1,3 +1,4 @@
import { normalize } from 'pathe'
import cac from 'cac'
import c from 'picocolors'
import { version } from '../../package.json'
Expand Down Expand Up @@ -92,9 +93,16 @@ async function benchmark(cliFilters: string[], options: CliOptions): Promise<voi
await start('benchmark', cliFilters, options)
}

function normalizeOptions(argv: CliOptions): CliOptions {
argv.root = argv.root && normalize(argv.root)
argv.config = argv.config && normalize(argv.config)
argv.dir = argv.dir && normalize(argv.dir)
return argv
}

async function start(mode: VitestRunMode, cliFilters: string[], options: CliOptions): Promise<void> {
try {
if (await startVitest(mode, cliFilters, options) === false)
if (await startVitest(mode, cliFilters.map(normalize), normalizeOptions(options)) === false)
process.exit()
}
catch (e) {
Expand Down

0 comments on commit 2815372

Please sign in to comment.