( buffer: Uint8Array<ArrayBufferLike> )
| 297 | } |
| 298 | |
| 299 | function readTextFrame( |
| 300 | buffer: Uint8Array<ArrayBufferLike> |
| 301 | ): string | undefined { |
| 302 | if (buffer.length < 2) return undefined; |
| 303 | |
| 304 | const length = buffer[1] & 0x7f; |
| 305 | if (length > 125) { |
| 306 | throw new Error('Test WebSocket client only supports small frames'); |
| 307 | } |
| 308 | if (buffer.length < 2 + length) return undefined; |
| 309 | |
| 310 | return Buffer.from(buffer.subarray(2, 2 + length)).toString('utf8'); |
| 311 | } |
| 312 | |
| 313 | export async function exec(directory: string, args: string[] = []) { |
| 314 | const token = await fetchCachedToken(); |
no test coverage detected