()
| 212 | } |
| 213 | |
| 214 | async function inputFilePattern() { |
| 215 | off() |
| 216 | |
| 217 | const watchFilter = new WatchFilter( |
| 218 | 'Input filename pattern', |
| 219 | stdin, |
| 220 | stdout, |
| 221 | ) |
| 222 | |
| 223 | const filter = await watchFilter.filter(async (str: string) => { |
| 224 | const specifications = await ctx.globTestSpecifications([str]) |
| 225 | |
| 226 | return specifications |
| 227 | .map(specification => relative(ctx.config.root, specification.moduleId)) |
| 228 | .filter((file, index, all) => all.indexOf(file) === index) |
| 229 | }) |
| 230 | |
| 231 | on() |
| 232 | |
| 233 | if (typeof filter === 'undefined') { |
| 234 | return |
| 235 | } |
| 236 | |
| 237 | latestFilename = filter?.trim() || '' |
| 238 | const lastResults = watchFilter.getLastResults() |
| 239 | |
| 240 | await ctx.changeFilenamePattern( |
| 241 | latestFilename, |
| 242 | filter && lastResults.length |
| 243 | ? lastResults.map(i => resolve(ctx.config.root, i)) |
| 244 | : undefined, |
| 245 | ) |
| 246 | } |
| 247 | |
| 248 | let rl: readline.Interface | undefined |
| 249 | function on() { |
no test coverage detected