| 55 | let warningCount = 0 |
| 56 | let logCount = 0 |
| 57 | const consoleHandler = (message: ConsoleMessage) => { |
| 58 | const type = message.type() |
| 59 | if (type === 'error') { |
| 60 | errorCount++ |
| 61 | } else if (type === 'warning') { |
| 62 | warningCount++ |
| 63 | } else { |
| 64 | logCount++ |
| 65 | } |
| 66 | if (browserOutput) { |
| 67 | activePromises.push( |
| 68 | (async () => { |
| 69 | const args = [] |
| 70 | try { |
| 71 | const text = message.text() |
| 72 | for (const arg of message.args()) { |
| 73 | args.push(await arg.jsonValue()) |
| 74 | } |
| 75 | console.log(`[${type}] ${text}`, ...args) |
| 76 | } catch { |
| 77 | // Ignore |
| 78 | } |
| 79 | })() |
| 80 | ) |
| 81 | } |
| 82 | } |
| 83 | let uncaughtCount = 0 |
| 84 | const exceptionHandler = (error: Error) => { |
| 85 | uncaughtCount++ |