MCPcopy
hub / github.com/codeceptjs/CodeceptJS / getBrowserErrors

Function getBrowserErrors

lib/plugin/pageInfo.js:129–142  ·  view source on GitHub ↗
(logs, type = ['error'])

Source from the content-addressed store, hash-verified

127}
128
129function getBrowserErrors(logs, type = ['error']) {
130 // Accepts Playwright ConsoleMessage objects, normalized {type, text}, or strings
131 return logs
132 .map(log => {
133 if (typeof log === 'string') return log
134 if (!log) return null
135 const t = typeof log.type === 'function' ? log.type() : log.type
136 const text = typeof log.text === 'function' ? log.text() : log.text
137 if (!t) return null
138 return { type: t, text }
139 })
140 .filter(l => l && (typeof l === 'string' || type.includes(l.type)))
141 .map(l => (typeof l === 'string' ? l : l.text))
142}

Callers 1

pageInfo.jsFile · 0.85

Calls 3

filterMethod · 0.80
includesMethod · 0.80
typeMethod · 0.45

Tested by

no test coverage detected