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E,EAAI,SAAS,OAAS,GAAgB,GACxC,WAAW,KACT,EACA,WAAW,aACT,EAAI,MACJ,EAAI,QACJ,EAAI,SACJ,EAAI,WACJ,EACA,KACA,EACA,EACA,EACA,EACA,EACA,EACA,GAEF,GAGC,GACH,WAAW,KACT,EACA,WAAW,aACT,EAAI,MACJ,EAAI,QACJ,EAAI,SACJ,EAAI,WACJ,EACA,KACA,EACA,EACA,EACA,EACA,EACA,EACA,GAEF,GA2CN,GAuBJ,CACA,OAAO,QAAU","file":"/npm/newman-reporter-slacknotification@1.3.7/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/newman-reporter-slacknotification@1.3.7/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const { slackUtils } = require('./slackUtils')\r\n\r\nfunction SlackNewmanReporter (emitter, reporterOptions) {\r\n  if (missingReporterOptions(reporterOptions)) {\r\n    return\r\n  }\r\n  const webhookUrl = reporterOptions.webhookurl\r\n  const messageSize = reporterOptions.messageSize || 100\r\n  const collection = reporterOptions.collection || ''\r\n  const environment = reporterOptions.environment || ''\r\n  const token = reporterOptions.token || ''\r\n  const reportingUrl = reporterOptions.reportingurl || ''\r\n  let channel = reporterOptions.channel || ''\r\n  let limitFailures = reporterOptions.limitFailures || null\r\n  const authorName = reporterOptions.authorName || ''\r\n  const onlyFailure = reporterOptions.onlyFailure || false\r\n  const overFailures = reporterOptions.overFailures || 0\r\n  const allExecutions = reporterOptions.allExecutions || false\r\n  let summaryExecutions = []\r\n\r\n  emitter.on('done', (error, summary) => {\r\n    if (error) {\r\n      console.error('error in done')\r\n      return\r\n    }\r\n    let run = summary.run\r\n\r\n    if (!allExecutions) {\r\n      if (run.failures.length > overFailures && onlyFailure) {\r\n        slackUtils.send(\r\n          webhookUrl,\r\n          slackUtils.slackMessage(\r\n            run.stats,\r\n            run.timings,\r\n            run.failures,\r\n            run.executions,\r\n            allExecutions,\r\n            null,\r\n            messageSize,\r\n            collection,\r\n            environment,\r\n            channel,\r\n            reportingUrl,\r\n            limitFailures,\r\n            authorName\r\n          ),\r\n          token\r\n        )\r\n      }\r\n      if (!onlyFailure) {\r\n        slackUtils.send(\r\n          webhookUrl,\r\n          slackUtils.slackMessage(\r\n            run.stats,\r\n            run.timings,\r\n            run.failures,\r\n            run.executions,\r\n            allExecutions,\r\n            null,\r\n            messageSize,\r\n            collection,\r\n            environment,\r\n            channel,\r\n            reportingUrl,\r\n            limitFailures,\r\n            authorName\r\n          ),\r\n          token\r\n        )\r\n      }\r\n    } else {\r\n      run.executions.forEach(execution => {\r\n        if (execution.assertions !== undefined) {\r\n          execution.assertions.forEach(assertion => {\r\n            console.log(assertion)\r\n            const assertionText = assertion.assertion\r\n            if (assertion.error) {\r\n              summaryExecutions.push({\r\n                title: `${assertionText} : Failed :fire:`,\r\n                short: 'false'\r\n              })\r\n            } else {\r\n              summaryExecutions.push({\r\n                title: `${assertionText} : Passed :white_check_mark:`,\r\n                short: 'true'\r\n              })\r\n            }\r\n          });\r\n        }\r\n      })\r\n\r\n      slackUtils.send(\r\n        webhookUrl,\r\n        slackUtils.slackMessage(\r\n          run.stats,\r\n          run.timings,\r\n          run.failures,\r\n          run.executions,\r\n          allExecutions,\r\n          summaryExecutions,\r\n          messageSize,\r\n          collection,\r\n          environment,\r\n          channel,\r\n          reportingUrl,\r\n          limitFailures,\r\n          authorName\r\n        ),\r\n        token\r\n      )\r\n    }\r\n  })\r\n\r\n  function missingReporterOptions (reporterOptions) {\r\n    let missing = false\r\n    if (!reporterOptions.webhookurl) {\r\n      console.error('Missing Slack Webhook Url')\r\n      missing = true\r\n    }\r\n    if (\r\n      reporterOptions.webhookurl === 'https://slack.com/api/chat.postMessage'\r\n    ) {\r\n      if (!reporterOptions.token) {\r\n        console.error('Missing Bearer Token')\r\n        missing = true\r\n      }\r\n      if (!reporterOptions.channel) {\r\n        console.error('Missing channel')\r\n        missing = true\r\n      }\r\n    }\r\n    return missing\r\n  }\r\n}\r\nmodule.exports = SlackNewmanReporter\r\n"]}