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AK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC","sourcesContent":["import charm from 'charm';\nimport { createCoverageMap, CoverageMap } from 'istanbul-lib-coverage';\nimport { format } from 'util';\nimport { global } from '@theintern/common';\n\nimport Environment from '../Environment';\nimport Suite from '../Suite';\nimport Test from '../Test';\nimport RemoteSuite from '../RemoteSuite';\nimport { createEventHandler } from './Reporter';\nimport TextCoverage, { TextCoverageProperties } from './TextCoverage';\nimport { CoverageMessage, DeprecationMessage } from '../executors/Executor';\nimport Node, { NodeEvents, TunnelMessage } from '../executors/Node';\n\nconst eventHandler = createEventHandler<NodeEvents>();\n\n/**\n * Handles presentation of runner results to the user\n */\nexport default class Pretty extends TextCoverage implements PrettyProperties {\n colorReplacement: { [key: string]: string };\n dimensions: any;\n titleWidth: number;\n maxProgressBarWidth: number;\n tunnelState: string;\n\n protected _header: string;\n protected _log: string[];\n protected _reports: any;\n protected _spinnerOffset: number;\n protected _total: Report;\n protected _charm: charm.CharmInstance | undefined;\n protected _renderTimeout: NodeJS.Timer | undefined;\n\n constructor(executor: Node, options: PrettyOptions = {}) {\n super(executor, options);\n\n this._spinnerOffset = 0;\n this.dimensions = options.dimensions || {};\n this.titleWidth = options.titleWidth || 12;\n this.maxProgressBarWidth = options.maxProgressBarWidth || 40;\n this.colorReplacement = Object.assign(\n {\n 0: 'green',\n 1: 'magenta',\n 2: 'red',\n '✓': 'green',\n '!': 'red',\n '×': 'red',\n '~': 'magenta',\n '⚠': 'yelow',\n },\n options.colorReplacement || {}\n );\n this._header = '';\n this._reports = {};\n this._log = [];\n this.tunnelState = '';\n this._total = new Report();\n }\n\n close() {\n if (this._renderTimeout) {\n clearTimeout(this._renderTimeout);\n }\n }\n\n @eventHandler()\n runStart() {\n this._header = this.executor.config.name;\n this._charm = this._charm || this._newCharm();\n\n const resize = () => {\n this.dimensions.width = (<any>global.process.stdout).columns || 80;\n this.dimensions.height = (<any>global.process.stdout).rows || 24;\n };\n\n resize();\n global.process.stdout.on('resize', resize);\n\n const rerender = () => {\n this._charm!.erase('screen').position(0, 0);\n this._render();\n this._renderTimeout = global.setTimeout(rerender, 200);\n };\n rerender();\n }\n\n @eventHandler()\n runEnd() {\n const charm = this._charm!;\n global.clearTimeout(this._renderTimeout);\n charm.erase('screen').position(0, 0);\n\n // write a full log of errors\n // Sort logs: pass < deprecated < skip < errors < fail\n const ERROR_LOG_WEIGHT: { [key: string]: number } = {\n '✓': 0,\n '⚠': 1,\n '~': 2,\n '×': 3,\n '!': 4,\n };\n this._log\n .sort((a: any, b: any) => {\n a = ERROR_LOG_WEIGHT[a.charAt(0)] || 0;\n b = ERROR_LOG_WEIGHT[b.charAt(0)] || 0;\n return a - b;\n })\n .forEach((line) => {\n const color = this._getColor(line);\n if (color == null) {\n charm.display('reset');\n } else {\n charm.foreground(color);\n }\n charm.write(`${line}\\n`);\n });\n charm.display('reset');\n charm.write('\\n');\n\n // Display the pretty results\n this._render(true);\n\n // Display coverage information\n if (this._total.coverageMap.files().length > 0) {\n charm.write('\\n');\n this.createCoverageReport('text', this._total.coverageMap);\n }\n }\n\n @eventHandler()\n coverage(data: CoverageMessage) {\n const report = this._reports[data.sessionId || ''];\n report && report.coverageMap.merge(data.coverage);\n this._total.coverageMap.merge(data.coverage);\n }\n\n @eventHandler()\n suiteStart(suite: Suite) {\n if (!suite.hasParent || suite instanceof RemoteSuite) {\n const numTests = suite.numTests;\n this._total.numTotal += numTests;\n\n if (suite.sessionId) {\n const report = this._getReport(suite);\n report.numTotal += numTests;\n report.suiteInfo[suite.id] = {\n parentId: suite.parentId,\n numToReport: suite.numTests,\n };\n }\n }\n }\n\n @eventHandler()\n suiteEnd(suite: Suite) {\n if (suite.error) {\n // Record all the tests that haven't been run as skipped\n const info = this._getReport(suite).suiteInfo[suite.id];\n this._record(suite, Result.SKIP, info.numToReport);\n\n const message = '! ' + suite.id;\n this._log.push(message + '\\n' + this.formatError(suite.error));\n }\n }\n\n @eventHandler()\n testEnd(test: Test) {\n if (test.skipped) {\n this._record(test, Result.SKIP);\n this._log.push('~ ' + test.id + ': ' + (test.skipped || 'skipped'));\n } else if (test.error) {\n const message = '× ' + test.id;\n this._record(test, Result.FAIL);\n this._log.push(message + '\\n' + this.formatError(test.error));\n } else {\n this._record(test, Result.PASS);\n this._log.push('✓ ' + test.id);\n }\n }\n\n @eventHandler()\n tunnelDownloadProgress(message: TunnelMessage) {\n const progress = message.progress!;\n this.tunnelState =\n 'Downloading ' +\n ((progress.received / progress.total) * 100).toFixed(2) +\n '%';\n }\n\n @eventHandler()\n tunnelStatus(message: TunnelMessage) {\n this.tunnelState = message.status!;\n }\n\n @eventHandler()\n error(error: Error) {\n const message = '! ' + error.message;\n this._log.push(message + '\\n' + this.formatError(error));\n // stop the render timeout on a fatal error so Intern can exit\n global.clearTimeout(this._renderTimeout);\n }\n\n @eventHandler()\n deprecated(message: DeprecationMessage) {\n let text = '⚠ ' + message.original + ' is deprecated.';\n\n if (message.replacement) {\n text += ' Use ' + message.replacement + ' instead.';\n }\n\n if (message.message) {\n text += ' ' + message.message;\n }\n\n this._log.push(text);\n }\n\n /**\n * Return the report for a given session, creating it if necessary.\n */\n private _getReport(suiteOrTest: Suite | Test): Report {\n const id = suiteOrTest.sessionId || '';\n if (!this._reports[id]) {\n this._reports[id] = new Report(\n suiteOrTest.remote && suiteOrTest.remote.environmentType\n );\n }\n return this._reports[id];\n }\n\n /**\n * Create the charm instance used by this report.\n */\n private _newCharm() {\n const c = charm();\n c.pipe(global.process.stdout);\n return c;\n }\n\n private _record(suiteOrTest: Suite | Test, result: Result, count = 1) {\n const report = this._reports[suiteOrTest.sessionId];\n this._total.record(result, count);\n if (report) {\n report.record(result, count);\n\n const suiteInfo = report.suiteInfo;\n let info: SuiteInfo | undefined = suiteInfo[suiteOrTest.id];\n // A test ID won't be in this._suiteInfo, but it's parentId should be\n if (!info && suiteOrTest.parentId) {\n info = suiteInfo[suiteOrTest.parentId];\n }\n while (info) {\n info.numToReport -= count;\n if (info.parentId) {\n info = suiteInfo[info.parentId];\n } else {\n info = undefined;\n }\n }\n }\n }\n\n /**\n * Render the progress bar\n * [✔︎~✔︎×✔︎✔︎✔︎✔︎✔︎✔︎] 99/100\n * @param report the report data to render\n * @param width the maximum width for the entire progress bar\n */\n private _drawProgressBar(report: Report, width: number) {\n const spinnerCharacter = SPINNER_STATES[this._spinnerOffset];\n const charm = this._charm!;\n if (!report.numTotal) {\n charm.write('Pending');\n return;\n }\n\n const totalTextSize = String(report.numTotal).length;\n const remainingWidth = Math.max(width - 4 - totalTextSize * 2, 1);\n const barSize = Math.min(\n remainingWidth,\n report.numTotal,\n this.maxProgressBarWidth\n );\n const results = report.getCompressedResults(barSize);\n\n charm.write('[');\n results.forEach((value) => {\n const color = this._getColor(value);\n if (color == null) {\n charm.display('reset');\n } else {\n charm.foreground(color);\n }\n charm.write(symbols[value]);\n });\n charm.display('reset');\n charm.write(\n fit(spinnerCharacter, barSize - results.length) +\n '] ' +\n fit(report.finished, totalTextSize, true) +\n '/' +\n report.numTotal\n );\n }\n\n /**\n * Render a single line\n * TITLE: [✔︎~✔︎×✔︎✔︎✔︎✔︎✔︎✔︎] 100/100, 2 fail, 1 skip\n * TODO split this into two lines. The first line will display the\n * title, OS and code coverage and the progress bar on the second\n */\n private _drawSessionReport(report: Report) {\n const charm = this._charm!;\n const titleWidth = this.titleWidth;\n const leftOfBar = fit(\n this._abbreviateEnvironment(report.environment).slice(0, titleWidth - 2) +\n ': ',\n titleWidth\n );\n const rightOfBar =\n '' +\n (report.numFailed ? ', ' + report.numFailed + ' fail' : '') +\n (report.numSkipped ? ', ' + report.numSkipped + ' skip' : '');\n const barWidth = this.dimensions.width - rightOfBar.length - titleWidth;\n\n charm.write(leftOfBar);\n this._drawProgressBar(report, barWidth);\n charm.write(rightOfBar + '\\n');\n }\n\n /**\n * Abbreviate the environment information for rendering\n * @param env the test environment\n * @returns {string} abbreviated environment information\n */\n private _abbreviateEnvironment(env: any): string {\n const browser =\n (<{ [key: string]: any }>BROWSERS)[env.browserName.toLowerCase()] ||\n env.browserName.slice(0, 4);\n const result = [browser];\n\n if (env.version) {\n let version = String(env.version);\n if (version.indexOf('.') > -1) {\n version = version.slice(0, version.indexOf('.'));\n }\n result.push(version);\n }\n\n if (env.platform) {\n result.push(env.platform.slice(0, 3));\n }\n\n return result.join(' ');\n }\n\n private _render(omitLogs: boolean = false) {\n const charm = this._charm!;\n const numReports = Object.keys(this._reports).length;\n const logLength =\n this.dimensions.height -\n numReports -\n 4 /* last line & total */ -\n (this.tunnelState ? 2 : 0) -\n (numReports ? 1 : 0) -\n (this._header ? 1 : 0);\n this._spinnerOffset = ++this._spinnerOffset % SPINNER_STATES.length;\n\n charm.display('reset');\n if (this._header) {\n charm.display('bright');\n charm.write(this._header + '\\n');\n charm.display('reset');\n }\n this.tunnelState && charm.write('Tunnel: ' + this.tunnelState + '\\n\\n');\n this._drawTotalReport(this._total);\n\n // TODO if there is not room to render all reports only render\n // active ones or only the total with less space\n if (numReports) {\n charm.write('\\n');\n for (let key in this._reports) {\n this._drawSessionReport(this._reports[key]);\n }\n }\n\n if (!omitLogs && logLength > 0 && this._log.length) {\n const allowed = { '×': true, '⚠': true, '!': true };\n charm.write('\\n');\n\n this._log\n .filter((line) => {\n return (<{ [key: string]: any }>allowed)[line.charAt(0)];\n })\n .slice(-logLength)\n .forEach((line) => {\n // truncate long lines\n const color = this._getColor(line);\n if (color) {\n charm.foreground(color);\n }\n line = line.split('\\n', 1)[0];\n charm.write(`${line.slice(0, this.dimensions.width)}\\n`);\n charm.display('reset');\n });\n }\n }\n\n private _drawTotalReport(report: Report) {\n const charm = this._charm!;\n const title = 'Total: ';\n const totalTextSize = String(report.numTotal).length;\n\n charm.write(title);\n this._drawProgressBar(report, this.dimensions.width - title.length);\n charm.write(\n format(\n '\\nPassed: %s Failed: %s Skipped: %d\\n',\n fit(report.numPassed, totalTextSize),\n fit(report.numFailed, totalTextSize),\n report.numSkipped\n )\n );\n }\n\n private _getColor(value: string | number): charm.CharmColor | null {\n if (typeof value === 'string') {\n value = value[0];\n }\n return <charm.CharmColor>this.colorReplacement[value] || null;\n }\n}\n\nexport interface PrettyProperties extends TextCoverageProperties {\n colorReplacement: { [key: string]: string };\n dimensions: any;\n maxProgressBarWidth: number;\n titleWidth: number;\n}\n\nexport type PrettyOptions = Partial<PrettyProperties>;\n\n/**\n * Model tracking test results\n * @param environment the environment associated with the report\n * @param sessionId the sessionId associated with the report\n */\nexport class Report {\n environment: Environment | undefined;\n sessionId: string | undefined;\n numTotal = 0;\n numPassed = 0;\n numFailed = 0;\n numSkipped = 0;\n results: number[] = [];\n suiteInfo: { [id: string]: SuiteInfo };\n coverageMap: CoverageMap;\n\n constructor(environment?: Environment, sessionId?: string) {\n this.environment = environment;\n this.sessionId = sessionId;\n this.coverageMap = createCoverageMap();\n this.suiteInfo = {};\n }\n\n get finished() {\n return this.results.length;\n }\n\n record(result: Result, count = 1) {\n for (let i = 0; i < count; i++) {\n this.results.push(result);\n }\n\n switch (result) {\n case Result.PASS:\n this.numPassed += count;\n break;\n case Result.SKIP:\n this.numSkipped += count;\n break;\n case Result.FAIL:\n this.numFailed += count;\n break;\n }\n }\n\n getCompressedResults(maxWidth: number): number[] {\n const total = Math.max(this.numTotal, this.results.length);\n const width = Math.min(maxWidth, total);\n const resultList: Result[] = [];\n\n for (let i = 0; i < this.results.length; ++i) {\n const pos = Math.floor((i / total) * width);\n resultList[pos] = Math.max(\n resultList[pos] || Result.PASS,\n this.results[i]\n );\n }\n\n return resultList;\n }\n}\n\nexport enum Result {\n PASS = 0,\n SKIP = 1,\n FAIL = 2,\n}\n\nexport interface SuiteInfo {\n parentId: string | undefined;\n numToReport: number;\n}\n\nconst symbols = ['✓', '~', '×'];\nconst PAD = new Array(100).join(' ');\nconst SPINNER_STATES = ['/', '-', '\\\\', '|'];\nconst BROWSERS = {\n chrome: 'Chr',\n firefox: 'Fx',\n opera: 'O',\n safari: 'Saf',\n 'internet explorer': 'IE',\n phantomjs: 'Phan',\n};\n\nfunction pad(width: number): string {\n return PAD.slice(0, Math.max(width, 0));\n}\n\nfunction fit(\n text: string | number,\n width: number,\n padLeft: boolean = false\n): string {\n text = String(text);\n if (text.length < width) {\n if (padLeft) {\n return pad(width - text.length) + text;\n }\n return text + pad(width - text.length);\n }\n return text.slice(0, width);\n}\n"]} |