(tree)
| 31 | } |
| 32 | |
| 33 | function treeToXML(tree) { |
| 34 | if (typeof tree === 'string') { |
| 35 | return `${escapeContent(tree)}\n`; |
| 36 | } |
| 37 | const { |
| 38 | tag, attrs, nesting, children, comment, |
| 39 | } = tree; |
| 40 | const indent = StringPrototypeRepeat('\t', nesting + 1); |
| 41 | if (comment) { |
| 42 | return `${indent}<!-- ${escapeComment(comment)} -->\n`; |
| 43 | } |
| 44 | const attrsString = ArrayPrototypeJoin( |
| 45 | ArrayPrototypeMap( |
| 46 | ObjectEntries(attrs), |
| 47 | ({ 0: key, 1: value }) => `${key}="${escapeAttribute(String(value))}"`), |
| 48 | ' '); |
| 49 | if (!children?.length) { |
| 50 | return `${indent}<${tag} ${attrsString}/>\n`; |
| 51 | } |
| 52 | const childrenString = ArrayPrototypeJoin(ArrayPrototypeMap(children ?? [], treeToXML), ''); |
| 53 | return `${indent}<${tag} ${attrsString}>\n${childrenString}${indent}</${tag}>\n`; |
| 54 | } |
| 55 | |
| 56 | function isFailure(node) { |
| 57 | return (node?.children && ArrayPrototypeSome(node.children, (c) => c.tag === 'failure')) || node?.attrs?.failures; |
no test coverage detected
searching dependent graphs…