* Get all files in the project that match the globs in the config and the filters. * @param filters String filters to match the test files.
(filters: string[] = [])
| 273 | * @param filters String filters to match the test files. |
| 274 | */ |
| 275 | async globTestFiles(filters: string[] = []): Promise<{ |
| 276 | /** |
| 277 | * Test files that match the filters. |
| 278 | */ |
| 279 | testFiles: string[] |
| 280 | /** |
| 281 | * Typecheck test files that match the filters. This will be empty unless `typecheck.enabled` is `true`. |
| 282 | */ |
| 283 | typecheckTestFiles: string[] |
| 284 | }> { |
| 285 | return this.vitest._traces.$('vitest.config.resolve_include_project', async (span) => { |
| 286 | const dir = this.config.dir || this.config.root |
| 287 | |
| 288 | const { include, exclude, includeSource } = this.config |
| 289 | const typecheck = this.config.typecheck |
| 290 | span.setAttributes({ |
| 291 | cwd: dir, |
| 292 | include, |
| 293 | exclude, |
| 294 | includeSource, |
| 295 | typecheck: typecheck.enabled ? typecheck.include : [], |
| 296 | }) |
| 297 | |
| 298 | const [testFiles, typecheckTestFiles] = await Promise.all([ |
| 299 | typecheck.enabled && typecheck.only |
| 300 | ? [] |
| 301 | : this.globAllTestFiles(include, exclude, includeSource, dir), |
| 302 | typecheck.enabled |
| 303 | ? (this.typecheckFilesList || this.globFiles(typecheck.include, typecheck.exclude, dir)) |
| 304 | : [], |
| 305 | ]) |
| 306 | |
| 307 | this.typecheckFilesList = typecheckTestFiles |
| 308 | |
| 309 | return { |
| 310 | testFiles: this.filterFiles( |
| 311 | testFiles, |
| 312 | filters, |
| 313 | dir, |
| 314 | ), |
| 315 | typecheckTestFiles: this.filterFiles( |
| 316 | typecheckTestFiles, |
| 317 | filters, |
| 318 | dir, |
| 319 | ), |
| 320 | } |
| 321 | }) |
| 322 | } |
| 323 | |
| 324 | private async globAllTestFiles( |
| 325 | include: string[], |
no test coverage detected