(function(t,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("tinyrainbow")):typeof define=="function"&&define.amd?define(["tinyrainbow"],s):(t=typeof globalThis<"u"?globalThis:t||self,t["vitest-tiny-reporter"]=s(t.tinyrainbow))})(this,function(t){"use strict";var T=Object.defineProperty;var y=(t,s,g)=>s in t?T(t,s,{enumerable:!0,configurable:!0,writable:!0,value:g}):t[s]=g;var a=(t,s,g)=>y(t,typeof s!="symbol"?s+"":s,g);function s(n){return n==null&&(n=[]),Array.isArray(n)?n:[n]}function g(n){return n.type==="test"}function h(n){const e=[],d=s(n);for(const i of d)if(g(i))e.push(i);else for(const o of i.tasks)if(g(o))e.push(o);else{const f=h(o);for(const l of f)e.push(l)}return e}class c{constructor(){a(this,"ctx");a(this,"verbose",!1);a(this,"padTitle",e=>t.dim(`${e.padStart(11)} `))}onInit(e){this.ctx=e}onFinished(e=this.ctx.state.getFiles(),d=this.ctx.state.getUnhandledErrors()){const{logger:i}=this.ctx,o=h(e),f=o.filter($=>{var p;return((p=$.result)==null?void 0:p.state)==="fail"}).length,l=!(f+d.length),r=l?"✔ PASS":"✖ FAIL",u=l?t.green:t.red;i.log(`${u(t.bold(t.inverse(` ${r} `)))} ${u(l?"All tests passed":`${f} test${f>1?"s":""} failed`)}`),i.log(this.padTitle("Test Files"),this.getStateString(e)),i.log(this.padTitle("Tests"),this.getStateString(o)),d.length&&i.log(this.padTitle("Errors"),t.bold(t.red(`${d.length} error${d.length>1?"s":""}`))),l||(process.exitCode=1)}getStateString(e,d="tests"){if(!e.length)return t.dim(`no ${d}`);const i=e.filter(r=>{var u;return((u=r.result)==null?void 0:u.state)==="pass"}).length,o=e.filter(r=>{var u;return((u=r.result)==null?void 0:u.state)==="fail"}).length,f=e.filter(r=>r.mode==="skip").length,l=e.filter(r=>r.mode==="todo").length;return[o&&t.bold(t.red(`${o} failed`)),i&&t.bold(t.green(`${i} passed`)),f&&t.yellow(`${f} skipped`),l&&t.gray(`${l} todo`)].filter(Boolean).join(t.dim(" | "))+t.gray(` (${e.length})`)}}return c}); //# sourceMappingURL=vitest-tiny-reporter.umd.cjs.map