(type, data, showErrorDetails = true, prefix = '', indent = '')
| 69 | } |
| 70 | |
| 71 | function formatTestReport(type, data, showErrorDetails = true, prefix = '', indent = '') { |
| 72 | let color = reporterColorMap[type] ?? colors.white; |
| 73 | let symbol = reporterUnicodeSymbolMap[type] ?? ' '; |
| 74 | const { skip, todo, expectFailure } = data; |
| 75 | const duration_ms = data.details?.duration_ms ? ` ${colors.gray}(${data.details.duration_ms}ms)${colors.white}` : ''; |
| 76 | const replayed = data.details?.passed_on_attempt !== undefined ? |
| 77 | ` ${colors.gray}(passed on attempt ${data.details.passed_on_attempt})${colors.white}` : |
| 78 | ''; |
| 79 | let title = `${data.name}${duration_ms}${replayed}`; |
| 80 | |
| 81 | if (skip !== undefined) { |
| 82 | title += ` # ${typeof skip === 'string' && skip.length ? skip : 'SKIP'}`; |
| 83 | color = colors.gray; |
| 84 | symbol = reporterUnicodeSymbolMap['hyphen:minus']; |
| 85 | } else if (todo !== undefined) { |
| 86 | title += ` # ${typeof todo === 'string' && todo.length ? todo : 'TODO'}`; |
| 87 | if (type === 'test:fail') { |
| 88 | color = colors.yellow; |
| 89 | symbol = reporterUnicodeSymbolMap['warning:alert']; |
| 90 | } |
| 91 | } else if (expectFailure !== undefined) { |
| 92 | title += ` # EXPECTED FAILURE`; |
| 93 | } |
| 94 | |
| 95 | const err = showErrorDetails && data.details?.error ? formatError(data.details.error, indent) : ''; |
| 96 | |
| 97 | return `${prefix}${indent}${color}${symbol}${title}${colors.white}${err}`; |
| 98 | } |
| 99 | |
| 100 | module.exports = { |
| 101 | __proto__: null, |
no test coverage detected
searching dependent graphs…