/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/jasmine-console-reporter@3.1.0/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";const ci=require("ci-info"),StreamPrinter=require("./lib/StreamPrinter"),StyleFactory=require("./lib/StyleFactory"),TestStats=require("./lib/TestStats"),utils=require("./lib/utils"),INDENT_CHAR=" ",INDENT_UNIT=3;
/**
 *  Jasmine Console Reporter
 *  @author   Onur Yıldırım <onur@cutepilot.com>
 *  @license  MIT
 */
class JasmineConsoleReporter{constructor(t={}){this.options=utils.getOptions(t),ci.isCI&&(this.options.emoji=!1,this.options.beep=!1);const s="string"==typeof t.activity?{spinner:t.activity}:void 0;this.print=new StreamPrinter(s),this.style=StyleFactory.create(this.options),this.stats=new TestStats(this.options),this.verbosity=this.options.verbosity,this._depth=-1,this._isSuiteDone=!1}_specFailureDetails(t,s){this.print.line(this.style.red(s+". "));const i=t.fullName.replace(t.description,": "+t.description);let e,n,h;for(this.print.str(this.style.cyan(i)),e=0;e<t.failedExpectations.length;e++)n=t.failedExpectations[e],n.stack?h=utils.restack(n,this.options.cleanStack,this.style):(h="Error: "+(n.message||"Unknown Error"),h=this.style.red(h)),this.print.line(utils.indent(h,3));this.print.newLine()}_specPendingDetails(t,s){this.print.line(this.style.yellow(s+". "));const i=t.fullName.replace(t.description,": "+t.description);this.print.str(this.style.cyan(i));const e=t.pendingReason?this.style.yellow("Reason: "+t.pendingReason):this.style.gray("(No pending reason)");this.print.line(utils.indent(e,3)),this.print.newLine()}_suiteFailureDetails(t){t.failedExpectations.forEach((t=>{this.print.line(this.style.red(">> An error was thrown in an afterAll"));const s=utils.restack(t,this.options.cleanStack,this.style);this.print.line(utils.indent(s,3))})),this.print.newLine(2)}_finalReport(t){if(this.stats.failedSpecList.length>0&&(this.print.line(this.style.white(this.style.underline("Failed Specs"))+this.style.white(":")),this.print.newLine(),this.stats.failedSpecList.forEach(((t,s)=>{this._specFailureDetails(t,s+1)}))),this.verbosity.pending&&this.stats.pendingSpecList.length>0&&(this.print.line(this.style.white(this.style.underline("Pending Specs"))+this.style.white(":")),this.print.newLine(),this.stats.pendingSpecList.forEach(((t,s)=>{this._specPendingDetails(t,s+1)}))),this.verbosity.summary){if(this.print.line(this.style.white(this.style.underline("Summary")+":")),this.print.newLine(),t&&t.overallStatus){const s=t.overallStatus,i=this.style.fromKeyword(s);this.print.line(this.style.emoji[s+"Status"]+i(utils.capitalize(s))),t.incompleteReason&&this.print.str(this.style.gray(" ("+t.incompleteReason+")"))}if(this.stats.specs.total>0){const t=this.stats.suites.total-this.stats.suites.disabled;this.print.line("Suites:  "+this.style.white(t)+" of "+this.stats.suites.total),this.stats.suites.disabled&&this.print.str(this.style.yellow(" ("+this.stats.suites.disabled+" disabled)")),this.print.line("Specs:   "+this.style.white(this.stats.executedSpecs)+" of "+this.stats.specs.defined);const s=[];let i;this.stats.specs.pending&&s.push(this.stats.specs.pending+" pending"),this.stats.specs.disabled>0&&s.push(this.stats.specs.disabled+" disabled"),this.stats.specs.excluded>0&&s.push(this.stats.specs.excluded+" excluded"),s.length&&this.print.str(this.style.yellow(" ("+s.join(", ")+")"));const e=this.stats.expects.total;if(this.print.line("Expects: "+this.style.white(e)),0===e)i=this.style.yellow(" (none executed)");else{const t=this.stats.expects.failed;i=" ("+t+" "+utils.plural("failure",t)+")",t>0&&(i=this.style.red(i))}this.print.str(i)}this.print.line(this.style.gray("Finished in "+this.stats.elapsed+" "+utils.plural("second",this.stats.elapsed))),this.print.newLine(2)}else this.print.newLine();this.stats.failedSuiteList.forEach((t=>{this._suiteFailureDetails(t)})),this.options.beep&&this.stats.expects.falied>0&&this.print.beep()}jasmineStarted(t){if(this.stats.init(t),this.print.newLine(),0===t.totalSpecsDefined)return this.print.newLine(),void this.print.str(this.style.emoji.noSpecs+this.style.yellow("No specs defined!"));this.print.str("Executing "+t.totalSpecsDefined+" defined specs...");const s=t.order&&t.order.random;this.verbosity.summary&&s&&(this.print.newLine(),this.print.str(this.style.gray("Running in random order... (seed: "+t.order.seed+")"))),this.print.newLine(),this.verbosity.specs&&(this.print.line(this.style.white(this.style.underline("Test Suites & Specs"))+this.style.white(":")),this.print.newLine())}suiteStarted(t){this._depth++,this.stats.addSuite(t);if(!(1===this.stats.suites.total)&&this.verbosity.specs&&this.print.newLine(),this.verbosity.specs){this._depth=this._depth||0;const s="indent"===this.options.listStyle?utils.repeat(" ",3*this._depth):"",i=this.style.cyan(this.stats.suites.total+". "+t.description);this.print.line(s+i)}this._isSuiteDone=!1}suiteDone(t){this.stats.updateSuite(t),this._depth--,this._isSuiteDone=!0}specStarted(t){if(this.stats.addSpec(t),this.verbosity.specs&&this.print.newLine(this._isSuiteDone?2:1),this.options.activity){const s=this.verbosity.specs&&"indent"===this.options.listStyle?utils.repeat(" ",3*(this._depth+1)):"";this.print.spin(s+this.style.gray(t.description))}}specDone(t){if(this.stats.updateSpec(t),this.options.activity&&this.print.spinStop(),this.verbosity.specs){this._depth=this._depth||0;let s="";const i="indent"===this.options.listStyle?utils.repeat(" ",3*(this._depth+1)):"";let e;switch(t.status){case"pending":s=this.style.yellow(this.style.symbol("warning")+" "+t.description);break;case"disabled":case"excluded":if(!this.verbosity.disabled)return this.print.clearLine(2),void this.print.moveCursor(0,-1);s=this.style.gray(this.style.symbol("disabled")+" "+t.description);break;case"failed":{const i=t.failedExpectations.length,n=" ("+i+" "+utils.plural("failure",i)+")";e=this.style.time(t._time.num),s=this.style.red(this.style.symbol("error")+" "+t.description+n)+e(" ("+t._time.str+")");break}case"passed":e=this.style.time(t._time.num),s=this.style.green(this.style.symbol("success")+" "+t.description)+e(" ("+t._time.str+")")}this.print.str(i+s)}}jasmineDone(t){this.stats.done(t),this.print.newLine(),this.stats.specs.defined>0&&(this.verbosity.specs&&this.print.newLine(),this.print.str(this.style.gray(">> Done!")),this.print.newLine(2)),this._finalReport(t)}}module.exports=JasmineConsoleReporter;
//# sourceMappingURL=/sm/778a082068f716a0a24cad1b73537b58e80a4f95e0df79cd65912b933d29aecf.map