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uBAAY,EAAE;uDA2Bd;QAGD;YADC,uBAAY,EAAE;yDAId;QAGD;YADC,uBAAY,EAAE;sDAUd;QACH,sBAAC;KAAA,AA9DD,CAA6C,kBAAQ,GA8DpD;sBA9DoB,eAAe","sourcesContent":["import { Executor } from '../executors/Executor';\nimport Suite from '../Suite';\nimport Test from '../Test';\nimport Reporter, { eventHandler, ReporterOptions } from './Reporter';\n\n/**\n * The console reporter outputs to the browser console.\n */\nexport default class ConsoleReporter extends Reporter {\n private _hasGrouping: boolean;\n private _testId: keyof Test;\n\n constructor(executor: Executor, options: ReporterOptions = {}) {\n super(executor, options);\n this._hasGrouping = 'group' in this.console && 'groupEnd' in this.console;\n this._testId = this._hasGrouping ? 'name' : 'id';\n }\n\n @eventHandler()\n error(error: Error) {\n this.console.warn('FATAL ERROR');\n this.console.error(this.formatError(error));\n }\n\n @eventHandler()\n suiteEnd(suite: Suite) {\n // IE<10 does not provide a global console object when Developer Tools\n // is turned off\n if (!this.console) {\n return;\n }\n\n if (suite.error) {\n this.console.warn('SUITE ERROR');\n this.console.error(this.formatError(suite.error));\n } else {\n const numTests = suite.numTests;\n const numFailedTests = suite.numFailedTests;\n const numSkippedTests = suite.numSkippedTests;\n const numNotRunTests =\n numTests - (suite.numPassedTests + numFailedTests + numSkippedTests);\n let message = numFailedTests + '/' + numTests + ' tests failed';\n\n if (numSkippedTests + numNotRunTests > 0) {\n message += ` (${numSkippedTests + numNotRunTests} not run)`;\n }\n\n this.console[numFailedTests ? 'warn' : 'info'](message);\n }\n\n this._hasGrouping && this.console.groupEnd();\n }\n\n @eventHandler()\n suiteStart(suite: Suite) {\n // only start group for non-root suite\n this._hasGrouping && suite.hasParent && this.console.group(suite.name);\n }\n\n @eventHandler()\n testEnd(test: Test) {\n if (test.error) {\n this.console.error(`FAIL: ${test[this._testId]} (${test.timeElapsed}ms)`);\n this.console.error(this.formatError(test.error));\n } else if (test.skipped) {\n this.console.log(`SKIP: ${test[this._testId]} (${test.skipped})`);\n } else {\n this.console.log(`PASS: ${test[this._testId]} (${test.timeElapsed}ms)`);\n }\n }\n}\n"]}
\No newline at end of file