* Run tests with optional filtering
(options: {
adapters?: string
tests?: string
parallel?: string
verbose?: boolean
})
| 334 | * Run tests with optional filtering |
| 335 | */ |
| 336 | async function runCommand(options: { |
| 337 | adapters?: string |
| 338 | tests?: string |
| 339 | parallel?: string |
| 340 | verbose?: boolean |
| 341 | }) { |
| 342 | console.log(`${colors.bright}${colors.cyan}`) |
| 343 | console.log('╔═══════════════════════════════════════════════════════════╗') |
| 344 | console.log('║ TanStack AI Code Mode Skills - Multi-Adapter Tests ║') |
| 345 | console.log('╚═══════════════════════════════════════════════════════════╝') |
| 346 | console.log(colors.reset) |
| 347 | |
| 348 | // Parse adapter filter |
| 349 | const adapterFilter = options.adapters |
| 350 | ? options.adapters.split(',').map((a) => a.trim().toLowerCase()) |
| 351 | : null |
| 352 | |
| 353 | // Parse test filter |
| 354 | const testFilter = options.tests |
| 355 | ? options.tests.split(',').map((t) => t.trim().toUpperCase()) |
| 356 | : null |
| 357 | |
| 358 | // Parse parallel option (default to 3) |
| 359 | const parallel = options.parallel ? parseInt(options.parallel, 10) : 3 |
| 360 | const verbose = options.verbose || false |
| 361 | |
| 362 | // Determine which adapters to run |
| 363 | const adaptersToRun = adapterFilter |
| 364 | ? ADAPTERS.filter((a) => adapterFilter.includes(a.id.toLowerCase())) |
| 365 | : ADAPTERS |
| 366 | |
| 367 | // Validate adapter filter |
| 368 | if (adapterFilter) { |
| 369 | for (const id of adapterFilter) { |
| 370 | if (!getAdapter(id)) { |
| 371 | console.error(`❌ Unknown adapter: "${id}"`) |
| 372 | console.error( |
| 373 | ` Valid adapters: ${ADAPTERS.map((a) => a.id).join(', ')}`, |
| 374 | ) |
| 375 | process.exit(1) |
| 376 | } |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | // Determine which tests to run |
| 381 | let testsToRun: TestDefinition[] |
| 382 | if (testFilter) { |
| 383 | testsToRun = [] |
| 384 | for (const id of testFilter) { |
| 385 | const test = getTest(id) |
| 386 | if (!test) { |
| 387 | console.error(`❌ Unknown test: "${id}"`) |
| 388 | console.error(` Valid tests: ${TESTS.map((t) => t.id).join(', ')}`) |
| 389 | process.exit(1) |
| 390 | } |
| 391 | testsToRun.push(test) |
| 392 | } |
| 393 | } else { |
no test coverage detected