Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: trim input filename and test name #2650

Merged
merged 2 commits into from Jan 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vitest/src/node/core.ts
Expand Up @@ -364,13 +364,13 @@ export class Vitest {
}

async changeNamePattern(pattern: string, files: string[] = this.state.getFilepaths(), trigger?: string) {
this.config.testNamePattern = pattern ? new RegExp(pattern) : undefined
this.config.testNamePattern = pattern.trim() ? new RegExp(pattern) : undefined
sheremet-va marked this conversation as resolved.
Show resolved Hide resolved
await this.rerunFiles(files, trigger)
}

async changeFilenamePattern(pattern: string) {
const files = this.state.getFilepaths()
if (!pattern)
if (!pattern.trim())
return await this.rerunFiles(files, 'reset filename pattern')
const filteredFiles = await this.globTestFiles([pattern])
await this.rerunFiles(filteredFiles, 'change filename pattern')
Expand Down