@lytjs/test-utils 4.0.5 → 4.1.0

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.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var j=Object.create;var $=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var L=(s,t)=>{for(var e in t)$(s,e,{get:t[e],enumerable:!0})},_=(s,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of B(t))!x.call(s,i)&&i!==e&&$(s,i,{get:()=>t[i],enumerable:!(r=A(t,i))||r.enumerable});return s};var T=(s,t,e)=>(e=s!=null?j(R(s)):{},_(t||!s||!s.__esModule?$(e,"default",{value:s,enumerable:!0}):e,s)),C=s=>_($({},"__esModule",{value:!0}),s);var D={};L(D,{Assertion:()=>p,afterEach:()=>G,beforeEach:()=>U,deepEqual:()=>d,describe:()=>N,expect:()=>J,it:()=>k,runAll:()=>W,skip:()=>I,test:()=>q,waitFor:()=>K});module.exports=C(D);var S=T(require("fs")),F=T(require("path")),w=[];var a=null;function N(s,t){let e={name:s,tests:[],beforeEachFn:[],afterEachFn:[]};w.push(e);let r=a;a=e;try{t()}finally{a=r}}function k(s,t){if(!a)throw new Error(`it() \u5FC5\u987B\u5728 describe() \u5185\u90E8\u8C03\u7528: "${s}"`);a.tests.push({name:s,fn:t})}function q(s,t){k(s,t)}function I(s,t){if(!a)throw new Error(`skip() \u5FC5\u987B\u5728 describe() \u5185\u90E8\u8C03\u7528: "${s}"`);a.tests.push({name:s,fn:()=>{throw new g(s)}})}var g=class extends Error{constructor(t){super(`SKIP: ${t}`),this.name="SkipError"}};function U(s){if(!a)throw new Error("beforeEach() \u5FC5\u987B\u5728 describe() \u5185\u90E8\u8C03\u7528");a.beforeEachFn.push(s)}function G(s){if(!a)throw new Error("afterEach() \u5FC5\u987B\u5728 describe() \u5185\u90E8\u8C03\u7528");a.afterEachFn.push(s)}var p=class{constructor(t){this.negated=!1;this.actual=t}get not(){return this.negated=!this.negated,this}toBe(t){let e=this.negated?!Object.is(this.actual,t):Object.is(this.actual,t);this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u7B49\u4E8E ${this._fmt(t)}`)}toEqual(t){let e=this.negated?!d(this.actual,t):d(this.actual,t);this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u6DF1\u5EA6\u7B49\u4E8E ${this._fmt(t)}`)}toBeTruthy(){let t=this.negated?!this.actual:!!this.actual;this._assert(t,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u4E3A\u771F\u503C`)}toBeFalsy(){let t=this.negated?!!this.actual:!this.actual;this._assert(t,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u4E3A\u5047\u503C`)}toBeNull(){let t=this.negated?this.actual!==null:this.actual===null;this._assert(t,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u4E3A null`)}toBeUndefined(){let t=this.negated?this.actual!==void 0:this.actual===void 0;this._assert(t,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u4E3A undefined`)}toBeDefined(){let t=this.negated?this.actual===void 0:this.actual!==void 0;this._assert(t,`\u671F\u671B\u503C ${this.negated?"\u4E0D":""}\u5DF2\u5B9A\u4E49`)}toThrow(t){let e=!1,r="";try{if(typeof this.actual=="function")this.actual();else throw new Error("toThrow() \u7684\u5B9E\u9645\u503C\u5FC5\u987B\u662F\u51FD\u6570")}catch(u){e=!0,r=u.message||String(u)}let i=this.negated?!e:e;i&&e&&t&&!this.negated&&(i=r.includes(t)),this._assert(i,`\u671F\u671B\u51FD\u6570${this.negated?"\u4E0D":""}\u629B\u51FA\u5F02\u5E38${t?` (\u5305\u542B "${t}")`:""}`)}toContain(t){let e;typeof this.actual=="string"?e=this.actual.includes(t):Array.isArray(this.actual)?e=this.actual.some(r=>d(r,t)):e=!1,this.negated&&(e=!e),this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5305\u542B ${this._fmt(t)}`)}toBeGreaterThan(t){let e=this.negated?!(this.actual>t):this.actual>t;this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5927\u4E8E ${t}`)}toBeLessThan(t){let e=this.negated?!(this.actual<t):this.actual<t;this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5C0F\u4E8E ${t}`)}toBeGreaterThanOrEqual(t){let e=this.negated?!(this.actual>=t):this.actual>=t;this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5927\u4E8E\u7B49\u4E8E ${t}`)}toBeLessThanOrEqual(t){let e=this.negated?!(this.actual<=t):this.actual<=t;this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5C0F\u4E8E\u7B49\u4E8E ${t}`)}toHaveLength(t){var i;let e=(i=this.actual)==null?void 0:i.length,r=this.negated?e!==t:e===t;this._assert(r,`\u671F\u671B\u957F\u5EA6\u4E3A ${t}\uFF0C\u5B9E\u9645\u4E3A ${e}`)}_assert(t,e){if(!t)throw new v(e)}_fmt(t){if(t===null)return"null";if(t===void 0)return"undefined";if(typeof t=="string")return`"${t}"`;if(typeof t=="function")return"[Function]";if(Array.isArray(t))try{return JSON.stringify(t)}catch(e){return"[Array]"}if(typeof t=="object")try{return JSON.stringify(t)}catch(e){return"[Object]"}return String(t)}},v=class extends Error{constructor(t){super(t),this.name="AssertionError"}};function J(s){return new p(s)}function d(s,t){if(Object.is(s,t))return!0;if(s===null||t===null||typeof s!=typeof t)return!1;if(typeof s=="object"){let e=Object.keys(s),r=Object.keys(t);if(e.length!==r.length)return!1;for(let i of e)if(!Object.prototype.hasOwnProperty.call(t,i)||!d(s[i],t[i]))return!1;return!0}return!1}function K(s){return new Promise(t=>setTimeout(t,s))}var n={reset:"\x1B[0m",green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",gray:"\x1B[90m",bold:"\x1B[1m"};async function W(){let s=[],t=0,e=0,r=0,i=0,u=[];console.log(`
1
+ var j=Object.create;var $=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var L=(s,t)=>{for(var e in t)$(s,e,{get:t[e],enumerable:!0})},_=(s,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of B(t))!x.call(s,i)&&i!==e&&$(s,i,{get:()=>t[i],enumerable:!(r=A(t,i))||r.enumerable});return s};var T=(s,t,e)=>(e=s!=null?j(R(s)):{},_(t||!s||!s.__esModule?$(e,"default",{value:s,enumerable:!0}):e,s)),C=s=>_($({},"__esModule",{value:!0}),s);var D={};L(D,{Assertion:()=>p,afterEach:()=>G,beforeEach:()=>U,deepEqual:()=>d,describe:()=>N,expect:()=>J,it:()=>k,runAll:()=>W,skip:()=>I,test:()=>q,waitFor:()=>K});module.exports=C(D);var S=T(require("fs")),F=T(require("path")),w=[];var a=null;function N(s,t){let e={name:s,tests:[],beforeEachFn:[],afterEachFn:[]};w.push(e);let r=a;a=e;try{t()}finally{a=r}}function k(s,t){if(!a)throw new Error(`it() \u5FC5\u987B\u5728 describe() \u5185\u90E8\u8C03\u7528: "${s}"`);a.tests.push({name:s,fn:t})}function q(s,t){k(s,t)}function I(s,t){if(!a)throw new Error(`skip() \u5FC5\u987B\u5728 describe() \u5185\u90E8\u8C03\u7528: "${s}"`);a.tests.push({name:s,fn:()=>{throw new g(s)}})}var g=class extends Error{constructor(t){super(`SKIP: ${t}`),this.name="SkipError"}};function U(s){if(!a)throw new Error("beforeEach() \u5FC5\u987B\u5728 describe() \u5185\u90E8\u8C03\u7528");a.beforeEachFn.push(s)}function G(s){if(!a)throw new Error("afterEach() \u5FC5\u987B\u5728 describe() \u5185\u90E8\u8C03\u7528");a.afterEachFn.push(s)}var p=class{constructor(t){this.negated=!1;this.actual=t}get not(){return this.negated=!this.negated,this}toBe(t){let e=this.negated?!Object.is(this.actual,t):Object.is(this.actual,t);this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u7B49\u4E8E ${this._fmt(t)}`)}toEqual(t){let e=this.negated?!d(this.actual,t):d(this.actual,t);this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u6DF1\u5EA6\u7B49\u4E8E ${this._fmt(t)}`)}toBeTruthy(){let t=this.negated?!this.actual:!!this.actual;this._assert(t,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u4E3A\u771F\u503C`)}toBeFalsy(){let t=this.negated?!!this.actual:!this.actual;this._assert(t,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u4E3A\u5047\u503C`)}toBeNull(){let t=this.negated?this.actual!==null:this.actual===null;this._assert(t,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u4E3A null`)}toBeUndefined(){let t=this.negated?this.actual!==void 0:this.actual===void 0;this._assert(t,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u4E3A undefined`)}toBeDefined(){let t=this.negated?this.actual===void 0:this.actual!==void 0;this._assert(t,`\u671F\u671B\u503C ${this.negated?"\u4E0D":""}\u5DF2\u5B9A\u4E49`)}toThrow(t){let e=!1,r="";try{if(typeof this.actual=="function")this.actual();else throw new Error("toThrow() \u7684\u5B9E\u9645\u503C\u5FC5\u987B\u662F\u51FD\u6570")}catch(u){e=!0,r=u.message||String(u)}let i=this.negated?!e:e;i&&e&&t&&!this.negated&&(i=r.includes(t)),this._assert(i,`\u671F\u671B\u51FD\u6570${this.negated?"\u4E0D":""}\u629B\u51FA\u5F02\u5E38${t?` (\u5305\u542B "${t}")`:""}`)}toContain(t){let e;typeof this.actual=="string"?e=this.actual.includes(t):Array.isArray(this.actual)?e=this.actual.some(r=>d(r,t)):e=!1,this.negated&&(e=!e),this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5305\u542B ${this._fmt(t)}`)}toBeGreaterThan(t){let e=this.negated?!(this.actual>t):this.actual>t;this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5927\u4E8E ${t}`)}toBeLessThan(t){let e=this.negated?!(this.actual<t):this.actual<t;this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5C0F\u4E8E ${t}`)}toBeGreaterThanOrEqual(t){let e=this.negated?!(this.actual>=t):this.actual>=t;this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5927\u4E8E\u7B49\u4E8E ${t}`)}toBeLessThanOrEqual(t){let e=this.negated?!(this.actual<=t):this.actual<=t;this._assert(e,`\u671F\u671B ${this._fmt(this.actual)} ${this.negated?"\u4E0D":""}\u5C0F\u4E8E\u7B49\u4E8E ${t}`)}toHaveLength(t){var i;let e=(i=this.actual)==null?void 0:i.length,r=this.negated?e!==t:e===t;this._assert(r,`\u671F\u671B\u957F\u5EA6\u4E3A ${t}\uFF0C\u5B9E\u9645\u4E3A ${e}`)}_assert(t,e){if(!t)throw new v(e)}_fmt(t){if(t===null)return"null";if(t===void 0)return"undefined";if(typeof t=="string")return`"${t}"`;if(typeof t=="function")return"[Function]";if(Array.isArray(t))try{return JSON.stringify(t)}catch(e){return"[Array]"}if(typeof t=="object")try{return JSON.stringify(t)}catch(e){return"[Object]"}return String(t)}},v=class extends Error{constructor(t){super(t),this.name="AssertionError"}};function J(s){return new p(s)}function d(s,t){if(Object.is(s,t))return!0;if(s===null||t===null||typeof s!=typeof t)return!1;if(typeof s=="object"){let e=Object.keys(s),r=Object.keys(t);if(e.length!==r.length)return!1;for(let i of e)if(!Object.prototype.hasOwnProperty.call(t,i)||!d(s[i],t[i]))return!1;return!0}return!1}function K(s){return new Promise(t=>setTimeout(t,s))}var n={reset:"\x1B[0m",green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",gray:"\x1B[90m",bold:"\x1B[1m"};async function W(){let s=[],t=0,e=0,r=0,i=0,u=[];console.log(`
2
2
  ${n.bold}${n.cyan}=== Lyt.js \u6D4B\u8BD5\u8FD0\u884C\u5668 ===${n.reset}
3
3
  `);for(let l of w){console.log(`${n.bold}${l.name}${n.reset}`);for(let h of l.tests){t++;let O=performance.now();if(l.beforeEachFn)for(let o of l.beforeEachFn)try{o()}catch(b){console.warn(` ${n.yellow}[WARN] beforeEach \u51FA\u9519: ${b.message}${n.reset}`)}let f="passed",c;try{let o=h.fn();o instanceof Promise&&await o}catch(o){o instanceof g?(f="skipped",i++):(f="failed",r++,c=o,u.push(`Suite: ${l.name}, Test: ${h.name}, Error: ${(c==null?void 0:c.message)||"Unknown error"}`))}let m=performance.now()-O;if(l.afterEachFn)for(let o of l.afterEachFn)try{o()}catch(b){console.warn(` ${n.yellow}[WARN] afterEach \u51FA\u9519: ${b.message}${n.reset}`)}f==="passed"&&e++;let P={name:h.name,suite:l.name,status:f,error:c,duration:m};s.push(P);let y=m<1?"":` ${n.gray}(${m.toFixed(1)}ms)${n.reset}`;f==="passed"?console.log(` ${n.green}[PASS]${n.reset} ${h.name}${y}`):f==="skipped"?console.log(` ${n.yellow}[SKIP]${n.reset} ${h.name}${y}`):(console.log(` ${n.red}[FAIL]${n.reset} ${h.name}${y}`),c&&console.log(` ${n.red}${c.message}${n.reset}`))}console.log("")}let E=F.join(process.cwd(),"failed-tests.log");return S.writeFileSync(E,u.join(`
4
4
  `),"utf8"),console.log(`\u5931\u8D25\u7684\u6D4B\u8BD5\u5DF2\u4FDD\u5B58\u5230 ${E}, \u5171 ${u.length} \u4E2A\u5931\u8D25
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.full.d.ts","../src/index.ts"],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","signature":false,"impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","signature":false,"impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","signature":false,"impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","signature":false,"impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","signature":false,"impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","signature":false,"impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","signature":false,"impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","signature":false,"impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","signature":false,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","signature":false,"impliedFormat":1},{"version":"2a2de5b9459b3fc44decd9ce6100b72f1b002ef523126c1d3d8b2a4a63d74d78","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"f13f4b465c99041e912db5c44129a94588e1aafee35a50eab51044833f50b4ee","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"01a30f9e8582b369075c0808df71121e6855cb06fd8d3d39511d9ebb66405205","signature":false,"impliedFormat":1},{"version":"2c9e8dd75abfe42ee48e22150762d74c940a46469bdf96e0c7fcbb319b4d77f2","signature":false}],"root":[64],"options":{"allowImportingTsExtensions":true,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"module":99,"noEmitOnError":false,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"useDefineForClassFields":true,"verbatimModuleSyntax":true},"changeFileSet":[61,62,12,10,11,16,15,2,17,18,19,20,21,22,23,24,3,25,26,4,27,31,28,29,30,32,33,34,5,35,36,37,38,6,42,39,40,41,43,7,44,49,50,45,46,47,48,8,54,51,52,53,55,9,56,63,57,58,60,59,1,14,13,64],"version":"6.0.2"}
@@ -0,0 +1,135 @@
1
+ interface TestCase {
2
+ name: string;
3
+ fn: () => void | Promise<void>;
4
+ }
5
+ interface TestResult {
6
+ name: string;
7
+ suite: string;
8
+ status: 'passed' | 'failed' | 'skipped';
9
+ error?: Error;
10
+ duration: number;
11
+ }
12
+ interface TestSuite {
13
+ name: string;
14
+ tests: TestCase[];
15
+ beforeEachFn?: (() => void)[];
16
+ afterEachFn?: (() => void)[];
17
+ }
18
+ /**
19
+ * 定义测试套件
20
+ *
21
+ * @param name 测试套件名称
22
+ * @param fn 定义函数,内部使用 it/test 注册测试用例
23
+ */
24
+ declare function describe(name: string, fn: () => void): void;
25
+ /**
26
+ * 注册测试用例
27
+ *
28
+ * @param name 测试名称
29
+ * @param fn 测试函数
30
+ */
31
+ declare function it(name: string, fn: () => void | Promise<void>): void;
32
+ /** it 的别名 */
33
+ declare function test(name: string, fn: () => void | Promise<void>): void;
34
+ /**
35
+ * 跳过测试用例
36
+ *
37
+ * @param name 测试名称
38
+ * @param fn 测试函数(不会执行)
39
+ */
40
+ declare function skip(name: string, fn: () => void | Promise<void>): void;
41
+ /**
42
+ * 注册前置钩子
43
+ *
44
+ * @param fn 每个测试用例执行前调用的函数
45
+ */
46
+ declare function beforeEach(fn: () => void): void;
47
+ /**
48
+ * 注册后置钩子
49
+ *
50
+ * @param fn 每个测试用例执行后调用的函数
51
+ */
52
+ declare function afterEach(fn: () => void): void;
53
+ /**
54
+ * Assertion 断言类
55
+ *
56
+ * 支持链式调用和 .not 取反。
57
+ */
58
+ declare class Assertion {
59
+ private actual;
60
+ private negated;
61
+ constructor(actual: any);
62
+ /** 取反后续断言 */
63
+ get not(): Assertion;
64
+ /** 断言严格相等 (===) */
65
+ toBe(expected: any): void;
66
+ /** 断言深度相等 */
67
+ toEqual(expected: any): void;
68
+ /** 断言为真值 */
69
+ toBeTruthy(): void;
70
+ /** 断言为假值 */
71
+ toBeFalsy(): void;
72
+ /** 断言为 null */
73
+ toBeNull(): void;
74
+ /** 断言为 undefined */
75
+ toBeUndefined(): void;
76
+ /** 断言不为 undefined(即已定义) */
77
+ toBeDefined(): void;
78
+ /** 断言函数抛出异常 */
79
+ toThrow(message?: string): void;
80
+ /** 断言数组/字符串包含指定项 */
81
+ toContain(item: any): void;
82
+ /** 断言数值大于 n */
83
+ toBeGreaterThan(n: number): void;
84
+ /** 断言数值小于 n */
85
+ toBeLessThan(n: number): void;
86
+ /** 断言数值大于等于 n */
87
+ toBeGreaterThanOrEqual(n: number): void;
88
+ /** 断言数值小于等于 n */
89
+ toBeLessThanOrEqual(n: number): void;
90
+ /** 断言数组/字符串长度为 n */
91
+ toHaveLength(n: number): void;
92
+ /** 内部断言方法 */
93
+ private _assert;
94
+ /** 格式化值用于错误消息 */
95
+ private _fmt;
96
+ }
97
+ /**
98
+ * 创建断言
99
+ *
100
+ * @param value 要断言的值
101
+ * @returns Assertion 实例
102
+ */
103
+ declare function expect(value: any): Assertion;
104
+ /**
105
+ * 深度比较两个值
106
+ *
107
+ * @param a 第一个值
108
+ * @param b 第二个值
109
+ * @returns 是否深度相等
110
+ */
111
+ declare function deepEqual(a: any, b: any): boolean;
112
+ /**
113
+ * 等待指定毫秒数
114
+ *
115
+ * @param ms 等待时间(毫秒)
116
+ * @returns Promise
117
+ */
118
+ declare function waitFor(ms: number): Promise<void>;
119
+ /**
120
+ * 运行所有已注册的测试套件
121
+ *
122
+ * 按注册顺序执行所有 describe 中的测试用例,
123
+ * 收集结果并输出格式化报告。
124
+ *
125
+ * @returns 测试结果汇总
126
+ */
127
+ declare function runAll(): Promise<{
128
+ total: number;
129
+ passed: number;
130
+ failed: number;
131
+ skipped: number;
132
+ results: TestResult[];
133
+ }>;
134
+ export { describe, it, test, skip, beforeEach, afterEach, expect, Assertion, deepEqual, waitFor, runAll, type TestCase, type TestResult, type TestSuite, };
135
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lytjs/test-utils",
3
- "version": "4.0.5",
3
+ "version": "4.1.0",
4
4
  "description": "Lyt.js 测试工具库 - 提供组件挂载、状态模拟和断言辅助等测试工具",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",