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,IAE5I,GACA,CA3KA,KAAO,QAAQ,SAAS,UAAU,KAClC,IAAM,QAAQ,IACd,SAAW,QAAQ,MAgLnB,QAAU,OAAO,QAAU","file":"/npm/mocha-teamcity-reporter@4.2.0/lib/teamcity.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/mocha-teamcity-reporter@4.2.0/lib/teamcity.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/* eslint-disable complexity */\n/**\n * Teamcity doc reference https://confluence.jetbrains.com/display/TCD10/Build+Script+Interaction+with+TeamCity\n *\n * Module dependencies.\n */\n'use strict';\n\nconst processPID = process.pid.toString();\nconst TEST_IGNORED = `##teamcity[testIgnored name='%s' message='%s' flowId='%s']`;\nconst SUITE_START = `##teamcity[testSuiteStarted name='%s' flowId='%s']`;\nconst SUITE_END = `##teamcity[testSuiteFinished name='%s' duration='%s' flowId='%s']`;\nconst SUITE_END_NO_DURATION = `##teamcity[testSuiteFinished name='%s' flowId='%s']`;\nconst TEST_START = `##teamcity[testStarted name='%s' captureStandardOutput='true' flowId='%s']`;\nconst TEST_FAILED = `##teamcity[testFailed name='%s' message='%s' details='%s' captureStandardOutput='true' flowId='%s']`;\nconst TEST_FAILED_COMPARISON = `##teamcity[testFailed type='comparisonFailure' name='%s' message='%s' \\\ndetails='%s' captureStandardOutput='true' actual='%s' expected='%s' flowId='%s']`;\nconst TEST_END = `##teamcity[testFinished name='%s' duration='%s' flowId='%s']`;\nconst TEST_END_NO_DURATION = `##teamcity[testFinished name='%s' flowId='%s']`;\n\nconst Mocha = require('mocha');\nconst {\n\tEVENT_SUITE_BEGIN,\n\tEVENT_TEST_BEGIN,\n\tEVENT_TEST_FAIL,\n\tEVENT_TEST_PENDING,\n\tEVENT_TEST_END,\n\tEVENT_HOOK_BEGIN,\n\tEVENT_HOOK_END,\n\tEVENT_SUITE_END,\n\tEVENT_RUN_END\n  } = Mocha.Runner.constants;\n\nconst util = require('util');\n\nlet Base, log, logError;\n\nBase = require('mocha').reporters.Base;\nlog = console.log;\nlogError = console.error;\n\n/**\n * Escape the given `str`.\n */\n\nfunction escape(str) {\n\tif (!str) return '';\n\treturn str\n\t\t.toString()\n\t\t.replace(/\\x1B.*?m/g, '') // eslint-disable-line no-control-regex\n\t\t.replace(/\\|/g, '||')\n\t\t.replace(/\\n/g, '|n')\n\t\t.replace(/\\r/g, '|r')\n\t\t.replace(/\\[/g, '|[')\n\t\t.replace(/\\]/g, '|]')\n\t\t.replace(/\\u0085/g, '|x')\n\t\t.replace(/\\u2028/g, '|l')\n\t\t.replace(/\\u2029/g, '|p')\n\t\t.replace(/'/g, '|\\'');\n}\n\nfunction isNil(value) {\n\treturn value == null; \t// eslint-disable-line\n}\n\nfunction formatString() {\n\tlet formattedArguments = [];\n\tconst args = Array.prototype.slice.call(arguments, 0);\n\t// Format all arguments for TC display (it escapes using the pipe char).\n\tlet tcMessage = args.shift();\n\targs.forEach((param) => {\n\t\tformattedArguments.push(escape(param));\n\t});\n\tformattedArguments.unshift(tcMessage);\n\treturn util.format.apply(util, formattedArguments);\n}\n\n\n/**\n * Initialize a new `Teamcity` reporter.\n *\n * @param {Runner} runner\n * @param {options} options\n * @api public\n */\n\nfunction Teamcity(runner, options) {\n\toptions = options || {};\n\tconst reporterOptions = options.reporterOptions || {};\n\tlet flowId, useStdError, recordHookFailures, actualVsExpected, ignoreHookWithName, displayIgnoredAsIgnored;\n\t(reporterOptions.flowId) ? flowId = reporterOptions.flowId : flowId = process.env['MOCHA_TEAMCITY_FLOWID'] || processPID;\n\t(reporterOptions.useStdError) ? useStdError = reporterOptions.useStdError : useStdError = process.env['USE_STD_ERROR'];\n\t(reporterOptions.recordHookFailures) ? recordHookFailures = reporterOptions.recordHookFailures : recordHookFailures = process.env['RECORD_HOOK_FAILURES'];\n\t(reporterOptions.actualVsExpected) ? actualVsExpected = reporterOptions.actualVsExpected : actualVsExpected = process.env['ACTUAL_VS_EXPECTED'];\n\t(reporterOptions.ignoreHookWithName) ? ignoreHookWithName = reporterOptions.ignoreHookWithName : ignoreHookWithName = process.env['IGNORE_HOOK_WITH_NAME'];\n\t(reporterOptions.displayIgnoredAsIgnored) ? displayIgnoredAsIgnored = reporterOptions.displayIgnoredAsIgnored : displayIgnoredAsIgnored = process.env['DISPLAY_IGNORED_AS_IGNORED'];\n\t(useStdError) ? useStdError = (useStdError.toLowerCase() === 'true') : useStdError = false;\n\t(recordHookFailures) ? recordHookFailures = (recordHookFailures.toLowerCase() === 'true') : recordHookFailures = false;\n\t(displayIgnoredAsIgnored) ? displayIgnoredAsIgnored = (displayIgnoredAsIgnored.toLowerCase() === 'true') : displayIgnoredAsIgnored = false;\n\t(ignoreHookWithName) ? ignoreHookWithName : null;\n\tactualVsExpected ? actualVsExpected = (actualVsExpected.toLowerCase() === 'true') : actualVsExpected = false;\n\tBase.call(this, runner);\n\tlet stats = this.stats;\n\tconst topLevelSuite = reporterOptions.topLevelSuite || process.env['MOCHA_TEAMCITY_TOP_LEVEL_SUITE'];\n\n\tconst hookFlowId = `${flowId}_hook`;\n\tconst ignoredTests = {};\n\tconst testState = { pending: 0 };\n\n\trunner.on(EVENT_SUITE_BEGIN, function (suite) {\n\t\tif (suite.root) {\n\t\t\tif (topLevelSuite) {\n\t\t\t\tlog(formatString(SUITE_START, topLevelSuite, flowId));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tsuite.startDate = new Date();\n\t\tlog(formatString(SUITE_START, suite.title, flowId));\n\t});\n\n\trunner.on(EVENT_TEST_BEGIN, function (test) {\n\t\tif (displayIgnoredAsIgnored && ignoredTests[`${test.title}-${flowId}`] === testState.pending) {\n\t\t\treturn;\n\t\t}\n\t\tlog(formatString(TEST_START, test.title, flowId));\n\t});\n\n\trunner.on(EVENT_TEST_FAIL, function (test, err) {\n\t\tlet isHook = false;\n\t\tif (test.title.includes(`\"before all\" hook`) ||\n\t\t\ttest.title.includes(`\"before each\" hook`) ||\n\t\t\ttest.title.includes(`\"after all\" hook`) ||\n\t\t\ttest.title.includes(`\"after each\" hook`)\n\t\t) {\n\t\t\tisHook = true;\n\t\t}\n\n\t\tconst testFlowId = (isHook) ? hookFlowId : flowId;\n\t\tif(actualVsExpected && (err.actual && err.expected)){\n\t\t\tif (useStdError) {\n\t\t\t\tlogError(formatString(TEST_FAILED_COMPARISON, test.title, err.message, err.stack, err.actual, err.expected, testFlowId));\n\t\t\t} else {\n\t\t\t\tlog(formatString(TEST_FAILED_COMPARISON, test.title, err.message, err.stack, err.actual, err.expected, testFlowId));\n\t\t\t}\n\t\t} else{\n\t\t\tif (useStdError) {\n\t\t\t\tlogError(formatString(TEST_FAILED, test.title, err.message, err.stack, testFlowId));\n\t\t\t} else {\n\t\t\t\tlog(formatString(TEST_FAILED, test.title, err.message, err.stack, testFlowId));\n\t\t\t}\n\t\t}\n\t\t// Log testFinished for failed hook (hook end event is not fired for failed hook)\n\t\tif (recordHookFailures && !ignoreHookWithName || recordHookFailures && ignoreHookWithName && !test.title.includes(ignoreHookWithName)) {\n\t\t\tif (isHook) {\n\t\t\t\tif(isNil(test.duration)){\n\t\t\t\t\tlog(formatString(TEST_END_NO_DURATION, test.title, hookFlowId));\n\t\t\t\t} else {\n\t\t\t\t\tlog(formatString(TEST_END, test.title, test.duration.toString(), hookFlowId));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\trunner.on(EVENT_TEST_PENDING, function (test) {\n\t\tlog(formatString(TEST_IGNORED, test.title, test.title, flowId));\n\t\tif (displayIgnoredAsIgnored) ignoredTests[`${test.title}-${flowId}`] = testState.pending;\n\t});\n\n\trunner.on(EVENT_TEST_END, function (test) {\n\t\tif (displayIgnoredAsIgnored && ignoredTests[`${test.title}-${flowId}`] === testState.pending) {\n\t\t\tdelete ignoredTests[`${test.title}-${flowId}`];\n\t\t\treturn;\n\t\t}\n\t\tif(isNil(test.duration)){\n\t\t\tlog(formatString(TEST_END_NO_DURATION, test.title, flowId));\n\t\t} else {\n\t\t\tlog(formatString(TEST_END, test.title, test.duration.toString(), flowId));\n\t\t}\n\t});\n\n\trunner.on(EVENT_HOOK_BEGIN, function (test) {\n\t\tif (recordHookFailures && !ignoreHookWithName || recordHookFailures && ignoreHookWithName && !test.title.includes(ignoreHookWithName)) {\n\t\t\tlog(formatString(TEST_START, test.title, hookFlowId));\n\t\t}\n\t});\n\n\trunner.on(EVENT_HOOK_END, function (test) {\n\t\tif (recordHookFailures && !ignoreHookWithName || recordHookFailures && ignoreHookWithName && !test.title.includes(ignoreHookWithName)) {\n\t\t\tif(isNil(test.duration)){\n\t\t\t\tlog(formatString(TEST_END_NO_DURATION, test.title, hookFlowId));\n\t\t\t} else {\n\t\t\t\tlog(formatString(TEST_END, test.title, test.duration.toString(), hookFlowId));\n\t\t\t}\n\t\t}\n\t});\n\n\trunner.on(EVENT_SUITE_END, function (suite) {\n\t\tif (suite.root) return;\n\t\tlog(formatString(SUITE_END, suite.title, new Date() - suite.startDate, flowId));\n\t});\n\n\trunner.on(EVENT_RUN_END, function () {\n\t\tlet duration;\n\t\t(typeof stats === 'undefined') ? duration = null : duration = stats.duration;\n\t\tif (topLevelSuite) {\n\t\t\tisNil(duration) ? log(formatString(SUITE_END_NO_DURATION, topLevelSuite, flowId)) : log(formatString(SUITE_END, topLevelSuite, duration, flowId));\n\t\t}\n});\n}\n\n\n/**\n * Expose `Teamcity`.\n */\n\nexports = module.exports = Teamcity;\n"]}