MCPcopy
hub / github.com/vitest-dev/vitest / truncate

Function truncate

packages/utils/src/diff/index.ts:119–121  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

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}`

Callers 1

diffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected