(
name: string,
attrs: Record<string, any>,
children: () => Promise<void>,
)
| 164 | } |
| 165 | |
| 166 | async writeElement( |
| 167 | name: string, |
| 168 | attrs: Record<string, any>, |
| 169 | children: () => Promise<void>, |
| 170 | ): Promise<void> { |
| 171 | const pairs: string[] = [] |
| 172 | for (const key in attrs) { |
| 173 | const attr = attrs[key] |
| 174 | if (attr === undefined) { |
| 175 | continue |
| 176 | } |
| 177 | |
| 178 | pairs.push(`${key}="${escapeXML(attr)}"`) |
| 179 | } |
| 180 | |
| 181 | await this.logger.log( |
| 182 | `<${name}${pairs.length ? ` ${pairs.join(' ')}` : ''}>`, |
| 183 | ) |
| 184 | this.logger.indent() |
| 185 | await children.call(this) |
| 186 | this.logger.unindent() |
| 187 | |
| 188 | await this.logger.log(`</${name}>`) |
| 189 | } |
| 190 | |
| 191 | async writeLogs(task: Task, type: 'err' | 'out'): Promise<void> { |
| 192 | if (task.logs == null || task.logs.length === 0) { |
no test coverage detected