vitest-tiny-reporter 1.3.3 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(E,V){typeof exports=="object"&&typeof module<"u"?module.exports=V(require("tinyrainbow")):typeof define=="function"&&define.amd?define(["tinyrainbow"],V):(E=typeof globalThis<"u"?globalThis:E||self,E["vitest-tiny-reporter"]=V(E.tinyrainbow))})(this,(function(E){"use strict";function V(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(r){if(r!=="default"&&!(r in e)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}})}),Object.freeze(e)}function Mn(e,t){const n=Object.keys(e),r=t===null?n:n.sort(t);if(Object.getOwnPropertySymbols)for(const s of Object.getOwnPropertySymbols(e))Object.getOwnPropertyDescriptor(e,s).enumerable&&r.push(s);return r}function ne(e,t,n,r,s,o,i=": "){let u="",c=0,l=e.next();if(!l.done){u+=t.spacingOuter;const f=n+t.indent;for(;!l.done;){if(u+=f,c++===t.maxWidth){u+="…";break}const m=o(l.value[0],t,f,r,s),g=o(l.value[1],t,f,r,s);u+=m+i+g,l=e.next(),l.done?t.min||(u+=","):u+=`,${t.spacingInner}`}u+=t.spacingOuter+n}return u}function Ee(e,t,n,r,s,o){let i="",u=0,c=e.next();if(!c.done){i+=t.spacingOuter;const l=n+t.indent;for(;!c.done;){if(i+=l,u++===t.maxWidth){i+="…";break}i+=o(c.value,t,l,r,s),c=e.next(),c.done?t.min||(i+=","):i+=`,${t.spacingInner}`}i+=t.spacingOuter+n}return i}function re(e,t,n,r,s,o){let i="";e=e instanceof ArrayBuffer?new DataView(e):e;const u=l=>l instanceof DataView,c=u(e)?e.byteLength:e.length;if(c>0){i+=t.spacingOuter;const l=n+t.indent;for(let f=0;f<c;f++){if(i+=l,f===t.maxWidth){i+="…";break}(u(e)||f in e)&&(i+=o(u(e)?e.getInt8(f):e[f],t,l,r,s)),f<c-1?i+=`,${t.spacingInner}`:t.min||(i+=",")}i+=t.spacingOuter+n}return i}function Te(e,t,n,r,s,o){let i="";const u=Mn(e,t.compareKeys);if(u.length>0){i+=t.spacingOuter;const c=n+t.indent;for(let l=0;l<u.length;l++){const f=u[l],m=o(f,t,c,r,s),g=o(e[f],t,c,r,s);i+=`${c+m}: ${g}`,l<u.length-1?i+=`,${t.spacingInner}`:t.min||(i+=",")}i+=t.spacingOuter+n}return i}const Pn=typeof Symbol=="function"&&Symbol.for?Symbol.for("jest.asymmetricMatcher"):1267621,se=" ",jn={serialize:(e,t,n,r,s,o)=>{const i=e.toString();if(i==="ArrayContaining"||i==="ArrayNotContaining")return++r>t.maxDepth?`[${i}]`:`${i+se}[${re(e.sample,t,n,r,s,o)}]`;if(i==="ObjectContaining"||i==="ObjectNotContaining")return++r>t.maxDepth?`[${i}]`:`${i+se}{${Te(e.sample,t,n,r,s,o)}}`;if(i==="StringMatching"||i==="StringNotMatching"||i==="StringContaining"||i==="StringNotContaining")return i+se+o(e.sample,t,n,r,s);if(typeof e.toAsymmetricMatcher!="function")throw new TypeError(`Asymmetric matcher ${e.constructor.name} does not implement toAsymmetricMatcher()`);return e.toAsymmetricMatcher()},test:e=>e&&e.$$typeof===Pn},Fn=" ",qe=new Set(["DOMStringMap","NamedNodeMap"]),Ln=/^(?:HTML\w*Collection|NodeList)$/;function Dn(e){return qe.has(e)||Ln.test(e)}const zn=e=>e&&e.constructor&&!!e.constructor.name&&Dn(e.constructor.name);function vn(e){return e.constructor.name==="NamedNodeMap"}const Un={serialize:(e,t,n,r,s,o)=>{const i=e.constructor.name;return++r>t.maxDepth?`[${i}]`:(t.min?"":i+Fn)+(qe.has(i)?`{${Te(vn(e)?[...e].reduce((u,c)=>(u[c.name]=c.value,u),{}):{...e},t,n,r,s,o)}}`:`[${re([...e],t,n,r,s,o)}]`)},test:zn};function Ye(e){return e.replaceAll("<","<").replaceAll(">",">")}function $e(e,t,n,r,s,o,i){const u=r+n.indent,c=n.colors;return e.map(l=>{const f=t[l];if(typeof f=="string"&&f[0]==="_"&&f.startsWith("__vitest_")&&f.match(/__vitest_\d+__/))return"";let m=i(f,n,u,s,o);return typeof f!="string"&&(m.includes(`
|
|
2
|
+
`)&&(m=n.spacingOuter+u+m+n.spacingOuter+r),m=`{${m}}`),`${n.spacingInner+r+c.prop.open+l+c.prop.close}=${c.value.open}${m}${c.value.close}`}).join("")}function oe(e,t,n,r,s,o){return e.map(i=>t.spacingOuter+n+(typeof i=="string"?He(i,t):o(i,t,n,r,s))).join("")}function Wn(e,t,n,r,s,o){return t.printShadowRoot===!1?"":[`${t.spacingOuter+n}#shadow-root`,oe(e,t,n+t.indent,r,s,o)].join("")}function He(e,t){const n=t.colors.content;return n.open+Ye(e)+n.close}function Vn(e,t){const n=t.colors.comment;return`${n.open}<!--${Ye(e)}-->${n.close}`}function _e(e,t,n,r,s){const o=r.colors.tag;return`${o.open}<${e}${t&&o.close+t+r.spacingOuter+s+o.open}${n?`>${o.close}${n}${r.spacingOuter}${s}${o.open}</${e}`:`${t&&!r.min?"":" "}/`}>${o.close}`}function we(e,t){const n=t.colors.tag;return`${n.open}<${e}${n.close} …${n.open} />${n.close}`}const Kn=1,Ae=3,Ge=8,Je=11,Bn=/^(?:(?:HTML|SVG)\w*)?Element$/;function qn(e){try{return typeof e.hasAttribute=="function"&&e.hasAttribute("is")}catch{return!1}}function Yn(e){const t=e.constructor.name,{nodeType:n,tagName:r}=e,s=typeof r=="string"&&r.includes("-")||qn(e);return n===Kn&&(Bn.test(t)||s)||n===Ae&&t==="Text"||n===Ge&&t==="Comment"||n===Je&&t==="DocumentFragment"}const Xe=e=>e?.constructor?.name&&Yn(e);function Hn(e){return e.nodeType===Ae}function Gn(e){return e.nodeType===Ge}function ie(e){return e.nodeType===Je}function Ze(e,t){let n=e.filter(r=>r.nodeType===Ae?(r.data||"").trim().length>0:!0);return t&&(n=n.filter(t)),n}function Qe(e,t,n,r,s,o,i){if(Hn(e))return He(e.data,t);if(Gn(e))return Vn(e.data,t);const u=ie(e)?"DocumentFragment":e.tagName.toLowerCase();if(++r>t.maxDepth)return we(u,t);const c=Array.prototype.slice.call(e.childNodes||e.children),l=ie(e)||!e.shadowRoot?[]:Array.prototype.slice.call(e.shadowRoot.children),f=i?Ze(c,i):c,m=i?Ze(l,i):l;return _e(u,$e(ie(e)?[]:Array.from(e.attributes,g=>g.name).sort(),ie(e)?{}:[...e.attributes].reduce((g,h)=>(g[h.name]=h.value,g),{}),t,n+t.indent,r,s,o),(m.length>0?Wn(m,t,n+t.indent,r,s,o):"")+oe(f,t,n+t.indent,r,s,o),t,n)}const Jn=(e,t,n,r,s,o)=>Qe(e,t,n,r,s,o);function Xn(e){return{test:Xe,serialize:(t,n,r,s,o,i)=>Qe(t,n,r,s,o,i,e)}}const Zn={serialize:Jn,test:Xe},Qn="@@__IMMUTABLE_ITERABLE__@@",er="@@__IMMUTABLE_LIST__@@",tr="@@__IMMUTABLE_KEYED__@@",nr="@@__IMMUTABLE_MAP__@@",et="@@__IMMUTABLE_ORDERED__@@",rr="@@__IMMUTABLE_RECORD__@@",sr="@@__IMMUTABLE_SEQ__@@",or="@@__IMMUTABLE_SET__@@",ir="@@__IMMUTABLE_STACK__@@",K=e=>`Immutable.${e}`,ce=e=>`[${e}]`,G=" ",tt="…";function cr(e,t,n,r,s,o,i){return++r>t.maxDepth?ce(K(i)):`${K(i)+G}{${ne(e.entries(),t,n,r,s,o)}}`}function ur(e){let t=0;return{next(){if(t<e._keys.length){const n=e._keys[t++];return{done:!1,value:[n,e.get(n)]}}return{done:!0,value:void 0}}}}function ar(e,t,n,r,s,o){const i=K(e._name||"Record");return++r>t.maxDepth?ce(i):`${i+G}{${ne(ur(e),t,n,r,s,o)}}`}function lr(e,t,n,r,s,o){const i=K("Seq");return++r>t.maxDepth?ce(i):e[tr]?`${i+G}{${e._iter||e._object?ne(e.entries(),t,n,r,s,o):tt}}`:`${i+G}[${e._iter||e._array||e._collection||e._iterable?Ee(e.values(),t,n,r,s,o):tt}]`}function Ce(e,t,n,r,s,o,i){return++r>t.maxDepth?ce(K(i)):`${K(i)+G}[${Ee(e.values(),t,n,r,s,o)}]`}const fr={serialize:(e,t,n,r,s,o)=>e[nr]?cr(e,t,n,r,s,o,e[et]?"OrderedMap":"Map"):e[er]?Ce(e,t,n,r,s,o,"List"):e[or]?Ce(e,t,n,r,s,o,e[et]?"OrderedSet":"Set"):e[ir]?Ce(e,t,n,r,s,o,"Stack"):e[sr]?lr(e,t,n,r,s,o):ar(e,t,n,r,s,o),test:e=>e&&(e[Qn]===!0||e[rr]===!0)};function nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xe={exports:{}},S={};var rt;function pr(){if(rt)return S;rt=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),i=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),h=Symbol.for("react.client.reference");function d(a){if(typeof a=="object"&&a!==null){var p=a.$$typeof;switch(p){case e:switch(a=a.type,a){case n:case s:case r:case c:case l:case g:return a;default:switch(a=a&&a.$$typeof,a){case i:case u:case m:case f:return a;case o:return a;default:return p}}case t:return p}}}return S.ContextConsumer=o,S.ContextProvider=i,S.Element=e,S.ForwardRef=u,S.Fragment=n,S.Lazy=m,S.Memo=f,S.Portal=t,S.Profiler=s,S.StrictMode=r,S.Suspense=c,S.SuspenseList=l,S.isContextConsumer=function(a){return d(a)===o},S.isContextProvider=function(a){return d(a)===i},S.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===e},S.isForwardRef=function(a){return d(a)===u},S.isFragment=function(a){return d(a)===n},S.isLazy=function(a){return d(a)===m},S.isMemo=function(a){return d(a)===f},S.isPortal=function(a){return d(a)===t},S.isProfiler=function(a){return d(a)===s},S.isStrictMode=function(a){return d(a)===r},S.isSuspense=function(a){return d(a)===c},S.isSuspenseList=function(a){return d(a)===l},S.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===n||a===s||a===r||a===c||a===l||typeof a=="object"&&a!==null&&(a.$$typeof===m||a.$$typeof===f||a.$$typeof===i||a.$$typeof===o||a.$$typeof===u||a.$$typeof===h||a.getModuleId!==void 0)},S.typeOf=d,S}var st;function mr(){return st||(st=1,xe.exports=pr()),xe.exports}var ot=mr(),dr=nt(ot),hr=V({__proto__:null,default:dr},[ot]),Ie={exports:{}},b={};var it;function gr(){if(it)return b;it=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),i=Symbol.for("react.context"),u=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),d;d=Symbol.for("react.module.reference");function a(p){if(typeof p=="object"&&p!==null){var y=p.$$typeof;switch(y){case e:switch(p=p.type,p){case n:case s:case r:case l:case f:return p;default:switch(p=p&&p.$$typeof,p){case u:case i:case c:case g:case m:case o:return p;default:return y}}case t:return y}}}return b.ContextConsumer=i,b.ContextProvider=o,b.Element=e,b.ForwardRef=c,b.Fragment=n,b.Lazy=g,b.Memo=m,b.Portal=t,b.Profiler=s,b.StrictMode=r,b.Suspense=l,b.SuspenseList=f,b.isAsyncMode=function(){return!1},b.isConcurrentMode=function(){return!1},b.isContextConsumer=function(p){return a(p)===i},b.isContextProvider=function(p){return a(p)===o},b.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},b.isForwardRef=function(p){return a(p)===c},b.isFragment=function(p){return a(p)===n},b.isLazy=function(p){return a(p)===g},b.isMemo=function(p){return a(p)===m},b.isPortal=function(p){return a(p)===t},b.isProfiler=function(p){return a(p)===s},b.isStrictMode=function(p){return a(p)===r},b.isSuspense=function(p){return a(p)===l},b.isSuspenseList=function(p){return a(p)===f},b.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===s||p===r||p===l||p===f||p===h||typeof p=="object"&&p!==null&&(p.$$typeof===g||p.$$typeof===m||p.$$typeof===o||p.$$typeof===i||p.$$typeof===c||p.$$typeof===d||p.getModuleId!==void 0)},b.typeOf=a,b}var ct;function yr(){return ct||(ct=1,Ie.exports=gr()),Ie.exports}var ut=yr(),br=nt(ut),Sr=V({__proto__:null,default:br},[ut]);const z=Object.fromEntries(["isAsyncMode","isConcurrentMode","isContextConsumer","isContextProvider","isElement","isForwardRef","isFragment","isLazy","isMemo","isPortal","isProfiler","isStrictMode","isSuspense","isSuspenseList","isValidElementType"].map(e=>[e,t=>Sr[e](t)||hr[e](t)]));function at(e,t=[]){if(Array.isArray(e))for(const n of e)at(n,t);else e!=null&&e!==!1&&e!==""&&t.push(e);return t}function lt(e){const t=e.type;if(typeof t=="string")return t;if(typeof t=="function")return t.displayName||t.name||"Unknown";if(z.isFragment(e))return"React.Fragment";if(z.isSuspense(e))return"React.Suspense";if(typeof t=="object"&&t!==null){if(z.isContextProvider(e))return"Context.Provider";if(z.isContextConsumer(e))return"Context.Consumer";if(z.isForwardRef(e)){if(t.displayName)return t.displayName;const n=t.render.displayName||t.render.name||"";return n===""?"ForwardRef":`ForwardRef(${n})`}if(z.isMemo(e)){const n=t.displayName||t.type.displayName||t.type.name||"";return n===""?"Memo":`Memo(${n})`}}return"UNDEFINED"}function Er(e){const{props:t}=e;return Object.keys(t).filter(n=>n!=="children"&&t[n]!==void 0).sort()}const Tr={serialize:(e,t,n,r,s,o)=>++r>t.maxDepth?we(lt(e),t):_e(lt(e),$e(Er(e),e.props,t,n+t.indent,r,s,o),oe(at(e.props.children),t,n+t.indent,r,s,o),t,n),test:e=>e!=null&&z.isElement(e)},$r=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.test.json"):245830487;function _r(e){const{props:t}=e;return t?Object.keys(t).filter(n=>t[n]!==void 0).sort():[]}const wr={serialize:(e,t,n,r,s,o)=>++r>t.maxDepth?we(e.type,t):_e(e.type,e.props?$e(_r(e),e.props,t,n+t.indent,r,s,o):"",e.children?oe(e.children,t,n+t.indent,r,s,o):"",t,n),test:e=>e&&e.$$typeof===$r},ft=Object.prototype.toString,Ar=Date.prototype.toISOString,Cr=Error.prototype.toString,pt=RegExp.prototype.toString;function Ne(e){return typeof e.constructor=="function"&&e.constructor.name||"Object"}function xr(e){return typeof window<"u"&&e===window}const Ir=/^Symbol\((.*)\)(.*)$/,Nr=/\n/g;class mt extends Error{constructor(t,n){super(t),this.stack=n,this.name=this.constructor.name}}function Or(e){return e==="[object Array]"||e==="[object ArrayBuffer]"||e==="[object DataView]"||e==="[object Float32Array]"||e==="[object Float64Array]"||e==="[object Int8Array]"||e==="[object Int16Array]"||e==="[object Int32Array]"||e==="[object Uint8Array]"||e==="[object Uint8ClampedArray]"||e==="[object Uint16Array]"||e==="[object Uint32Array]"}function Rr(e){return Object.is(e,-0)?"-0":String(e)}function kr(e){return`${e}n`}function dt(e,t){return t?`[Function ${e.name||"anonymous"}]`:"[Function]"}function ht(e){return String(e).replace(Ir,"Symbol($1)")}function gt(e){return`[${Cr.call(e)}]`}function yt(e,t,n,r){if(e===!0||e===!1)return`${e}`;if(e===void 0)return"undefined";if(e===null)return"null";const s=typeof e;if(s==="number")return Rr(e);if(s==="bigint")return kr(e);if(s==="string")return r?`"${e.replaceAll(/"|\\/g,"\\$&")}"`:`"${e}"`;if(s==="function")return dt(e,t);if(s==="symbol")return ht(e);const o=ft.call(e);return o==="[object WeakMap]"?"WeakMap {}":o==="[object WeakSet]"?"WeakSet {}":o==="[object Function]"||o==="[object GeneratorFunction]"?dt(e,t):o==="[object Symbol]"?ht(e):o==="[object Date]"?Number.isNaN(+e)?"Date { NaN }":Ar.call(e):o==="[object Error]"?gt(e):o==="[object RegExp]"?n?pt.call(e).replaceAll(/[$()*+.?[\\\]^{|}]/g,"\\$&"):pt.call(e):e instanceof Error?gt(e):null}function bt(e,t,n,r,s,o){if(s.includes(e))return"[Circular]";s=[...s],s.push(e);const i=++r>t.maxDepth,u=t.min;if(t.callToJSON&&!i&&e.toJSON&&typeof e.toJSON=="function"&&!o)return j(e.toJSON(),t,n,r,s,!0);const c=ft.call(e);return c==="[object Arguments]"?i?"[Arguments]":`${u?"":"Arguments "}[${re(e,t,n,r,s,j)}]`:Or(c)?i?`[${e.constructor.name}]`:`${u||!t.printBasicPrototype&&e.constructor.name==="Array"?"":`${e.constructor.name} `}[${re(e,t,n,r,s,j)}]`:c==="[object Map]"?i?"[Map]":`Map {${ne(e.entries(),t,n,r,s,j," => ")}}`:c==="[object Set]"?i?"[Set]":`Set {${Ee(e.values(),t,n,r,s,j)}}`:i||xr(e)?`[${Ne(e)}]`:`${u||!t.printBasicPrototype&&Ne(e)==="Object"?"":`${Ne(e)} `}{${Te(e,t,n,r,s,j)}}`}function Mr(e){return e.serialize!=null}function St(e,t,n,r,s,o){let i;try{i=Mr(e)?e.serialize(t,n,r,s,o,j):e.print(t,u=>j(u,n,r,s,o),u=>{const c=r+n.indent;return c+u.replaceAll(Nr,`
|
|
3
|
+
${c}`)},{edgeSpacing:n.spacingOuter,min:n.min,spacing:n.spacingInner},n.colors)}catch(u){throw new mt(u.message,u.stack)}if(typeof i!="string")throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof i}".`);return i}function Et(e,t){for(const n of e)try{if(n.test(t))return n}catch(r){throw new mt(r.message,r.stack)}return null}function j(e,t,n,r,s,o){let i;const u=Et(t.plugins,e);if(u!==null)i=St(u,e,t,n,r,s);else{const c=yt(e,t.printFunctionName,t.escapeRegex,t.escapeString);c!==null?i=c:i=bt(e,t,n,r,s,o)}return t._outputLengthPerDepth[r]??=0,t._outputLengthPerDepth[r]+=i.length,t._outputLengthPerDepth[r]>t.maxOutputLength&&(t.maxDepth=0),i}const Oe={comment:"gray",content:"reset",prop:"yellow",tag:"cyan",value:"green"},Tt=Object.keys(Oe),C={callToJSON:!0,compareKeys:void 0,escapeRegex:!1,escapeString:!0,highlight:!1,indent:2,maxDepth:Number.POSITIVE_INFINITY,maxOutputLength:1e6,maxWidth:Number.POSITIVE_INFINITY,min:!1,plugins:[],printBasicPrototype:!0,printFunctionName:!0,printShadowRoot:!0,theme:Oe};function Pr(e){for(const t of Object.keys(e))if(!Object.hasOwn(C,t))throw new Error(`pretty-format: Unknown option "${t}".`);if(e.min&&e.indent!==void 0&&e.indent!==0)throw new Error('pretty-format: Options "min" and "indent" cannot be used together.')}function jr(){return Tt.reduce((e,t)=>{const n=Oe[t],r=n&&E[n];if(r&&typeof r.close=="string"&&typeof r.open=="string")e[t]=r;else throw new Error(`pretty-format: Option "theme" has a key "${t}" whose value "${n}" is undefined in ansi-styles.`);return e},Object.create(null))}function Fr(){return Tt.reduce((e,t)=>(e[t]={close:"",open:""},e),Object.create(null))}function $t(e){return e?.printFunctionName??C.printFunctionName}function _t(e){return e?.escapeRegex??C.escapeRegex}function wt(e){return e?.escapeString??C.escapeString}function At(e){return{callToJSON:e?.callToJSON??C.callToJSON,colors:e?.highlight?jr():Fr(),compareKeys:typeof e?.compareKeys=="function"||e?.compareKeys===null?e.compareKeys:C.compareKeys,escapeRegex:_t(e),escapeString:wt(e),indent:e?.min?"":Lr(e?.indent??C.indent),maxDepth:e?.maxDepth??C.maxDepth,maxWidth:e?.maxWidth??C.maxWidth,min:e?.min??C.min,plugins:e?.plugins??C.plugins,printBasicPrototype:e?.printBasicPrototype??!0,printFunctionName:$t(e),printShadowRoot:e?.printShadowRoot??!0,spacingInner:e?.min?" ":`
|
|
4
|
+
`,spacingOuter:e?.min?"":`
|
|
5
|
+
`,maxOutputLength:e?.maxOutputLength??C.maxOutputLength,_outputLengthPerDepth:[]}}function Lr(e){return Array.from({length:e+1}).join(" ")}function Ct(e,t){if(t&&(Pr(t),t.plugins)){const r=Et(t.plugins,e);if(r!==null)return St(r,e,At(t),"",0,[])}const n=yt(e,$t(t),_t(t),wt(t));return n!==null?n:bt(e,At(t),"",0,[])}const Dr={AsymmetricMatcher:jn,DOMCollection:Un,DOMElement:Zn,Immutable:fr,ReactElement:Tr,ReactTestComponent:wr},xt={bold:["1","22"],dim:["2","22"],italic:["3","23"],underline:["4","24"],inverse:["7","27"],hidden:["8","28"],strike:["9","29"],black:["30","39"],red:["31","39"],green:["32","39"],yellow:["33","39"],blue:["34","39"],magenta:["35","39"],cyan:["36","39"],white:["37","39"],brightblack:["30;1","39"],brightred:["31;1","39"],brightgreen:["32;1","39"],brightyellow:["33;1","39"],brightblue:["34;1","39"],brightmagenta:["35;1","39"],brightcyan:["36;1","39"],brightwhite:["37;1","39"],grey:["90","39"]},zr={special:"cyan",number:"yellow",bigint:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",symbol:"green",date:"magenta",regexp:"red"},B="…";function vr(e,t){const n=xt[zr[t]]||xt[t]||"";return n?`\x1B[${n[0]}m${String(e)}\x1B[${n[1]}m`:String(e)}function Ur({showHidden:e=!1,depth:t=2,colors:n=!1,customInspect:r=!0,showProxy:s=!1,maxArrayLength:o=1/0,breakLength:i=1/0,seen:u=[],truncate:c=1/0,stylize:l=String}={},f){const m={showHidden:!!e,depth:Number(t),colors:!!n,customInspect:!!r,showProxy:!!s,maxArrayLength:Number(o),breakLength:Number(i),truncate:Number(c),seen:u,inspect:f,stylize:l};return m.colors&&(m.stylize=vr),m}function Wr(e){return e>="\uD800"&&e<="\uDBFF"}function F(e,t,n=B){e=String(e);const r=n.length,s=e.length;if(r>t&&s>r)return n;if(s>t&&s>r){let o=t-r;return o>0&&Wr(e[o-1])&&(o=o-1),`${e.slice(0,o)}${n}`}return e}function N(e,t,n,r=", "){n=n||t.inspect;const s=e.length;if(s===0)return"";const o=t.truncate;let i="",u="",c="";for(let l=0;l<s;l+=1){const f=l+1===e.length,m=l+2===e.length;c=`${B}(${e.length-l})`;const g=e[l];t.truncate=o-i.length-(f?0:r.length);const h=u||n(g,t)+(f?"":r),d=i.length+h.length,a=d+c.length;if(f&&d>o&&i.length+c.length<=o||!f&&!m&&a>o||(u=f?"":n(e[l+1],t)+(m?"":r),!f&&m&&a>o&&d+u.length>o))break;if(i+=h,!f&&!m&&d+u.length>=o){c=`${B}(${e.length-l-1})`;break}c=""}return`${i}${c}`}function Vr(e){return e.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)?e:JSON.stringify(e).replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'")}function J([e,t],n){return n.truncate-=2,typeof e=="string"?e=Vr(e):typeof e!="number"&&(e=`[${n.inspect(e,n)}]`),n.truncate-=e.length,t=n.inspect(t,n),`${e}: ${t}`}function Kr(e,t){const n=Object.keys(e).slice(e.length);if(!e.length&&!n.length)return"[]";t.truncate-=4;const r=N(e,t);t.truncate-=r.length;let s="";return n.length&&(s=N(n.map(o=>[o,e[o]]),t,J)),`[ ${r}${s?`, ${s}`:""} ]`}const Br=e=>typeof Buffer=="function"&&e instanceof Buffer?"Buffer":e[Symbol.toStringTag]?e[Symbol.toStringTag]:e.constructor.name;function M(e,t){const n=Br(e);t.truncate-=n.length+4;const r=Object.keys(e).slice(e.length);if(!e.length&&!r.length)return`${n}[]`;let s="";for(let i=0;i<e.length;i++){const u=`${t.stylize(F(e[i],t.truncate),"number")}${i===e.length-1?"":", "}`;if(t.truncate-=u.length,e[i]!==e.length&&t.truncate<=3){s+=`${B}(${e.length-e[i]+1})`;break}s+=u}let o="";return r.length&&(o=N(r.map(i=>[i,e[i]]),t,J)),`${n}[ ${s}${o?`, ${o}`:""} ]`}function qr(e,t){const n=e.toJSON();if(n===null)return"Invalid Date";const r=n.split("T"),s=r[0];return t.stylize(`${s}T${F(r[1],t.truncate-s.length-1)}`,"date")}function It(e,t){const n=e[Symbol.toStringTag]||"Function",r=e.name;return r?t.stylize(`[${n} ${F(r,t.truncate-11)}]`,"special"):t.stylize(`[${n}]`,"special")}function Yr([e,t],n){return n.truncate-=4,e=n.inspect(e,n),n.truncate-=e.length,t=n.inspect(t,n),`${e} => ${t}`}function Hr(e){const t=[];return e.forEach((n,r)=>{t.push([r,n])}),t}function Gr(e,t){return e.size===0?"Map{}":(t.truncate-=7,`Map{ ${N(Hr(e),t,Yr)} }`)}const Jr=Number.isNaN||(e=>e!==e);function Nt(e,t){return Jr(e)?t.stylize("NaN","number"):e===1/0?t.stylize("Infinity","number"):e===-1/0?t.stylize("-Infinity","number"):e===0?t.stylize(1/e===1/0?"+0":"-0","number"):t.stylize(F(String(e),t.truncate),"number")}function Ot(e,t){let n=F(e.toString(),t.truncate-1);return n!==B&&(n+="n"),t.stylize(n,"bigint")}function Xr(e,t){const n=e.toString().split("/")[2],r=t.truncate-(2+n.length),s=e.source;return t.stylize(`/${F(s,r)}/${n}`,"regexp")}function Zr(e){const t=[];return e.forEach(n=>{t.push(n)}),t}function Qr(e,t){return e.size===0?"Set{}":(t.truncate-=7,`Set{ ${N(Zr(e),t)} }`)}const Rt=new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]","g"),es={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","'":"\\'","\\":"\\\\"},ts=16;function ns(e){return es[e]||`\\u${`0000${e.charCodeAt(0).toString(ts)}`.slice(-4)}`}function kt(e,t){return Rt.test(e)&&(e=e.replace(Rt,ns)),t.stylize(`'${F(e,t.truncate-2)}'`,"string")}function Mt(e){return"description"in Symbol.prototype?e.description?`Symbol(${e.description})`:"Symbol()":e.toString()}const rs=()=>"Promise{…}";function ue(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[];if(n.length===0&&r.length===0)return"{}";if(t.truncate-=4,t.seen=t.seen||[],t.seen.includes(e))return"[Circular]";t.seen.push(e);const s=N(n.map(u=>[u,e[u]]),t,J),o=N(r.map(u=>[u,e[u]]),t,J);t.seen.pop();let i="";return s&&o&&(i=", "),`{ ${s}${i}${o} }`}const Re=typeof Symbol<"u"&&Symbol.toStringTag?Symbol.toStringTag:!1;function ss(e,t){let n="";return Re&&Re in e&&(n=e[Re]),n=n||e.constructor.name,(!n||n==="_class")&&(n="<Anonymous Class>"),t.truncate-=n.length,`${n}${ue(e,t)}`}function os(e,t){return e.length===0?"Arguments[]":(t.truncate-=13,`Arguments[ ${N(e,t)} ]`)}const is=["stack","line","column","name","message","fileName","lineNumber","columnNumber","number","description","cause"];function cs(e,t){const n=Object.getOwnPropertyNames(e).filter(i=>is.indexOf(i)===-1),r=e.name;t.truncate-=r.length;let s="";if(typeof e.message=="string"?s=F(e.message,t.truncate):n.unshift("message"),s=s?`: ${s}`:"",t.truncate-=s.length+5,t.seen=t.seen||[],t.seen.includes(e))return"[Circular]";t.seen.push(e);const o=N(n.map(i=>[i,e[i]]),t,J);return`${r}${s}${o?` { ${o} }`:""}`}function us([e,t],n){return n.truncate-=3,t?`${n.stylize(String(e),"yellow")}=${n.stylize(`"${t}"`,"string")}`:`${n.stylize(String(e),"yellow")}`}function ke(e,t){return N(e,t,as,`
|
|
6
|
+
`)}function as(e,t){switch(e.nodeType){case 1:return Pt(e,t);case 3:return t.inspect(e.data,t);default:return t.inspect(e,t)}}function Pt(e,t){const n=e.getAttributeNames(),r=e.tagName.toLowerCase(),s=t.stylize(`<${r}`,"special"),o=t.stylize(">","special"),i=t.stylize(`</${r}>`,"special");t.truncate-=r.length*2+5;let u="";n.length>0&&(u+=" ",u+=N(n.map(f=>[f,e.getAttribute(f)]),t,us," ")),t.truncate-=u.length;const c=t.truncate;let l=ke(e.children,t);return l&&l.length>c&&(l=`${B}(${e.children.length})`),`${s}${u}${o}${l}${i}`}const Me=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("chai/inspect"):"@@chai/inspect",Pe=Symbol.for("nodejs.util.inspect.custom"),jt=new WeakMap,Ft={},Lt={undefined:(e,t)=>t.stylize("undefined","undefined"),null:(e,t)=>t.stylize("null","null"),boolean:(e,t)=>t.stylize(String(e),"boolean"),Boolean:(e,t)=>t.stylize(String(e),"boolean"),number:Nt,Number:Nt,bigint:Ot,BigInt:Ot,string:kt,String:kt,function:It,Function:It,symbol:Mt,Symbol:Mt,Array:Kr,Date:qr,Map:Gr,Set:Qr,RegExp:Xr,Promise:rs,WeakSet:(e,t)=>t.stylize("WeakSet{…}","special"),WeakMap:(e,t)=>t.stylize("WeakMap{…}","special"),Arguments:os,Int8Array:M,Uint8Array:M,Uint8ClampedArray:M,Int16Array:M,Uint16Array:M,Int32Array:M,Uint32Array:M,Float32Array:M,Float64Array:M,Generator:()=>"",DataView:()=>"",ArrayBuffer:()=>"",Error:cs,HTMLCollection:ke,NodeList:ke},ls=(e,t,n,r)=>Me in e&&typeof e[Me]=="function"?e[Me](t):Pe in e&&typeof e[Pe]=="function"?e[Pe](t.depth,t,r):"inspect"in e&&typeof e.inspect=="function"?e.inspect(t.depth,t):"constructor"in e&&jt.has(e.constructor)?jt.get(e.constructor)(e,t):Ft[n]?Ft[n](e,t):"",fs=Object.prototype.toString;function ae(e,t={}){const n=Ur(t,ae),{customInspect:r}=n;let s=e===null?"null":typeof e;if(s==="object"&&(s=fs.call(e).slice(8,-1)),s in Lt)return Lt[s](e,n);if(r&&e){const i=ls(e,n,s,ae);if(i)return typeof i=="string"?i:ae(i,n)}const o=e?Object.getPrototypeOf(e):!1;return o===Object.prototype||o===null?ue(e,n):e&&typeof HTMLElement=="function"&&e instanceof HTMLElement?Pt(e,n):"constructor"in e?e.constructor!==Object?ss(e,n):ue(e,n):e===Object(e)?ue(e,n):n.stylize(String(e),s)}const{AsymmetricMatcher:Dt,DOMCollection:zt,DOMElement:ps,Immutable:vt,ReactElement:Ut,ReactTestComponent:Wt}=Dr,ms=[Wt,Ut,ps,zt,vt,Dt];function Vt(e,t=10,{maxLength:n,filterNode:r,...s}={}){const o=n??1e4;let i;const u=typeof r=="string"?ds(r):r,c=u?[Wt,Ut,Xn(u),zt,vt,Dt]:ms;try{i=Ct(e,{maxDepth:t,escapeString:!1,plugins:c,...s})}catch{i=Ct(e,{callToJSON:!1,maxDepth:t,escapeString:!1,plugins:c,...s})}return i.length>=o&&t>1?Vt(e,Math.floor(Math.min(t,Number.MAX_SAFE_INTEGER)/2),{maxLength:n,filterNode:r,...s}):i}function ds(e){return r=>{if(r.nodeType===8)return!1;if(r.nodeType===1&&r.matches)try{return!r.matches(e)}catch{return!0}return!0}}const Kt=/%[sdjifoOc%]/g;function hs(e,t={}){const n=(u,c)=>t.prettifyObject?Vt(u,void 0,{printBasicPrototype:!1,escapeString:!1}):Bt(u,c);if(typeof e[0]!="string"){const u=[];for(let c=0;c<e.length;c++)u.push(n(e[c],{depth:0,colors:!1}));return u.join(" ")}const r=e.length;let s=1;const o=e[0];let i=String(o).replace(Kt,u=>{if(u==="%%")return"%";if(s>=r)return u;switch(u){case"%s":{const c=e[s++];return typeof c=="bigint"?`${c.toString()}n`:typeof c=="number"&&c===0&&1/c<0?"-0":typeof c=="object"&&c!==null?typeof c.toString=="function"&&c.toString!==Object.prototype.toString?c.toString():n(c,{depth:0,colors:!1}):String(c)}case"%d":{const c=e[s++];return typeof c=="bigint"?`${c.toString()}n`:typeof c=="symbol"?"NaN":Number(c).toString()}case"%i":{const c=e[s++];return typeof c=="bigint"?`${c.toString()}n`:Number.parseInt(String(c)).toString()}case"%f":return Number.parseFloat(String(e[s++])).toString();case"%o":return n(e[s++],{showHidden:!0,showProxy:!0});case"%O":return n(e[s++]);case"%c":return s++,"";case"%j":try{return JSON.stringify(e[s++])}catch(c){const l=c.message;if(l.includes("circular structure")||l.includes("cyclic structures")||l.includes("cyclic object"))return"[Circular]";throw c}default:return u}});for(let u=e[s];s<r;u=e[++s])u===null||typeof u!="object"?i+=` ${typeof u=="symbol"?u.toString():u}`:i+=` ${n(u)}`;return i}function gs(...e){return hs(e)}function Bt(e,t={}){return t.truncate===0&&(t.truncate=Number.POSITIVE_INFINITY),ae(e,t)}function ys(e,t={}){typeof t.truncate>"u"&&(t.truncate=40);const n=Bt(e,t),r=Object.prototype.toString.call(e);if(t.truncate&&n.length>=t.truncate)if(r==="[object Function]"){const s=e;return s.name?`[Function: ${s.name}]`:"[Function]"}else{if(r==="[object Array]")return`[ Array(${e.length}) ]`;if(r==="[object Object]"){const s=Object.keys(e);return`{ Object (${s.length>2?`${s.splice(0,2).join(", ")}, ...`:s.join(", ")}) }`}else return n}return n}function q(e,t,n){const r=typeof e;if(!n.includes(r))throw new TypeError(`${t} value must be ${n.join(" or ")}, received "${r}"`)}function bs(e){const t=[];let n="none";for(let r=0;r<e.length;++r)n==="singleline"?e[r]===`
|
|
7
|
+
`&&(n="none"):n==="multiline"?e[r-1]==="*"&&e[r]==="/"&&(n="none"):n==="none"&&(e[r]==="/"&&e[r+1]==="/"?n="singleline":e[r]==="/"&&e[r+1]==="*"?(n="multiline",r+=2):t.push(e[r]));return t.join("")}function X(e){return e==null&&(e=[]),Array.isArray(e)?e:[e]}function qt(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Yt(e,t,n=void 0){const r=t.replace(/\[(\d+)\]/g,".$1").split(".");let s=e;for(const o of r)if(s=new Object(s)[o],s===void 0)return n;return s}function Ht(){let e=null,t=null;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n}function Ss(e){if(!Number.isNaN(e))return!1;const t=new Float64Array(1);return t[0]=e,new Uint32Array(t.buffer)[1]>>>31===1}function Gt(e){const t=e%10,n=e%100;return t===1&&n!==11?`${e}st`:t===2&&n!==12?`${e}nd`:t===3&&n!==13?`${e}rd`:`${e}th`}function Jt(e){return Array.from(new Set(e))}const Xt=Symbol("vitest:SAFE_TIMERS");function Zt(){const{setTimeout:e,setInterval:t,clearInterval:n,clearTimeout:r,setImmediate:s,clearImmediate:o,queueMicrotask:i}=globalThis[Xt]||globalThis,{nextTick:u}=globalThis[Xt]||globalThis.process||{};return{nextTick:u,setTimeout:e,setInterval:t,clearInterval:n,clearTimeout:r,setImmediate:s,clearImmediate:o,queueMicrotask:i}}const Es=/^[A-Za-z]:\//;function Ts(e=""){return e&&e.replace(/\\/g,"/").replace(Es,t=>t.toUpperCase())}const $s=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;function _s(){return typeof process<"u"&&typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}const ws=function(...e){e=e.map(r=>Ts(r));let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){const s=r>=0?e[r]:_s();!s||s.length===0||(t=`${s}/${t}`,n=Qt(s))}return t=As(t,!n),n&&!Qt(t)?`/${t}`:t.length>0?t:"."};function As(e,t){let n="",r=0,s=-1,o=0,i=null;for(let u=0;u<=e.length;++u){if(u<e.length)i=e[u];else{if(i==="/")break;i="/"}if(i==="/"){if(!(s===u-1||o===1))if(o===2){if(n.length<2||r!==2||n[n.length-1]!=="."||n[n.length-2]!=="."){if(n.length>2){const c=n.lastIndexOf("/");c===-1?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=u,o=0;continue}else if(n.length>0){n="",r=0,s=u,o=0;continue}}t&&(n+=n.length>0?"/..":"..",r=2)}else n.length>0?n+=`/${e.slice(s+1,u)}`:n=e.slice(s+1,u),r=u-s-1;s=u,o=0}else i==="."&&o!==-1?++o:o=-1}return n}const Qt=function(e){return $s.test(e)};var en="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cs=new Uint8Array(64),xs=new Uint8Array(128);for(let e=0;e<en.length;e++){const t=en.charCodeAt(e);Cs[e]=t,xs[t]=e}const tn=/^\s*at .*(?:\S:\d+|\(native\))/m,Is=/^(?:eval@)?(?:\[native code\])?$/,Ns=Date.now().toString().length,Os=new RegExp(`vitest=\\d{${Ns}}`);function nn(e){if(!e.includes(":"))return[e];const n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/^\(|\)$/g,""));if(!n)return[e];let r=n[1];if(r.startsWith("async ")&&(r=r.slice(6)),r.startsWith("http:")||r.startsWith("https:")){const s=new URL(r);s.searchParams.delete("import"),s.searchParams.delete("browserv"),r=s.pathname+s.hash+s.search}if(r.startsWith("/@fs/")){const s=/^\/@fs\/[a-zA-Z]:\//.test(r);r=r.slice(s?5:4)}return r.includes("vitest=")&&(r=r.replace(Os,"").replace(/[?&]$/,"")),[r,n[2]||void 0,n[3]||void 0]}function Rs(e){let t=e.trim();if(Is.test(t)||(t.includes(" > eval")&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!t.includes("@")))return null;let n=-1,r="",s;for(let c=0;c<t.length;c++)if(t[c]==="@"){const l=t.slice(c+1);if(l.includes(":")&&l.length>=3){n=c,r=l,s=c>0?t.slice(0,c):void 0;break}}if(n===-1||!r.includes(":")||r.length<3)return null;const[o,i,u]=nn(r);return!o||!i||!u?null:{file:o,method:s||"",line:Number.parseInt(i),column:Number.parseInt(u)}}function ks(e){const t=e.trim();return tn.test(t)?Ms(t):Rs(t)}function Ms(e){let t=e.trim();if(!tn.test(t))return null;t.includes("(eval ")&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let n=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,"");const r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],""):n;const[s,o,i]=nn(r?r[1]:n);let u=r&&n||"",c=s&&["eval","<anonymous>"].includes(s)?void 0:s;return!c||!o||!i?null:(u.startsWith("async ")&&(u=u.slice(6)),c.startsWith("file://")&&(c=c.slice(7)),c=c.startsWith("node:")||c.startsWith("internal:")?c:ws(c),u&&(u=u.replace(/\(0\s?,\s?__vite_ssr_import_\d+__.(\w+)\)/g,"$1").replace(/__(vite_ssr_import|vi_import)_\d+__\./g,"").replace(/(Object\.)?__vite_ssr_export_default__\s?/g,"")),{method:u,file:c,line:Number.parseInt(o),column:Number.parseInt(i)})}class Ps extends Error{code="VITEST_PENDING";taskId;constructor(t,n,r){super(t),this.message=t,this.note=r,this.taskId=n.id}}class L extends Error{name="FixtureDependencyError"}class js extends Error{name="FixtureAccessError"}class rn extends Error{name="FixtureParseError"}const Fs=new WeakMap,sn=new WeakMap,on=new WeakMap;function Ls(e,t){Fs.set(e,t)}function Ds(e,t){sn.set(e,t)}function zs(e){return sn.get(e)}function vs(e,t){on.set(e,t)}function Us(e){return on.get(e)}const le=Symbol.for("VITEST_FIXTURE_STACK_TRACE");class T{_suiteContexts;_overrides=new WeakMap;_registrations;static _definitions=[];static _builtinFixtures=["task","signal","onTestFailed","onTestFinished","skip","annotate"];static _fixtureOptionKeys=["auto","injected","scope"];static _fixtureScopes=["test","file","worker"];static _workerContextSuite={type:"worker"};static clearDefinitions(){T._definitions.length=0}static getWorkerContexts(){return T._definitions.map(t=>t.getWorkerContext())}static getFileContexts(t){return T._definitions.map(n=>n.getFileContext(t))}static isFixtureOptions(t){return qt(t)&&Object.keys(t).some(n=>T._fixtureOptionKeys.includes(n))}constructor(t){this._registrations=t??new Map,this._suiteContexts=new WeakMap,T._definitions.push(this)}extend(t,n){const{suite:r}=O(),s=!r||r.file===r,o=this.parseUserFixtures(t,n,s);return new T(o)}get(t){let n=t;for(;n;){const r=this._overrides.get(n);if(r)return r;if(n===n.file)break;n=n.suite||n.file}return this._registrations}override(t,n){const{suite:r,file:s}=O(),o=r||s,i=!r||r.file===r,u=new Map(this.get(o)),c=this.parseUserFixtures(t,n,i,u);i?this._registrations=c:this._overrides.set(o,c)}getFileContext(t){return this._suiteContexts.has(t)||this._suiteContexts.set(t,Object.create(null)),this._suiteContexts.get(t)}getWorkerContext(){return this._suiteContexts.has(T._workerContextSuite)||this._suiteContexts.set(T._workerContextSuite,Object.create(null)),this._suiteContexts.get(T._workerContextSuite)}parseUserFixtures(t,n,r,s=new Map(this._registrations)){const o=[];Object.entries(n).forEach(([i,u])=>{let c,l,f;Array.isArray(u)&&u.length>=2&&T.isFixtureOptions(u[1])?(f=u[1],c={auto:f.auto??!1,scope:f.scope??"test",injected:f.injected??!1},l=c.injected?t.injectValue?.(i)??u[0]:u[0]):l=u;const m=s.get(i);m&&c?(m.scope!==c.scope&&o.push(new L(`The "${i}" fixture was already registered with a "${c.scope}" scope.`)),m.auto!==c.auto&&o.push(new L(`The "${i}" fixture was already registered as { auto: ${c.auto} }.`))):m?c={auto:m.auto,scope:m.scope,injected:m.injected}:c||(c={auto:!1,injected:!1,scope:"test"}),c.scope&&!T._fixtureScopes.includes(c.scope)&&o.push(new L(`The "${i}" fixture has unknown scope "${c.scope}".`)),!r&&c.scope!=="test"&&o.push(new L(`The "${i}" fixture cannot be defined with a ${c.scope} scope${!f?.scope&&m?.scope?" (inherited from the base fixture)":""} inside the describe block. Define it at the top level of the file instead.`));const g=Q(l)?De(l):new Set,h={name:i,value:l,auto:c.auto??!1,injected:c.injected??!1,scope:c.scope??"test",deps:g,parent:m};Q(l)&&Object.assign(l,{[le]:new Error("STACK_TRACE_ERROR")}),s.set(i,h),h.scope==="worker"&&(t.pool==="vmThreads"||t.pool==="vmForks")&&(h.scope="file")});for(const i of s.values())for(const u of i.deps){if(T._builtinFixtures.includes(u))continue;const c=s.get(u);if(!c){o.push(new L(`The "${i.name}" fixture depends on unknown fixture "${u}".`));continue}if(u===i.name&&!i.parent){o.push(new L(`The "${i.name}" fixture depends on itself, but does not have a base implementation.`));continue}if(T._fixtureScopes.indexOf(i.scope)>T._fixtureScopes.indexOf(c.scope)){o.push(new L(`The ${i.scope} "${i.name}" fixture cannot depend on a ${c.scope} fixture "${c.name}".`));continue}}if(o.length===1)throw o[0];if(o.length>1)throw new AggregateError(o,"Cannot resolve user fixtures. See errors for more information.");return s}}const Y=new WeakMap,je=new WeakMap;function Z(e,t){const n=O(),r=t?.suite||n.suite||n.file;return async s=>{const o=s||t?.context;if(!o)return t?.suiteHook&&Bs(e,t.suiteHook,t.stackTraceError),e({});const i=t?.fixtures||zs(o);if(!i)return e(o);const u=i.get(r);if(!u.size)return e(o);const c=[],l=De(e);for(const h of u.values())(Ws(h,t)||l.has(h.name))&&c.push(h);if(!c.length)return e(o);Y.has(o)||Y.set(o,[]);const f=Y.get(o),m=un(c,u);if(!m.length)return e(o);if(t?.suiteHook){const h=m.filter(d=>d.scope==="test");if(h.length>0){const d=h.map(y=>`"${y.name}"`).join(", "),a={aroundAll:"aroundEach",beforeAll:"beforeEach",afterAll:"afterEach"},p=new L(`Test-scoped fixtures cannot be used inside ${t.suiteHook} hook. The following fixtures are test-scoped: ${d}. Use { scope: 'file' } or { scope: 'worker' } fixtures instead, or move the logic to ${a[t.suiteHook]} hook.`);throw t.stackTraceError?.stack&&(p.stack=p.message+t.stackTraceError.stack.replace(t.stackTraceError.message,"")),p}}je.has(o)||je.set(o,new WeakSet);const g=je.get(o);for(const h of m)if(h.scope==="test"){if(g.has(h))continue;g.add(h);const d=await Vs(h,o,f);o[h.name]=d,f.push(()=>{g.delete(h)})}else{const d=await Ks(i,r,h);o[h.name]=d}return e(o)}}function Ws(e,t){return!(!e.auto||t?.suiteHook&&e.scope==="test")}function Q(e){return typeof e=="function"}function Vs(e,t,n){return Q(e.value)?cn(e.value,e.name,t,n):e.value}const fe=new WeakMap;async function Ks(e,t,n){const r=e.getWorkerContext(),s=e.getFileContext(t.file),o=n.scope==="worker"?r:s;if(!Q(n.value))return o[n.name]=n.value,n.value;if(n.name in o)return o[n.name];if(fe.has(n))return fe.get(n);Y.has(o)||Y.set(o,[]);const i=Y.get(o),u=cn(n.value,n.name,n.scope==="file"?{...r,...s}:o,i).then(c=>(o[n.name]=c,fe.delete(n),c));return fe.set(n,u),u}async function cn(e,t,n,r){const s=Ht(),o=le in e&&e[le]instanceof Error?e[le]:void 0;let i=!1;const u=e(n,async c=>{i=!0,s.resolve(c);const l=Ht();r.push(async()=>{l.resolve(),await u}),await l}).then(()=>{if(!i){const c=new Error(`Fixture "${t}" returned without calling "use". Make sure to call "use" in every code path of the fixture function.`);o?.stack&&(c.stack=c.message+o.stack.replace(o.message,"")),s.reject(c)}}).catch(c=>{if(!i){s.reject(c);return}throw c});return s}function un(e,t,n=new Set,r=[]){return e.forEach(s=>{if(!r.includes(s)){if(!Q(s.value)||!s.deps){r.push(s);return}if(n.has(s))if(s.parent)s=s.parent;else throw new Error(`Circular fixture dependency detected: ${s.name} <- ${[...n].reverse().map(o=>o.name).join(" <- ")}`);n.add(s),un([...s.deps].map(o=>o===s.name?s.parent:t.get(o)).filter(o=>!!o),t,n,r),r.push(s),n.clear()}}),r}function Bs(e,t,n){const r=De(e,{sourceError:n,suiteHook:t});if(r.size){const s=new js(`The ${t} hook uses fixtures "${[...r].join('", "')}", but has no access to context. Did you forget to call it as "test.${t}()" instead of "${t}()"?
|
|
8
|
+
If you used internal "suite" task as the first argument previously, access it in the second argument instead. See https://vitest.dev/guide/test-context#suite-level-hooks`);throw n&&(s.stack=n.stack?.replace(n.message,s.message)),s}}const Fe=Symbol("$vitest:fixture-props"),Le=Symbol("$vitest:fixture-prop-names");function pe(e,t){Object.defineProperty(e,Fe,{value:t,enumerable:!1})}function me(e,t){return e[Le]=t,t}function De(e,{sourceError:t,suiteHook:n}={}){if(Le in e)return e[Le];const{index:r=0,original:s=e}=Fe in e?e[Fe]:{};let o=bs(s.toString());/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(o)&&(o=o.split(/__async\((?:this|null),/)[1]);const i=o.match(/[^(]*\(([^)]*)/);if(!i)return me(e,new Set);const u=an(i[1]);if(!u.length)return me(e,new Set);const c=u[r];if(!c)return me(e,new Set);if(!(c[0]==="{"&&c.endsWith("}"))){const g=Gt(r+1),h=new rn(`The ${g} argument inside a fixture must use object destructuring pattern, e.g. ({ task } => {}). Instead, received "${c}".${n?` If you used internal "suite" task as the ${g} argument previously, access it in the ${Gt(r+2)} argument instead.`:""}`);throw t&&(h.stack=t.stack?.replace(t.message,h.message)),h}const l=c.slice(1,-1).replace(/\s/g,""),f=an(l).map(g=>g.replace(/:.*|=.*/g,"")),m=f.at(-1);if(m&&m.startsWith("...")){const g=new rn(`Rest parameters are not supported in fixtures, received "${m}".`);throw t&&(g.stack=t.stack?.replace(t.message,g.message)),g}return me(e,new Set(f))}function an(e){const t=[],n=[];let r=0;for(let o=0;o<e.length;o++)if(e[o]==="{"||e[o]==="[")n.push(e[o]==="{"?"}":"]");else if(e[o]===n.at(-1))n.pop();else if(!n.length&&e[o]===","){const i=e.substring(r,o).trim();i&&t.push(i),r=o+1}const s=e.substring(r).trim();return s&&t.push(s),t}const ln=Symbol("kChainableContext");function P(e){return e?.[ln]}function fn(e,t,n){function r(o){const i=function(...u){return t.apply(o,u)};Object.assign(i,t),Object.defineProperty(i,ln,{value:{withContext:()=>i.bind(o),getFixtures:()=>o.fixtures,setContext:(u,c)=>{o[u]=c},mergeContext:u=>{Object.assign(o,u)}},enumerable:!1});for(const u of e)Object.defineProperty(i,u,{get(){return r({...o,[u]:!0})}});return i}const s=r(n??{});return Object.defineProperty(s,"fn",{value:t,enumerable:!1}),s}function v(){return ve().config.hookTimeout}const pn=Symbol.for("VITEST_CLEANUP_TIMEOUT"),mn=Symbol.for("VITEST_CLEANUP_STACK_TRACE"),dn=Symbol.for("VITEST_AROUND_TIMEOUT"),hn=Symbol.for("VITEST_AROUND_STACK_TRACE");function qs(e,t=v()){q(e,'"beforeAll" callback',["function"]);const n=new Error("STACK_TRACE_ERROR"),r=P(this);return O().on("beforeAll",Object.assign(W(ze("beforeAll",e,r,n),t,!0,n),{[pn]:t,[mn]:n}))}function Ys(e,t){q(e,'"afterAll" callback',["function"]);const n=P(this),r=new Error("STACK_TRACE_ERROR");return O().on("afterAll",W(ze("afterAll",e,n,r),t??v(),!0,r))}function Hs(e,t=v()){q(e,'"beforeEach" callback',["function"]);const n=new Error("STACK_TRACE_ERROR"),r=(s,o)=>Z(e,{suite:o})(s);return O().on("beforeEach",Object.assign(W(r,t??v(),!0,n,Ve),{[pn]:t,[mn]:n}))}function Gs(e,t){q(e,'"afterEach" callback',["function"]);const n=(r,s)=>Z(e,{suite:s})(r);return O().on("afterEach",W(n,t??v(),!0,new Error("STACK_TRACE_ERROR"),Ve))}function Js(e,t){q(e,'"aroundAll" callback',["function"]);const n=new Error("STACK_TRACE_ERROR"),r=t??v(),s=P(this);return O().on("aroundAll",Object.assign(ze("aroundAll",e,s,n,1),{[dn]:r,[hn]:n}))}function Xs(e,t){q(e,'"aroundEach" callback',["function"]);const n=new Error("STACK_TRACE_ERROR"),r=t??v(),s=(o,i,u)=>{const c=f=>e(o,f,u);return pe(c,{index:1,original:e}),Z(c,{suite:u})(i)};return O().on("aroundEach",Object.assign(s,{[dn]:r,[hn]:n}))}function ze(e,t,n,r,s=0){return(...o)=>{const i=o.at(-1),u=o.slice(0,-1),c=g=>t(...u,g,i);pe(c,{index:s,original:t});const l=n?.getFixtures(),f=l?.getFileContext(i.file);return Z(c,{suiteHook:e,fixtures:l,context:f,stackTraceError:r})()}}function gn(e,t){const n=t.split(`
|
|
9
|
+
`).slice(1);for(const r of n){const s=ks(r);if(s&&s.file===e)return s}}function Zs(e,t){if(!e.strictTags)return;const n=new Set(e.tags.map(r=>r.name));for(const r of t)if(!n.has(r))throw yn(e.tags,r)}function yn(e,t,n="tag"){throw e.length?new Error(`The ${n} "${t}" is not defined in the configuration. Available tags are:
|
|
10
|
+
${e.map(r=>`- ${r.name}${r.description?`: ${r.description}`:""}`).join(`
|
|
11
|
+
`)}`):new Error(`The Vitest config does't define any "tags", cannot apply "${t}" ${n} for this test. See: https://vitest.dev/guide/test-tags`)}function bn(e){return e.type==="test"}function Sn(e){const t=[],n=X(e);for(const r of n)if(bn(r))t.push(r);else for(const s of r.tasks)if(bn(s))t.push(s);else{const o=Sn(s);for(const i of o)t.push(i)}return t}function de(e,t=" > "){return e.filter(n=>n!==void 0).join(t)}const U=ro();Ue(function(e,t,n){O().test.fn.call(this,D(e),t,n)});let $,En,Qs;function Tn(e,t){if(!e)throw new Error(`Vitest failed to find ${t}. One of the following is possible:
|
|
12
|
+
- "vitest" is imported directly without running "vitest" command
|
|
13
|
+
- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)
|
|
14
|
+
- "vitest" is imported inside Vite / Vitest config file
|
|
15
|
+
- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues
|
|
16
|
+
`)}function ve(){return Tn($,"the runner"),$}function O(){const e=_.currentSuite||En;return Tn(e,"the current suite"),e}function eo(){return{beforeAll:[],afterAll:[],beforeEach:[],afterEach:[],aroundEach:[],aroundAll:[]}}const $n=Number.POSITIVE_INFINITY;function H(e,t){if(t!=null&&typeof t=="object")throw new TypeError('Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.');let n={},r;if(typeof t=="number"?n={timeout:t}:typeof e=="object"&&(n=e),typeof e=="function"){if(typeof t=="function")throw new TypeError("Cannot use two functions as arguments. Please use the second argument for options.");r=e}else typeof t=="function"&&(r=t);return{options:n,handler:r}}function to(e,t=()=>{},n,r,s){const o=[];let i;m();const u=function(d="",a={}){const p=_.currentSuite?.suite,k=(p??_.currentSuite?.file)?.tags||[],ee=Jt([...k,...X(a.tags)]),te=ee.map(w=>{const I=$.config.tags?.find(Rn=>Rn.name===w);if(!I&&$.config.strictTags)throw yn($.config.tags,w);return I}).filter(w=>w!=null).sort((w,I)=>(I.priority??$n)-(w.priority??$n)).reduce((w,I)=>{const{name:Rn,description:Ro,priority:ko,meta:kn,...So}=I;return Object.assign(w,So),kn&&(w.meta=Object.assign(w.meta??Object.create(null),kn)),w},{}),ye=a.meta;a={...te,...a};const xn=a.timeout??$.config.testTimeout,In=p?.meta,Nn=te.meta,be=Object.create(null);Nn&&Object.assign(be,Nn),In&&Object.assign(be,In),ye&&Object.assign(be,ye);const x={id:"",name:d,fullName:de([p?.fullName??_.currentSuite?.file?.fullName,d]),fullTestName:de([p?.fullTestName,d]),suite:p,each:a.each,fails:a.fails,context:void 0,type:"test",file:p?.file??_.currentSuite?.file,timeout:xn,retry:a.retry??$.config.retry,repeats:a.repeats,mode:a.only?"only":a.skip?"skip":a.todo?"todo":"run",meta:be,annotations:[],artifacts:[],tags:ee},Be=a.handler;x.mode==="run"&&!Be&&(x.mode="todo"),(a.concurrent??(!a.sequential&&$.config.sequence.concurrent))&&(x.concurrent=!0),x.shuffle=s?.shuffle;const Se=lo(x,$);Object.defineProperty(x,"context",{value:Se,enumerable:!1}),Ds(Se,a.fixtures??new T);const bo=Error.stackTraceLimit;Error.stackTraceLimit=10;const On=new Error("STACK_TRACE_ERROR");if(Error.stackTraceLimit=bo,Be&&Ls(x,W(uo(no(Z(Be,{context:Se}),x),x.context.signal),xn,!1,On,(w,I)=>Ve([Se],I))),$.config.includeTaskLocation){const w=On.stack,I=gn(Qs,w);I&&(x.location={line:I.line,column:I.column})}return o.push(x),x},c=Ue(function(d,a,p){let{options:y,handler:k}=H(a,p);typeof s=="object"&&(y=Object.assign({},s,y));const ee=this.concurrent??(!this.sequential&&y?.concurrent);y.concurrent!=null&&ee!=null&&(y.concurrent=ee);const te=this.sequential??(!this.concurrent&&y?.sequential);y.sequential!=null&&te!=null&&(y.sequential=te);const ye=u(D(d),{...this,...y,handler:k});ye.type="test"}),l={type:"collector",name:e,mode:n,suite:i,options:s,test:c,file:i.file,tasks:o,collect:h,task:u,clear:g,on:f};function f(d,...a){Us(i)[d].push(...a)}function m(d){typeof s=="number"&&(s={timeout:s});const a=_.currentSuite?.suite,p=a??_.currentSuite?.file,y=X(s?.tags);Zs($.config,y),i={id:"",type:"suite",name:e,fullName:de([a?.fullName??_.currentSuite?.file?.fullName,e]),fullTestName:de([a?.fullTestName,e]),suite:a,mode:n,each:r,file:a?.file??_.currentSuite?.file,shuffle:s?.shuffle,tasks:[],meta:s?.meta??Object.create(null),concurrent:s?.concurrent,tags:Jt([...p?.tags||[],...y])},vs(i,eo())}function g(){o.length=0,m()}async function h(d){if(!d)throw new TypeError("File is required to collect tasks.");t&&await co(l,()=>t(c));const a=[];for(const p of o)a.push(p.type==="collector"?await p.collect(d):p);return i.tasks=a,i}return io(l),l}function no(e,t){return(async(...n)=>{const r=await e(...n);if(t.promises){const o=(await Promise.allSettled(t.promises)).map(i=>i.status==="rejected"?i.reason:void 0).filter(Boolean);if(o.length)throw o}return r})}function ro(){function e(t,n,r){const s=_.currentSuite||En;let{options:o,handler:i}=H(n,r);const u=o.concurrent||this.concurrent||o.sequential===!1,c=o.sequential||this.sequential||o.concurrent===!1,{meta:l,...f}=s?.options||{};o={...f,...o};const m=this.shuffle??o.shuffle??s?.options?.shuffle??$?.config.sequence.shuffle;m!=null&&(o.shuffle=m);let g=this.only??o.only?"only":this.skip??o.skip?"skip":this.todo??o.todo?"todo":"run";g==="run"&&!i&&(g="todo");const h=u||o.concurrent&&!c,d=c||o.sequential&&!u;return h!=null&&(o.concurrent=h&&!d),d!=null&&(o.sequential=d&&!h),l&&(o.meta=Object.assign(Object.create(null),l,o.meta)),to(D(t),i,g,this.each,o)}return e.each=function(t,...n){const r=P(this),s=r.withContext();return r.setContext("each",!0),Array.isArray(t)&&n.length&&(t=he(t,n)),(o,i,u)=>{const c=D(o),l=t.every(Array.isArray),{options:f,handler:m}=H(i,u),g=typeof i=="function";t.forEach((h,d)=>{const a=Array.isArray(h)?h:[h];g?l?s(R(c,a,d),m?()=>m(...a):void 0,f.timeout):s(R(c,a,d),m?()=>m(h):void 0,f.timeout):l?s(R(c,a,d),f,m?()=>m(...a):void 0):s(R(c,a,d),f,m?()=>m(h):void 0)}),r.setContext("each",void 0)}},e.for=function(t,...n){return Array.isArray(t)&&n.length&&(t=he(t,n)),(r,s,o)=>{const i=D(r),{options:u,handler:c}=H(s,o);t.forEach((l,f)=>{U(R(i,X(l),f),u,c?()=>c(l):void 0)})}},e.skipIf=t=>t?U.skip:U,e.runIf=t=>t?U:U.skip,fn(["concurrent","sequential","shuffle","skip","only","todo"],e)}function so(e){const t=e;t.each=function(s,...o){const i=P(this),u=i.withContext();return i.setContext("each",!0),Array.isArray(s)&&o.length&&(s=he(s,o)),(c,l,f)=>{const m=D(c),g=s.every(Array.isArray),{options:h,handler:d}=H(l,f),a=typeof l=="function";s.forEach((p,y)=>{const k=Array.isArray(p)?p:[p];a?g?u(R(m,k,y),d?()=>d(...k):void 0,h.timeout):u(R(m,k,y),d?()=>d(p):void 0,h.timeout):g?u(R(m,k,y),h,d?()=>d(...k):void 0):u(R(m,k,y),h,d?()=>d(p):void 0)}),i.setContext("each",void 0)}},t.for=function(s,...o){const u=P(this).withContext();return Array.isArray(s)&&o.length&&(s=he(s,o)),(c,l,f)=>{const m=D(c),{options:g,handler:h}=H(l,f);s.forEach((d,a)=>{const p=h?y=>h(d,y):void 0;p&&pe(p,{index:1,original:h}),u(R(m,X(d),a),g,p)})}},t.skipIf=function(s){return s?this.skip:this},t.runIf=function(s){return s?this:this.skip};function n(s,o,i){if(typeof s!="string")return s;const u=s;let c,l;if(i!==void 0?(c=o,l=i):o!==null&&typeof o=="object"&&!Array.isArray(o)&&T.isFixtureOptions(o)?(c=o,l={}):(c=void 0,l=o),typeof l=="function"){const f=l,m=async(g,h)=>{let d;const p=await f(g,{onCleanup:y=>{if(d!==void 0)throw new Error("onCleanup can only be called once per fixture. Define separate fixtures if you need multiple cleanup functions.");d=y}});await h(p),d&&await d()};return pe(m,{original:f}),c?{[u]:[m,c]}:{[u]:m}}return c?{[u]:[l,c]}:{[u]:l}}return t.override=function(s,o,i){const u=n(s,o,i);return P(this).getFixtures().override($,u),this},t.scoped=function(s){return console.warn("test.scoped() is deprecated and will be removed in future versions. Please use test.override() instead."),this.override(s)},t.extend=function(s,o,i){const u=n(s,o,i),c=P(this).getFixtures().extend($,u),l=Ue(function(f,m,g){e.call(this,D(f),m,g)});return P(l).mergeContext({fixtures:c}),l},t.describe=U,t.suite=U,t.beforeEach=Hs,t.afterEach=Gs,t.beforeAll=qs,t.afterAll=Ys,t.aroundEach=Xs,t.aroundAll=Js,fn(["concurrent","sequential","skip","only","todo","fails"],t,{fixtures:new T})}function Ue(e){return so(e)}function D(e){return typeof e=="string"?e:typeof e=="function"?e.name||"<anonymous>":String(e)}function R(e,t,n){(e.includes("%#")||e.includes("%$"))&&(e=e.replace(/%%/g,"__vitest_escaped_%__").replace(/%#/g,`${n}`).replace(/%\$/g,`${n+1}`).replace(/__vitest_escaped_%__/g,"%%"));const r=e.split("%").length-1;e.includes("%f")&&(e.match(/%f/g)||[]).forEach((l,f)=>{if(Ss(t[f])||Object.is(t[f],-0)){let m=0;e=e.replace(/%f/g,g=>(m++,m===f+1?"-%f":g))}});const s=qt(t[0]);function o(c){return c.replace(/\$([$\w.]+)/g,(l,f)=>{const m=/^\d+$/.test(f);if(!s&&!m)return`$${f}`;const g=m?Yt(t,f):void 0,h=s?Yt(t[0],f,g):g;return ys(h,{truncate:$?.config?.chaiConfig?.truncateThreshold})})}let i="",u=0;return oo(e,Kt,c=>{u<r?i+=gs(c[0],t[u++]):i+=c[0]},c=>{i+=o(c)}),i}function oo(e,t,n,r){let s=0;for(const o of e.matchAll(t))s<o.index&&r(e.slice(s,o.index)),n(o),s=o.index+o[0].length;s<e.length&&r(e.slice(s))}function he(e,t){const n=e.join("").trim().replace(/ /g,"").split(`
|
|
17
|
+
`).map(s=>s.split("|"))[0],r=[];for(let s=0;s<Math.floor(t.length/n.length);s++){const o={};for(let i=0;i<n.length;i++)o[n[i]]=t[s*n.length+i];r.push(o)}return r}const _n=globalThis.performance?globalThis.performance.now.bind(globalThis.performance):Date.now,_={currentSuite:null};function io(e){_.currentSuite?.tasks.push(e)}async function co(e,t){const n=_.currentSuite;_.currentSuite=e,await t(),_.currentSuite=n}function W(e,t,n=!1,r,s){if(t<=0||t===Number.POSITIVE_INFINITY)return e;const{setTimeout:o,clearTimeout:i}=Zt();return(function(...c){const l=_n(),f=ve();return f._currentTaskStartTime=l,f._currentTaskTimeout=t,new Promise((m,g)=>{const h=o(()=>{i(h),d()},t);h.unref?.();function d(){const y=fo(n,t,r);s?.(c,y),g(y)}function a(y){if(f._currentTaskStartTime=void 0,f._currentTaskTimeout=void 0,i(h),_n()-l>=t){d();return}m(y)}function p(y){f._currentTaskStartTime=void 0,f._currentTaskTimeout=void 0,i(h),g(y)}try{const y=e(...c);typeof y=="object"&&y!=null&&typeof y.then=="function"?y.then(a,p):a(y)}catch(y){p(y)}})})}function uo(e,t){return(function(...r){return new Promise((s,o)=>{t.addEventListener("abort",()=>o(t.reason));try{const i=e(...r);typeof i=="object"&&i!=null&&typeof i.then=="function"?i.then(s,o):s(i)}catch(i){o(i)}})})}const We=new WeakMap;function Ve([e],t){e&&ao(e,t)}function ao(e,t){We.get(e)?.abort(t)}function lo(e,t){const n=function(){throw new Error("done() callback is deprecated, use promise instead")};let r=We.get(n);return r||(r=new AbortController,We.set(n,r)),n.signal=r.signal,n.task=e,n.skip=(s,o)=>{if(s!==!1)throw e.result??={state:"skip"},e.result.pending=!0,new Ps("test is skipped; abort execution",e,typeof s=="string"?s:o)},n.annotate=((s,o,i)=>{if(e.result&&e.result.state!=="run")throw new Error(`Cannot annotate tests outside of the test run. The test "${e.name}" finished running with the "${e.result.state}" state already.`);const u={message:s,type:typeof o=="object"||o===void 0?"notice":o},c=typeof o=="object"?o:i;return c&&(u.attachment=c,Cn(u.attachment)),go(e,mo(e,{type:"internal:annotation",annotation:u}).then(async({annotation:l})=>{if(!t.onTestAnnotate)throw new Error("Test runner doesn't support test annotations.");await An(t);const f=await t.onTestAnnotate(e,l);return e.annotations.push(f),f}))}),n.onTestFailed=(s,o)=>{e.onFailed||=[],e.onFailed.push(W(s,o??t.config.hookTimeout,!0,new Error("STACK_TRACE_ERROR"),(i,u)=>r.abort(u)))},n.onTestFinished=(s,o)=>{e.onFinished||=[],e.onFinished.push(W(s,o??t.config.hookTimeout,!0,new Error("STACK_TRACE_ERROR"),(i,u)=>r.abort(u)))},t.extendTaskContext?.(n)||n}function fo(e,t,n){const r=`${e?"Hook":"Test"} timed out in ${t}ms.
|
|
18
|
+
If this is a long-running ${e?"hook":"test"}, pass a timeout value as the last argument or configure it globally with "${e?"hookTimeout":"testTimeout"}".`,s=new Error(r);return n?.stack&&(s.stack=n.stack.replace(s.message,n.message)),s}globalThis.performance?globalThis.performance.now.bind(globalThis.performance):Date.now,globalThis.performance?globalThis.performance.now.bind(globalThis.performance):Date.now,Zt();const Ke=new Map,wn=[],ge=[];function po(e){if(Ke.size){const t=Array.from(Ke).map(([r,s])=>[r,s[0],s[1]]),n=e.onTaskUpdate?.(t,wn);n&&(ge.push(n),n.then(()=>ge.splice(ge.indexOf(n),1),()=>{})),wn.length=0,Ke.clear()}}async function An(e){po(e),await Promise.all(ge)}async function mo(e,t){const n=ve(),r=gn(e.file.filepath,new Error("STACK_TRACE").stack);if(r&&(t.location={file:r.file,line:r.line,column:r.column},t.type==="internal:annotation"&&(t.annotation.location=t.location)),Array.isArray(t.attachments))for(const o of t.attachments)Cn(o);if(t.type==="internal:annotation")return t;if(!n.onTestArtifactRecord)throw new Error("Test runner doesn't support test artifacts.");await An(n);const s=await n.onTestArtifactRecord(e,t);return e.artifacts.push(s),s}const A=[];for(let e=65;e<91;e++)A.push(String.fromCharCode(e));for(let e=97;e<123;e++)A.push(String.fromCharCode(e));for(let e=0;e<10;e++)A.push(e.toString(10));A.push("+","/");function ho(e){let t="";const n=e.byteLength;for(let r=0;r<n;r+=3)if(n===r+1){const s=(e[r]&252)>>2,o=(e[r]&3)<<4;t+=A[s],t+=A[o],t+="=="}else if(n===r+2){const s=(e[r]&252)>>2,o=(e[r]&3)<<4|(e[r+1]&240)>>4,i=(e[r+1]&15)<<2;t+=A[s],t+=A[o],t+=A[i],t+="="}else{const s=(e[r]&252)>>2,o=(e[r]&3)<<4|(e[r+1]&240)>>4,i=(e[r+1]&15)<<2|(e[r+2]&192)>>6,u=e[r+2]&63;t+=A[s],t+=A[o],t+=A[i],t+=A[u]}return t}function go(e,t){return t=t.finally(()=>{if(!e.promises)return;const n=e.promises.indexOf(t);n!==-1&&e.promises.splice(n,1)}),e.promises||(e.promises=[]),e.promises.push(t),t}function Cn(e){if(e.body==null&&!e.path)throw new TypeError('Test attachment requires "body" or "path" to be set. Both are missing.');if(e.body&&e.path)throw new TypeError('Test attachment requires only one of "body" or "path" to be set. Both are specified.');if(e.path&&e.bodyEncoding)throw new TypeError('Test attachment with "path" should not have "bodyEncoding" specified.');e.body instanceof Uint8Array&&(e.body=ho(e.body)),e.body!=null&&(e.bodyEncoding??="base64")}class yo{ctx=void 0;verbose=!1;onInit(t){this.ctx=t}onFinished(t=this.ctx.state.getFiles(),n=this.ctx.state.getUnhandledErrors()){const{logger:r}=this.ctx,s=Sn(t),o=s.filter(l=>l.result?.state==="fail").length,i=!(o+n.length),u=i?"✔ PASS":"✖ FAIL",c=i?E.green:E.red;r.log(`${c(E.bold(E.inverse(` ${u} `)))} ${c(i?"All tests passed":`${o} test${o>1?"s":""} failed`)}`),r.log(this.padTitle("Test Files"),this.getStateString(t)),r.log(this.padTitle("Tests"),this.getStateString(s)),n.length&&r.log(this.padTitle("Errors"),E.bold(E.red(`${n.length} error${n.length>1?"s":""}`))),i||(process.exitCode=1)}padTitle=t=>E.dim(`${t.padStart(11)} `);getStateString(t,n="tests"){if(!t.length)return E.dim(`no ${n}`);const r=t.filter(u=>u.result?.state==="pass").length,s=t.filter(u=>u.result?.state==="fail").length,o=t.filter(u=>u.mode==="skip").length,i=t.filter(u=>u.mode==="todo").length;return[s&&E.bold(E.red(`${s} failed`)),r&&E.bold(E.green(`${r} passed`)),o&&E.yellow(`${o} skipped`),i&&E.gray(`${i} todo`)].filter(Boolean).join(E.dim(" | "))+E.gray(` (${t.length})`)}}return yo}));
|
|
2
19
|
//# sourceMappingURL=vitest-tiny-reporter.umd.cjs.map
|