( name: string, fn: () => Promise<void>, json: boolean, )
| 21 | } |
| 22 | |
| 23 | async function runStep( |
| 24 | name: string, |
| 25 | fn: () => Promise<void>, |
| 26 | json: boolean, |
| 27 | ): Promise<StepResult> { |
| 28 | const start = Date.now(); |
| 29 | if (!json) { |
| 30 | console.log(wrapInColor(`▸ ${name}...`, ANSI_COLORS.YELLOW_COLOR)); |
| 31 | } |
| 32 | try { |
| 33 | await fn(); |
| 34 | const durationMs = Date.now() - start; |
| 35 | if (!json) { |
| 36 | console.log(wrapInColor(` ✓ ${name} (${durationMs}ms)`, ANSI_COLORS.GREEN_COLOR)); |
| 37 | } |
| 38 | return { name, status: 'pass', durationMs }; |
| 39 | } catch (error) { |
| 40 | const durationMs = Date.now() - start; |
| 41 | const message = error instanceof Error ? error.message : String(error); |
| 42 | if (!json) { |
| 43 | console.log(wrapInColor(` ✗ ${name}: ${message}`, ANSI_COLORS.RED_COLOR)); |
| 44 | } |
| 45 | return { name, status: 'fail', durationMs, message }; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | async function getModuleTargets(client: BazelClient, module: string): Promise<string[]> { |
| 50 | const allTargets = await client.queryTargetsByKindWithFilter('valdi_module', [module], 'pipe'); |
no test coverage detected