(result: unknown)
| 41 | |
| 42 | /** Typed accessor for code search result value. */ |
| 43 | export function asCodeSearchResult(result: unknown): CodeSearchResult { |
| 44 | if ( |
| 45 | result && |
| 46 | typeof result === 'object' && |
| 47 | 'type' in result && |
| 48 | result.type === 'json' && |
| 49 | 'value' in result |
| 50 | ) { |
| 51 | return result.value as CodeSearchResult |
| 52 | } |
| 53 | return {} |
| 54 | } |
| 55 | |
| 56 | /** Creates a mock spawn function that returns the provided mock process. */ |
| 57 | export function createMockSpawn( |