* Logs a test error (regardless of where it's running). * * @param {!TestErrorDef} testError object as created by addTestError.
(testError)
| 221 | * @param {!TestErrorDef} testError object as created by addTestError. |
| 222 | */ |
| 223 | function logTestError(testError) { |
| 224 | log( |
| 225 | 'error', |
| 226 | 'Error in test', |
| 227 | yellow(testError.name), |
| 228 | '\n ', |
| 229 | testError.message, |
| 230 | '\n ', |
| 231 | testError.error |
| 232 | ); |
| 233 | if (testError.consoleMessages.length > 0) { |
| 234 | log( |
| 235 | 'error', |
| 236 | cyan(testError.consoleMessages.length), |
| 237 | 'Console messages in the browser so far:' |
| 238 | ); |
| 239 | for (const message of testError.consoleMessages) { |
| 240 | log('error', cyan(`[console.${message.type()}]`), message.text()); |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Sets the AMP config, launches a server, and generates Percy snapshots for a |