MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / formatDiff

Function formatDiff

lib/aria.js:224–242  ·  view source on GitHub ↗
(added, removed)

Source from the content-addressed store, hash-verified

222}
223
224function formatDiff(added, removed) {
225 if (added.length === 0 && removed.length === 0) return null
226 const lines = ['ariaDiff:']
227 if (added.length === 0) {
228 lines.push(' added: []')
229 } else {
230 lines.push(' added:')
231 for (const [item, count] of [...countBy(added).entries()].sort(([a], [b]) => a.localeCompare(b))) {
232 const suffix = count > 1 ? ` (x${count})` : ''
233 lines.push(` - ${item}${suffix}`)
234 }
235 }
236 if (removed.length === 0) {
237 lines.push(' removed: []')
238 } else {
239 lines.push(` removed: ${removed.length} interactive elements`)
240 }
241 return lines.join('\n')
242}
243
244// ─────────────────────────────────────────────────────────────────
245// Public API — pipelines composed visibly, top-to-bottom

Callers 1

diffAriaSnapshotsFunction · 0.85

Calls 3

countByFunction · 0.85
pushMethod · 0.80
entriesMethod · 0.80

Tested by

no test coverage detected