@internal
(pattern: string, files: string[] = this.state.getFilepaths(), trigger?: string)
| 1257 | |
| 1258 | /** @internal */ |
| 1259 | async changeNamePattern(pattern: string, files: string[] = this.state.getFilepaths(), trigger?: string): Promise<void> { |
| 1260 | // Empty test name pattern should reset filename pattern as well |
| 1261 | if (pattern === '') { |
| 1262 | this.filenamePattern = undefined |
| 1263 | } |
| 1264 | |
| 1265 | const testNamePattern = pattern ? new RegExp(pattern) : undefined |
| 1266 | this.configOverride.testNamePattern = testNamePattern |
| 1267 | // filter only test files that have tests matching the pattern |
| 1268 | if (testNamePattern) { |
| 1269 | files = files.filter((filepath) => { |
| 1270 | const files = this.state.getFiles([filepath]) |
| 1271 | return !files.length || files.some((file) => { |
| 1272 | const tasks = getTasks(file) |
| 1273 | return !tasks.length || tasks.some(task => testNamePattern.test(task.name)) |
| 1274 | }) |
| 1275 | }) |
| 1276 | } |
| 1277 | |
| 1278 | await this.rerunFiles(files, trigger, pattern === '') |
| 1279 | } |
| 1280 | |
| 1281 | /** @internal */ |
| 1282 | async changeFilenamePattern(pattern: string, files: string[] = this.state.getFilepaths()): Promise<void> { |
no test coverage detected