(s: string)
| 117 | // (For example, playwright's ElementHandle can become about 200_000_000 length string) |
| 118 | const MAX_LENGTH = 100_000 |
| 119 | function truncate(s: string) { |
| 120 | return s.length <= MAX_LENGTH ? s : (`${s.slice(0, MAX_LENGTH)}...`) |
| 121 | } |
| 122 | aDisplay = memorize('expected', truncate(aDisplay)) |
| 123 | bDisplay = memorize('actual', truncate(bDisplay)) |
| 124 | const aDiff = `${aColor(`${aIndicator} ${aAnnotation}:`)}\n${aDisplay}` |