vitest 0.0.47 → 0.0.48

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as pretty_format from 'pretty-format';
2
- import { T as TestFactory, S as SuiteCollector, a as TestFunction, b as SuiteHooks, U as UserOptions } from './types-8b2d1521';
3
- export { C as ComputeMode, F as File, G as GlobalContext, H as HookListener, m as Reporter, R as ResolvedConfig, c as RunMode, l as RunnerContext, k as Suite, S as SuiteCollector, b as SuiteHooks, e as SuiteState, g as Task, i as TaskResult, f as TaskType, h as Test, j as TestCollector, T as TestFactory, a as TestFunction, d as TestState, U as UserOptions } from './types-8b2d1521';
2
+ import { T as TestFactory, S as SuiteCollector, a as TestFunction, b as SuiteHooks, U as UserOptions } from './types-4b0e87eb';
3
+ export { C as ComputeMode, F as File, G as GlobalContext, H as HookListener, l as Reporter, R as ResolvedConfig, c as RunMode, k as RunnerContext, g as Suite, S as SuiteCollector, b as SuiteHooks, i as Task, e as TaskBase, f as TaskResult, h as Test, j as TestCollector, T as TestFactory, a as TestFunction, d as TestState, U as UserOptions } from './types-4b0e87eb';
4
4
  export { assert, default as chai, expect, should } from 'chai';
5
5
  import sinon from 'sinon';
6
6
  export { default as sinon } from 'sinon';
@@ -1,5 +1,5 @@
1
1
  import { TransformResult, ViteDevServer } from 'vite';
2
- import { R as ResolvedConfig } from '../types-8b2d1521';
2
+ import { R as ResolvedConfig } from '../types-4b0e87eb';
3
3
  import '@antfu/utils';
4
4
  import 'jest-snapshot';
5
5
  import 'jest-snapshot/build/State';
package/dist/node/cli.js CHANGED
@@ -1,7 +1,7 @@
1
- import{distDir}from"../chunk-253QKTIQ.js";import{__spreadProps,__spreadValues,init_esm_shims}from"../chunk-7OSWSRXU.js";init_esm_shims();import{resolve as resolve3}from"path";import sade from"sade";import c from"picocolors";var version="0.0.47";init_esm_shims();init_esm_shims();import{builtinModules,createRequire}from"module";import{fileURLToPath,pathToFileURL}from"url";import{dirname,resolve}from"path";import vm from"vm";var isWindows=process.platform==="win32",stubRequests={"/@vite/client":{injectQuery:id=>id,createHotContext(){return{accept:()=>{},prune:()=>{}}},updateStyle(){}}};async function executeInViteNode({moduleCache,root,files,fetch,inline,external}){let externaled=new Set(builtinModules),result=[];for(let file of files)result.push(await cachedRequest(`/@fs/${slash(resolve(file))}`,[]));return result;async function directRequest(id,fsPath,callstack){callstack=[...callstack,id];let request=async dep=>{var _a;if(callstack.includes(dep)){let cacheKey=toFilePath(dep,root);if(!((_a=moduleCache.get(cacheKey))==null?void 0:_a.exports))throw new Error(`Circular dependency detected
1
+ import{distDir}from"../chunk-253QKTIQ.js";import{__spreadProps,__spreadValues,init_esm_shims}from"../chunk-7OSWSRXU.js";init_esm_shims();import{resolve as resolve3}from"path";import sade from"sade";import c from"picocolors";var version="0.0.48";init_esm_shims();init_esm_shims();import{builtinModules,createRequire}from"module";import{fileURLToPath,pathToFileURL}from"url";import{dirname,resolve}from"path";import vm from"vm";var isWindows=process.platform==="win32",stubRequests={"/@vite/client":{injectQuery:id=>id,createHotContext(){return{accept:()=>{},prune:()=>{}}},updateStyle(){}}};async function executeInViteNode({moduleCache,root,files,fetch,inline,external}){let externaled=new Set(builtinModules),result=[];for(let file of files)result.push(await cachedRequest(`/@fs/${slash(resolve(file))}`,[]));return result;async function directRequest(id,fsPath,callstack){callstack=[...callstack,id];let request=async dep=>{var _a;if(callstack.includes(dep)){let cacheKey=toFilePath(dep,root);if(!((_a=moduleCache.get(cacheKey))==null?void 0:_a.exports))throw new Error(`Circular dependency detected
2
2
  Stack:
3
3
  ${[...callstack,dep].reverse().map(p=>`- ${p}`).join(`
4
- `)}`);return moduleCache.get(cacheKey).exports}return cachedRequest(dep,callstack)};if(id in stubRequests)return stubRequests[id];let result2=await fetch(id);if(!result2)throw new Error(`failed to load ${id}`);let url=pathToFileURL(fsPath).href,exports={};setCache(fsPath,{transformResult:result2,exports});let __filename2=fileURLToPath(url),context={require:createRequire(url),__filename:__filename2,__dirname:dirname(__filename2),__vite_ssr_import__:request,__vite_ssr_dynamic_import__:request,__vite_ssr_exports__:exports,__vite_ssr_exportAll__:obj=>exportAll(exports,obj),__vite_ssr_import_meta__:{url}};return await vm.runInThisContext(`async (${Object.keys(context).join(",")}) => { ${result2.code} }`,{filename:fsPath,lineOffset:0})(...Object.values(context)),exports}function setCache(id,mod){moduleCache.has(id)?Object.assign(moduleCache.get(id),mod):moduleCache.set(id,mod)}async function shouldExternalize(id){for(let ex of inline)if(typeof ex=="string"){if(id.includes(`/node_modules/${ex}/`))return!1}else if(ex.test(id))return!1;for(let ex of external)if(typeof ex=="string"){if(id.includes(`/node_modules/${ex}/`))return!0}else if(ex.test(id))return!0;return id.includes("/node_modules/")}async function cachedRequest(rawId,callstack){var _a,_b;let id=normalizeId(rawId);if(externaled.has(id))return import(id);let fsPath=toFilePath(id,root);if(externaled.has(fsPath)||await shouldExternalize(fsPath))return externaled.add(fsPath),fsPath.match(/^\w:\//)?import(`/${fsPath}`):import(fsPath);if((_a=moduleCache.get(fsPath))==null?void 0:_a.promise)return(_b=moduleCache.get(fsPath))==null?void 0:_b.promise;let promise=directRequest(id,fsPath,callstack);return setCache(fsPath,{promise}),await promise}function exportAll(exports,sourceModule){for(let key in sourceModule)if(key!=="default")try{Object.defineProperty(exports,key,{enumerable:!0,configurable:!0,get(){return sourceModule[key]}})}catch{}}}function normalizeId(id){return id&&id.startsWith("/@id/__x00__")&&(id=`\0${id.slice("/@id/__x00__".length)}`),id&&id.startsWith("/@id/")&&(id=id.slice("/@id/".length)),id.startsWith("__vite-browser-external:")&&(id=id.slice("__vite-browser-external:".length)),id.startsWith("node:")&&(id=id.slice("node:".length)),id}function toFilePath(id,root){id=slash(id);let absolute=id.startsWith("/@fs/")?id.slice(4):id.startsWith(dirname(root))?id:id.startsWith("/")?slash(resolve(root,id.slice(1))):id;return absolute.startsWith("//")&&(absolute=absolute.slice(1)),isWindows&&absolute.startsWith("/")?pathToFileURL(absolute.slice(1)).href:absolute}function slash(path){return path.replace(/\\/g,"/")}init_esm_shims();async function transformRequest(server,id){if(id.match(/\.(?:[cm]?[jt]sx?|json)$/))return await server.transformRequest(id,{ssr:!0});{let result=await server.transformRequest(id);return result?await server.ssrTransform(result.code,result.map,id):void 0}}async function run(server,config,moduleCache,files){let executeOptions={root:server.config.root,files,fetch:id=>transformRequest(server,id),inline:config.depsInline,external:config.depsExternal,moduleCache};try{await executeInViteNode(executeOptions)}catch(e){throw process.exitCode=1,e}finally{config.watch||await server.close()}}init_esm_shims();import{resolve as resolve2}from"path";import{findUp}from"find-up";import{createServer}from"vite";var configFiles=["vitest.config.ts","vitest.config.js","vitest.config.mjs","vite.config.ts","vite.config.js","vite.config.mjs"];async function initViteServer(options={}){var _a,_b,_c,_d;let{filters}=options,root=resolve2(options.root||process.cwd());process.chdir(root);let configPath=options.config?resolve2(root,options.config):await findUp(configFiles,{cwd:root}),resolved=__spreadValues({},options);resolved.config=configPath,resolved.root=root,resolved.filters=filters?Array.isArray(filters)?filters:[filters]:void 0;let server=await createServer({root,logLevel:"error",clearScreen:!1,configFile:resolved.config,optimizeDeps:{exclude:["vitest"]}});return await server.pluginContainer.buildStart({}),Object.assign(resolved,server.config.test),resolved.depsInline=["vitest/dist","vitest/src","@vue","@vueuse","vue-demi","vue",/virtual:/,/\.ts$/,/\/esm\/.*\.js$/,/\.(es|esm|esm-browser|esm-bundler|es6).js$/,...((_b=(_a=server.config.test)==null?void 0:_a.deps)==null?void 0:_b.inline)||[]],resolved.depsExternal=[/node_modules/,...((_d=(_c=server.config.test)==null?void 0:_c.deps)==null?void 0:_d.external)||[]],{server,config:resolved}}sade("vitest [filter]",!0).version(version).describe("A blazing fast unit test framework powered by Vite.").option("-r, --root","root path",process.cwd()).option("-c, --config","path to config file").option("-w, --watch","watch mode",!1).option("-u, --update","update snapshot",!1).option("--global","inject apis globally",!1).option("--dom","mock browser api using jsdom or happy-dom","").action(async(filters,argv)=>{process.env.VITEST="true",console.log(c.yellow(c.bold(`
4
+ `)}`);return moduleCache.get(cacheKey).exports}return cachedRequest(dep,callstack)};if(id in stubRequests)return stubRequests[id];let result2=await fetch(id);if(!result2)throw new Error(`failed to load ${id}`);let url=pathToFileURL(fsPath).href,exports={};setCache(fsPath,{transformResult:result2,exports});let __filename2=fileURLToPath(url),context={require:createRequire(url),__filename:__filename2,__dirname:dirname(__filename2),__vite_ssr_import__:request,__vite_ssr_dynamic_import__:request,__vite_ssr_exports__:exports,__vite_ssr_exportAll__:obj=>exportAll(exports,obj),__vite_ssr_import_meta__:{url}};return await vm.runInThisContext(`async (${Object.keys(context).join(",")}) => { ${result2.code} }`,{filename:fsPath,lineOffset:0})(...Object.values(context)),exports}function setCache(id,mod){moduleCache.has(id)?Object.assign(moduleCache.get(id),mod):moduleCache.set(id,mod)}async function shouldExternalize(id){for(let ex of inline)if(typeof ex=="string"){if(id.includes(`/node_modules/${ex}/`))return!1}else if(ex.test(id))return!1;for(let ex of external)if(typeof ex=="string"){if(id.includes(`/node_modules/${ex}/`))return!0}else if(ex.test(id))return!0;return id.includes("/node_modules/")}async function cachedRequest(rawId,callstack){var _a,_b;let id=normalizeId(rawId);if(externaled.has(id))return import(id);let fsPath=toFilePath(id,root);if(externaled.has(fsPath)||await shouldExternalize(fsPath))return externaled.add(fsPath),fsPath.match(/^\w:\//)?import(`/${fsPath}`):import(fsPath);if((_a=moduleCache.get(fsPath))==null?void 0:_a.promise)return(_b=moduleCache.get(fsPath))==null?void 0:_b.promise;let promise=directRequest(id,fsPath,callstack);return setCache(fsPath,{promise}),await promise}function exportAll(exports,sourceModule){for(let key in sourceModule)if(key!=="default")try{Object.defineProperty(exports,key,{enumerable:!0,configurable:!0,get(){return sourceModule[key]}})}catch{}}}function normalizeId(id){return id&&id.startsWith("/@id/__x00__")&&(id=`\0${id.slice("/@id/__x00__".length)}`),id&&id.startsWith("/@id/")&&(id=id.slice("/@id/".length)),id.startsWith("__vite-browser-external:")&&(id=id.slice("__vite-browser-external:".length)),id.startsWith("node:")&&(id=id.slice("node:".length)),id}function toFilePath(id,root){id=slash(id);let absolute=id.startsWith("/@fs/")?id.slice(4):id.startsWith(dirname(root))?id:id.startsWith("/")?slash(resolve(root,id.slice(1))):id;return absolute.startsWith("//")&&(absolute=absolute.slice(1)),isWindows&&absolute.startsWith("/")?pathToFileURL(absolute.slice(1)).href:absolute}function slash(path3){return path3.replace(/\\/g,"/")}init_esm_shims();async function transformRequest(server,id){if(id.match(/\.(?:[cm]?[jt]sx?|json)$/))return await server.transformRequest(id,{ssr:!0});{let result=await server.transformRequest(id);return result?await server.ssrTransform(result.code,result.map,id):void 0}}async function run(server,config,moduleCache,files){let executeOptions={root:server.config.root,files,fetch:id=>transformRequest(server,id),inline:config.depsInline,external:config.depsExternal,moduleCache};try{await executeInViteNode(executeOptions)}catch(e){throw process.exitCode=1,e}finally{config.watch||await server.close()}}init_esm_shims();import{resolve as resolve2}from"path";init_esm_shims();import path2 from"node:path";init_esm_shims();import process2 from"node:process";import path from"node:path";import fs,{promises as fsPromises}from"node:fs";init_esm_shims();init_esm_shims();init_esm_shims();var Node=class{value;next;constructor(value){this.value=value}},Queue=class{#head;#tail;#size;constructor(){this.clear()}enqueue(value){let node=new Node(value);this.#head?(this.#tail.next=node,this.#tail=node):(this.#head=node,this.#tail=node),this.#size++}dequeue(){let current=this.#head;if(!!current)return this.#head=this.#head.next,this.#size--,current.value}clear(){this.#head=void 0,this.#tail=void 0,this.#size=0}get size(){return this.#size}*[Symbol.iterator](){let current=this.#head;for(;current;)yield current.value,current=current.next}};function pLimit(concurrency){if(!((Number.isInteger(concurrency)||concurrency===Number.POSITIVE_INFINITY)&&concurrency>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let queue=new Queue,activeCount=0,next=()=>{activeCount--,queue.size>0&&queue.dequeue()()},run2=async(fn,resolve4,args)=>{activeCount++;let result=(async()=>fn(...args))();resolve4(result);try{await result}catch{}next()},enqueue=(fn,resolve4,args)=>{queue.enqueue(run2.bind(void 0,fn,resolve4,args)),(async()=>{await Promise.resolve(),activeCount<concurrency&&queue.size>0&&queue.dequeue()()})()},generator=(fn,...args)=>new Promise(resolve4=>{enqueue(fn,resolve4,args)});return Object.defineProperties(generator,{activeCount:{get:()=>activeCount},pendingCount:{get:()=>queue.size},clearQueue:{value:()=>{queue.clear()}}}),generator}var EndError=class extends Error{constructor(value){super();this.value=value}},testElement=async(element,tester)=>tester(await element),finder=async element=>{let values=await Promise.all(element);if(values[1]===!0)throw new EndError(values[0]);return!1};async function pLocate(iterable,tester,{concurrency=Number.POSITIVE_INFINITY,preserveOrder=!0}={}){let limit=pLimit(concurrency),items=[...iterable].map(element=>[element,limit(testElement,element,tester)]),checkLimit=pLimit(preserveOrder?1:Number.POSITIVE_INFINITY);try{await Promise.all(items.map(element=>checkLimit(finder,element)))}catch(error){if(error instanceof EndError)return error.value;throw error}}var typeMappings={directory:"isDirectory",file:"isFile"};function checkType(type){if(!(type in typeMappings))throw new Error(`Invalid type specified: ${type}`)}var matchType=(type,stat)=>type===void 0||stat[typeMappings[type]]();async function locatePath(paths,{cwd=process2.cwd(),type="file",allowSymlinks=!0,concurrency,preserveOrder}={}){checkType(type);let statFunction=allowSymlinks?fsPromises.stat:fsPromises.lstat;return pLocate(paths,async path_=>{try{let stat=await statFunction(path.resolve(cwd,path_));return matchType(type,stat)}catch{return!1}},{concurrency,preserveOrder})}init_esm_shims();import fs2,{promises as fsPromises2}from"node:fs";var findUpStop=Symbol("findUpStop");async function findUpMultiple(name,options={}){let directory=path2.resolve(options.cwd||""),{root}=path2.parse(directory),stopAt=path2.resolve(directory,options.stopAt||root),limit=options.limit||Number.POSITIVE_INFINITY,paths=[name].flat(),runMatcher=async locateOptions=>{if(typeof name!="function")return locatePath(paths,locateOptions);let foundPath=await name(locateOptions.cwd);return typeof foundPath=="string"?locatePath([foundPath],locateOptions):foundPath},matches=[];for(;;){let foundPath=await runMatcher(__spreadProps(__spreadValues({},options),{cwd:directory}));if(foundPath===findUpStop||(foundPath&&matches.push(path2.resolve(directory,foundPath)),directory===stopAt||matches.length>=limit))break;directory=path2.dirname(directory)}return matches}async function findUp(name,options={}){return(await findUpMultiple(name,__spreadProps(__spreadValues({},options),{limit:1})))[0]}import{createServer}from"vite";var configFiles=["vitest.config.ts","vitest.config.js","vitest.config.mjs","vite.config.ts","vite.config.js","vite.config.mjs"];async function initViteServer(options={}){var _a,_b,_c,_d;let{filters}=options,root=resolve2(options.root||process.cwd());process.chdir(root);let configPath=options.config?resolve2(root,options.config):await findUp(configFiles,{cwd:root}),resolved=__spreadValues({},options);resolved.config=configPath,resolved.root=root,resolved.filters=filters?Array.isArray(filters)?filters:[filters]:void 0;let server=await createServer({root,logLevel:"error",clearScreen:!1,configFile:resolved.config,optimizeDeps:{exclude:["vitest"]}});return await server.pluginContainer.buildStart({}),Object.assign(resolved,server.config.test),resolved.depsInline=["vitest/dist","vitest/src","@vue","@vueuse","vue-demi","vue",/virtual:/,/\.ts$/,/\/esm\/.*\.js$/,/\.(es|esm|esm-browser|esm-bundler|es6).js$/,...((_b=(_a=server.config.test)==null?void 0:_a.deps)==null?void 0:_b.inline)||[]],resolved.depsExternal=[/node_modules/,...((_d=(_c=server.config.test)==null?void 0:_c.deps)==null?void 0:_d.external)||[]],{server,config:resolved}}sade("vitest [filter]",!0).version(version).describe("A blazing fast unit test framework powered by Vite.").option("-r, --root","root path",process.cwd()).option("-c, --config","path to config file").option("-w, --watch","watch mode",!1).option("-u, --update","update snapshot",!1).option("--global","inject apis globally",!1).option("--dom","mock browser api using jsdom or happy-dom","").action(async(filters,argv)=>{process.env.VITEST="true",console.log(c.yellow(c.bold(`
5
5
  Vitest is currently in closed beta exclusively for Sponsors`))),console.log(c.magenta(`Become a Sponsor of ${c.underline("https://github.com/sponsors/patak-js")} or ${c.underline("https://github.com/sponsors/antfu")}
6
6
  to access the source code and issues tracker \u{1F496}
7
7
  `));let{config,server}=await initViteServer(__spreadProps(__spreadValues({},argv),{filters})),moduleCache=new Map;process.__vitest__={server,config,moduleCache},await run(server,config,moduleCache,[resolve3(distDir,"./node/entry.js")])}).parse(process.argv);
@@ -3,7 +3,7 @@ import{clearContext,context,createSuiteHooks,defaultSuite,getFn,getHooks,setHook
3
3
  `)+postfix,endIndex=index+1,index=string.indexOf(`
4
4
  `,endIndex)}while(index!==-1);return returnValue+=string.substr(endIndex),returnValue};module.exports={stringReplaceAll,stringEncaseCRLFWithFirstIndex}}});var require_templates=__commonJS({"node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js"(exports,module){init_esm_shims();"use strict";var TEMPLATE_REGEX=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,STYLE_REGEX=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,STRING_REGEX=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,ESCAPE_REGEX=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,ESCAPES3=new Map([["n",`
5
5
  `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a","\x07"]]);function unescape(c5){let u=c5[0]==="u",bracket=c5[1]==="{";return u&&!bracket&&c5.length===5||c5[0]==="x"&&c5.length===3?String.fromCharCode(parseInt(c5.slice(1),16)):u&&bracket?String.fromCodePoint(parseInt(c5.slice(2,-1),16)):ESCAPES3.get(c5)||c5}function parseArguments(name,arguments_){let results=[],chunks=arguments_.trim().split(/\s*,\s*/g),matches;for(let chunk of chunks){let number=Number(chunk);if(!Number.isNaN(number))results.push(number);else if(matches=chunk.match(STRING_REGEX))results.push(matches[2].replace(ESCAPE_REGEX,(m,escape,character)=>escape?unescape(escape):character));else throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`)}return results}function parseStyle(style){STYLE_REGEX.lastIndex=0;let results=[],matches;for(;(matches=STYLE_REGEX.exec(style))!==null;){let name=matches[1];if(matches[2]){let args=parseArguments(name,matches[2]);results.push([name].concat(args))}else results.push([name])}return results}function buildStyle(chalk,styles){let enabled={};for(let layer of styles)for(let style of layer.styles)enabled[style[0]]=layer.inverse?null:style.slice(1);let current=chalk;for(let[styleName,styles2]of Object.entries(enabled))if(!!Array.isArray(styles2)){if(!(styleName in current))throw new Error(`Unknown Chalk style: ${styleName}`);current=styles2.length>0?current[styleName](...styles2):current[styleName]}return current}module.exports=(chalk,temporary)=>{let styles=[],chunks=[],chunk=[];if(temporary.replace(TEMPLATE_REGEX,(m,escapeCharacter,inverse,style,close,character)=>{if(escapeCharacter)chunk.push(unescape(escapeCharacter));else if(style){let string=chunk.join("");chunk=[],chunks.push(styles.length===0?string:buildStyle(chalk,styles)(string)),styles.push({inverse,styles:parseStyle(style)})}else if(close){if(styles.length===0)throw new Error("Found extraneous } in Chalk template literal");chunks.push(buildStyle(chalk,styles)(chunk.join(""))),chunk=[],styles.pop()}else chunk.push(character)}),chunks.push(chunk.join("")),styles.length>0){let errMessage=`Chalk template literal is missing ${styles.length} closing bracket${styles.length===1?"":"s"} (\`}\`)`;throw new Error(errMessage)}return chunks.join("")}}});var require_source=__commonJS({"node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js"(exports,module){init_esm_shims();"use strict";var ansiStyles2=require_ansi_styles(),{stdout:stdoutColor,stderr:stderrColor}=require_supports_color(),{stringReplaceAll,stringEncaseCRLFWithFirstIndex}=require_util(),{isArray}=Array,levelMapping=["ansi","ansi","ansi256","ansi16m"],styles=Object.create(null),applyOptions=(object,options={})=>{if(options.level&&!(Number.isInteger(options.level)&&options.level>=0&&options.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let colorLevel=stdoutColor?stdoutColor.level:0;object.level=options.level===void 0?colorLevel:options.level},ChalkClass=class{constructor(options){return chalkFactory(options)}},chalkFactory=options=>{let chalk2={};return applyOptions(chalk2,options),chalk2.template=(...arguments_)=>chalkTag(chalk2.template,...arguments_),Object.setPrototypeOf(chalk2,Chalk.prototype),Object.setPrototypeOf(chalk2.template,chalk2),chalk2.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},chalk2.template.Instance=ChalkClass,chalk2.template};function Chalk(options){return chalkFactory(options)}for(let[styleName,style]of Object.entries(ansiStyles2))styles[styleName]={get(){let builder=createBuilder(this,createStyler(style.open,style.close,this._styler),this._isEmpty);return Object.defineProperty(this,styleName,{value:builder}),builder}};styles.visible={get(){let builder=createBuilder(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:builder}),builder}};var usedModels=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let model of usedModels)styles[model]={get(){let{level}=this;return function(...arguments_){let styler=createStyler(ansiStyles2.color[levelMapping[level]][model](...arguments_),ansiStyles2.color.close,this._styler);return createBuilder(this,styler,this._isEmpty)}}};for(let model of usedModels){let bgModel="bg"+model[0].toUpperCase()+model.slice(1);styles[bgModel]={get(){let{level}=this;return function(...arguments_){let styler=createStyler(ansiStyles2.bgColor[levelMapping[level]][model](...arguments_),ansiStyles2.bgColor.close,this._styler);return createBuilder(this,styler,this._isEmpty)}}}}var proto=Object.defineProperties(()=>{},__spreadProps(__spreadValues({},styles),{level:{enumerable:!0,get(){return this._generator.level},set(level){this._generator.level=level}}})),createStyler=(open,close,parent)=>{let openAll,closeAll;return parent===void 0?(openAll=open,closeAll=close):(openAll=parent.openAll+open,closeAll=close+parent.closeAll),{open,close,openAll,closeAll,parent}},createBuilder=(self,_styler,_isEmpty)=>{let builder=(...arguments_)=>isArray(arguments_[0])&&isArray(arguments_[0].raw)?applyStyle(builder,chalkTag(builder,...arguments_)):applyStyle(builder,arguments_.length===1?""+arguments_[0]:arguments_.join(" "));return Object.setPrototypeOf(builder,proto),builder._generator=self,builder._styler=_styler,builder._isEmpty=_isEmpty,builder},applyStyle=(self,string)=>{if(self.level<=0||!string)return self._isEmpty?"":string;let styler=self._styler;if(styler===void 0)return string;let{openAll,closeAll}=styler;if(string.indexOf("")!==-1)for(;styler!==void 0;)string=stringReplaceAll(string,styler.close,styler.open),styler=styler.parent;let lfIndex=string.indexOf(`
6
- `);return lfIndex!==-1&&(string=stringEncaseCRLFWithFirstIndex(string,closeAll,openAll,lfIndex)),openAll+string+closeAll},template,chalkTag=(chalk2,...strings)=>{let[firstString]=strings;if(!isArray(firstString)||!isArray(firstString.raw))return strings.join(" ");let arguments_=strings.slice(1),parts=[firstString.raw[0]];for(let i=1;i<firstString.length;i++)parts.push(String(arguments_[i-1]).replace(/[{}\\]/g,"\\$&"),String(firstString.raw[i]));return template===void 0&&(template=require_templates()),template(chalk2,parts.join(""))};Object.defineProperties(Chalk.prototype,styles);var chalk=Chalk();chalk.supportsColor=stdoutColor;chalk.stderr=Chalk({level:stderrColor?stderrColor.level:0});chalk.stderr.supportsColor=stderrColor;module.exports=chalk}});var require_is_unicode_supported=__commonJS({"node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js"(exports,module){init_esm_shims();"use strict";module.exports=()=>process.platform!=="win32"?!0:Boolean(process.env.CI)||Boolean(process.env.WT_SESSION)||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}});var require_log_symbols=__commonJS({"node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js"(exports,module){init_esm_shims();"use strict";var chalk=require_source(),isUnicodeSupported=require_is_unicode_supported(),main={info:chalk.blue("\u2139"),success:chalk.green("\u2714"),warning:chalk.yellow("\u26A0"),error:chalk.red("\u2716")},fallback={info:chalk.blue("i"),success:chalk.green("\u221A"),warning:chalk.yellow("\u203C"),error:chalk.red("\xD7")};module.exports=isUnicodeSupported()?main:fallback}});var require_sinon_chai=__commonJS({"node_modules/.pnpm/sinon-chai@3.7.0_chai@4.3.4+sinon@12.0.1/node_modules/sinon-chai/lib/sinon-chai.js"(exports,module){init_esm_shims();"use strict";(function(sinonChai){typeof __require=="function"&&typeof exports=="object"&&typeof module=="object"?module.exports=sinonChai:typeof define=="function"&&define.amd?define(function(){return sinonChai}):chai.use(sinonChai)})(function(chai4,utils){var slice=Array.prototype.slice;function isSpy(putativeSpy){return typeof putativeSpy=="function"&&typeof putativeSpy.getCall=="function"&&typeof putativeSpy.calledWithExactly=="function"}function timesInWords(count){switch(count){case 1:return"once";case 2:return"twice";case 3:return"thrice";default:return(count||0)+" times"}}function isCall(putativeCall){return putativeCall&&isSpy(putativeCall.proxy)}function assertCanWorkWith(assertion){if(!isSpy(assertion._obj)&&!isCall(assertion._obj))throw new TypeError(utils.inspect(assertion._obj)+" is not a spy or a call to a spy!")}function getMessages(spy,action,nonNegatedSuffix,always,args){var verbPhrase=always?"always have ":"have ";nonNegatedSuffix=nonNegatedSuffix||"",isSpy(spy.proxy)&&(spy=spy.proxy);function printfArray(array){return spy.printf.apply(spy,array)}return{affirmative:function(){return printfArray(["expected %n to "+verbPhrase+action+nonNegatedSuffix].concat(args))},negative:function(){return printfArray(["expected %n to not "+verbPhrase+action].concat(args))}}}function sinonProperty(name,action,nonNegatedSuffix){utils.addProperty(chai4.Assertion.prototype,name,function(){assertCanWorkWith(this);var messages=getMessages(this._obj,action,nonNegatedSuffix,!1);this.assert(this._obj[name],messages.affirmative,messages.negative)})}function sinonPropertyAsBooleanMethod(name,action,nonNegatedSuffix){utils.addMethod(chai4.Assertion.prototype,name,function(arg){assertCanWorkWith(this);var messages=getMessages(this._obj,action,nonNegatedSuffix,!1,[timesInWords(arg)]);this.assert(this._obj[name]===arg,messages.affirmative,messages.negative)})}function createSinonMethodHandler(sinonName,action,nonNegatedSuffix){return function(){assertCanWorkWith(this);var alwaysSinonMethod="always"+sinonName[0].toUpperCase()+sinonName.substring(1),shouldBeAlways=utils.flag(this,"always")&&typeof this._obj[alwaysSinonMethod]=="function",sinonMethodName=shouldBeAlways?alwaysSinonMethod:sinonName,messages=getMessages(this._obj,action,nonNegatedSuffix,shouldBeAlways,slice.call(arguments));this.assert(this._obj[sinonMethodName].apply(this._obj,arguments),messages.affirmative,messages.negative)}}function sinonMethodAsProperty(name,action,nonNegatedSuffix){var handler=createSinonMethodHandler(name,action,nonNegatedSuffix);utils.addProperty(chai4.Assertion.prototype,name,handler)}function exceptionalSinonMethod(chaiName,sinonName,action,nonNegatedSuffix){var handler=createSinonMethodHandler(sinonName,action,nonNegatedSuffix);utils.addMethod(chai4.Assertion.prototype,chaiName,handler)}function sinonMethod(name,action,nonNegatedSuffix){exceptionalSinonMethod(name,name,action,nonNegatedSuffix)}utils.addProperty(chai4.Assertion.prototype,"always",function(){utils.flag(this,"always",!0)}),sinonProperty("called","been called"," at least once, but it was never called"),sinonPropertyAsBooleanMethod("callCount","been called exactly %1",", but it was called %c%C"),sinonProperty("calledOnce","been called exactly once",", but it was called %c%C"),sinonProperty("calledTwice","been called exactly twice",", but it was called %c%C"),sinonProperty("calledThrice","been called exactly thrice",", but it was called %c%C"),sinonMethodAsProperty("calledWithNew","been called with new"),sinonMethod("calledBefore","been called before %1"),sinonMethod("calledAfter","been called after %1"),sinonMethod("calledImmediatelyBefore","been called immediately before %1"),sinonMethod("calledImmediatelyAfter","been called immediately after %1"),sinonMethod("calledOn","been called with %1 as this",", but it was called with %t instead"),sinonMethod("calledWith","been called with arguments %*","%D"),sinonMethod("calledOnceWith","been called exactly once with arguments %*","%D"),sinonMethod("calledWithExactly","been called with exact arguments %*","%D"),sinonMethod("calledOnceWithExactly","been called exactly once with exact arguments %*","%D"),sinonMethod("calledWithMatch","been called with arguments matching %*","%D"),sinonMethod("returned","returned %1"),exceptionalSinonMethod("thrown","threw","thrown %1")})}});init_esm_shims();init_esm_shims();import{performance as performance3}from"perf_hooks";init_esm_shims();import Snap2 from"jest-snapshot";init_esm_shims();import chai2 from"chai";import Snap from"jest-snapshot";init_esm_shims();import Test from"@jest/test-result";var{makeEmptyAggregatedTestResult}=Test,makeEmptySnapshotSummary=options=>{let summary=makeEmptyAggregatedTestResult().snapshot;return summary.didUpdate=options.updateSnapshot==="all",summary},packSnapshotState=snapshotState=>{let snapshot={added:0,fileDeleted:!1,matched:0,unchecked:0,uncheckedKeys:[],unmatched:0,updated:0},uncheckedCount=snapshotState.getUncheckedCount(),uncheckedKeys=snapshotState.getUncheckedKeys();uncheckedCount&&snapshotState.removeUncheckedKeys();let status=snapshotState.save();return snapshot.fileDeleted=status.deleted,snapshot.added=snapshotState.added,snapshot.matched=snapshotState.matched,snapshot.unmatched=snapshotState.unmatched,snapshot.updated=snapshotState.updated,snapshot.unchecked=status.deleted?0:uncheckedCount,snapshot.uncheckedKeys=Array.from(uncheckedKeys),snapshot},addSnapshotResult=(snapshotSummary,snapshotResult,testFilePath)=>{snapshotResult.added&&snapshotSummary.filesAdded++,snapshotResult.fileDeleted&&snapshotSummary.filesRemoved++,snapshotResult.unmatched&&snapshotSummary.filesUnmatched++,snapshotResult.updated&&snapshotSummary.filesUpdated++,snapshotSummary.added+=snapshotResult.added,snapshotSummary.matched+=snapshotResult.matched,snapshotSummary.unchecked+=snapshotResult.unchecked,snapshotResult.uncheckedKeys&&snapshotResult.uncheckedKeys.length>0&&snapshotSummary.uncheckedKeysByFile.push({filePath:testFilePath,keys:snapshotResult.uncheckedKeys}),snapshotSummary.unmatched+=snapshotResult.unmatched,snapshotSummary.updated+=snapshotResult.updated,snapshotSummary.total+=snapshotResult.added+snapshotResult.matched+snapshotResult.unmatched+snapshotResult.updated};init_esm_shims();var import_slash=__toModule(require_slash());import path,{isAbsolute}from"path";import{pluralize}from"jest-util";import c from"picocolors";var formatTestPath=(rootDir,testPath)=>{isAbsolute(testPath)&&(testPath=path.relative(rootDir,testPath));let dirname=path.dirname(testPath),basename2=path.basename(testPath);return(0,import_slash.default)(c.dim(dirname+path.sep)+c.bold(basename2))},ARROW=" \u203A ",DOWN_ARROW=" \u21B3 ",DOT=" \u2022 ",FAIL_COLOR=v=>c.bold(c.red(v)),OBSOLETE_COLOR=v=>c.bold(c.yellow(v)),SNAPSHOT_ADDED=v=>c.bold(c.green(v)),SNAPSHOT_NOTE=c.dim,SNAPSHOT_REMOVED=v=>c.bold(c.green(v)),SNAPSHOT_SUMMARY=c.bold,SNAPSHOT_UPDATED=v=>c.bold(c.green(v)),updateCommand="re-run mocha with `--update` to update them",getSnapshotSummaryOutput=(rootDir,snapshots)=>{let summary=[];if(summary.push(SNAPSHOT_SUMMARY("Snapshot Summary")),snapshots.added&&summary.push(`${SNAPSHOT_ADDED(`${ARROW+pluralize("snapshot",snapshots.added)} written `)}from ${pluralize("test suite",snapshots.filesAdded)}.`),snapshots.unmatched&&summary.push(`${FAIL_COLOR(`${ARROW}${pluralize("snapshot",snapshots.unmatched)} failed`)} from ${pluralize("test suite",snapshots.filesUnmatched)}. ${SNAPSHOT_NOTE(`Inspect your code changes or ${updateCommand} to update them.`)}`),snapshots.updated&&summary.push(`${SNAPSHOT_UPDATED(`${ARROW+pluralize("snapshot",snapshots.updated)} updated `)}from ${pluralize("test suite",snapshots.filesUpdated)}.`),snapshots.filesRemoved&&(snapshots.didUpdate?summary.push(`${SNAPSHOT_REMOVED(`${ARROW}${pluralize("snapshot file",snapshots.filesRemoved)} removed `)}from ${pluralize("test suite",snapshots.filesRemoved)}.`):summary.push(`${OBSOLETE_COLOR(`${ARROW}${pluralize("snapshot file",snapshots.filesRemoved)} obsolete `)}from ${pluralize("test suite",snapshots.filesRemoved)}. ${SNAPSHOT_NOTE(`To remove ${snapshots.filesRemoved===1?"it":"them all"}, ${updateCommand}.`)}`)),snapshots.filesRemovedList&&snapshots.filesRemovedList.length){let[head,...tail]=snapshots.filesRemovedList;summary.push(` ${DOWN_ARROW} ${DOT}${formatTestPath(rootDir,head)}`),tail.forEach(key=>{summary.push(` ${DOT}${formatTestPath(rootDir,key)}`)})}return snapshots.unchecked&&(snapshots.didUpdate?summary.push(`${SNAPSHOT_REMOVED(`${ARROW}${pluralize("snapshot",snapshots.unchecked)} removed `)}from ${pluralize("test suite",snapshots.uncheckedKeysByFile.length)}.`):summary.push(`${OBSOLETE_COLOR(`${ARROW}${pluralize("snapshot",snapshots.unchecked)} obsolete `)}from ${pluralize("test suite",snapshots.uncheckedKeysByFile.length)}. ${SNAPSHOT_NOTE(`To remove ${snapshots.unchecked===1?"it":"them all"}, ${updateCommand}.`)}`),snapshots.uncheckedKeysByFile.forEach(uncheckedFile=>{summary.push(` ${DOWN_ARROW}${formatTestPath(rootDir,uncheckedFile.filePath)}`),uncheckedFile.keys.forEach(key=>{summary.push(` ${DOT}${key}`)})})),summary};var{expect}=chai2,{SnapshotState}=Snap,SnapshotManager=class{snapshotState=null;snapshotSummary;snapshotOptions;ctx=null;testFile="";snapshotResolver;rootDir;constructor({rootDir,update,snapshotResolver=null}){this.rootDir=rootDir,this.snapshotResolver=snapshotResolver;let env=process.env,CI=!!env.CI,UPDATE_SNAPSHOT=update||env.UPDATE_SNAPSHOT;this.snapshotOptions={updateSnapshot:CI&&!UPDATE_SNAPSHOT?"none":UPDATE_SNAPSHOT?"all":"new"},this.snapshotSummary=makeEmptySnapshotSummary(this.snapshotOptions)}onFileChanged(){!this.ctx||(this.snapshotState!==null&&this.saveSnap(),this.testFile=this.ctx.file,this.snapshotState=new SnapshotState(this.snapshotResolver.resolveSnapshotPath(this.testFile),this.snapshotOptions))}setTest(test){var _a;this.setContext({file:((_a=test.file)==null?void 0:_a.filepath)||test.name,title:test.name,fullTitle:[test.suite.name,test.name].filter(Boolean).join(" > ")})}setContext(context2){!context2.title||!context2.file||(this.ctx=context2,this.testFile!==context2.file&&this.onFileChanged())}assert(received,message){if(!this.snapshotState||!this.ctx)return;let{actual,expected,key,pass}=this.snapshotState.match({testName:this.ctx.fullTitle||this.ctx.title||this.ctx.file,received,isInline:!1});pass||expect(actual.trim()).equals(expected?expected.trim():"",message||`Snapshot name: \`${key}\``)}clear(){this.snapshotSummary=makeEmptySnapshotSummary(this.snapshotOptions)}saveSnap(){if(!this.testFile||!this.snapshotState)return;let packedSnapshotState=packSnapshotState(this.snapshotState);addSnapshotResult(this.snapshotSummary,packedSnapshotState,this.testFile),this.testFile="",this.snapshotState=null}report(){let outputs=getSnapshotSummaryOutput(this.rootDir,this.snapshotSummary);if(outputs.length>1)return outputs}};var{addSerializer}=Snap2,_manager;function getSnapshotManager(){return _manager}async function SnapshotPlugin(options){let{root:rootDir}=options;return _manager=new SnapshotManager({rootDir,update:options.update}),_manager.snapshotResolver=await Snap2.buildSnapshotResolver({transform:[],rootDir}),function(chai4,utils){for(let key of["matchSnapshot","toMatchSnapshot"])utils.addMethod(chai4.Assertion.prototype,key,function(message){let expected=utils.flag(this,"object");_manager.assert(expected,message)});chai4.expect.addSnapshotSerializer=addSerializer}}init_esm_shims();import{slash as slash2}from"@antfu/utils";init_esm_shims();import{basename}from"path";import{performance}from"perf_hooks";init_esm_shims();import{toArray}from"@antfu/utils";function partitionSuiteChildren(suite){let tasksGroup=[],tasksGroups=[];for(let c5 of suite.tasks)tasksGroup.length===0||c5.computeMode===tasksGroup[0].computeMode?tasksGroup.push(c5):(tasksGroups.push(tasksGroup),tasksGroup=[c5]);return tasksGroup.length>0&&tasksGroups.push(tasksGroup),tasksGroups}function interpretOnlyMode(items){items.some(i=>i.mode==="only")&&items.forEach(i=>{i.mode==="run"?i.mode="skip":i.mode==="only"&&(i.mode="run")})}function getTests(suite){return toArray(suite).flatMap(s=>s.tasks.flatMap(c5=>c5.type==="test"?[c5]:getTests(c5)))}function getSuites(suite){return toArray(suite).flatMap(s=>s.type==="suite"?[s,...getSuites(s.tasks)]:[])}function hasTests(suite){return toArray(suite).some(s=>s.tasks.some(c5=>c5.type==="test"||hasTests(c5)))}function hasFailed(suite){return toArray(suite).some(s=>s.tasks.some(c5=>{var _a;return((_a=c5.result)==null?void 0:_a.state)==="fail"}))}async function collectTests(paths){let files={};for(let filepath of paths){let file={name:basename(filepath),type:"suite",mode:"run",computeMode:"serial",filepath,tasks:[],suite:{}};setHooks(file,createSuiteHooks()),clearContext();try{await import(filepath);for(let c5 of[defaultSuite,...context.tasks])if(c5.type==="test")file.tasks.push(c5);else{let suite=await c5.collect(file);(suite.name||suite.tasks.length)&&file.tasks.push(suite)}}catch(e){file.result={start:performance.now(),state:"fail",error:e},process.exitCode=1}files[filepath]=file}let allChildren=Object.values(files).reduce((tasks,file)=>tasks.concat(file.tasks),[]);return interpretOnlyMode(allChildren),allChildren.forEach(i=>{i.type==="suite"&&(i.mode==="skip"?i.tasks.forEach(c5=>c5.mode==="run"&&(c5.mode="skip")):interpretOnlyMode(i.tasks))}),files}async function startWatcher(ctx){var _a;let{reporter,snapshotManager,filesMap}=ctx;await((_a=reporter.onWatcherStart)==null?void 0:_a.call(reporter,ctx));let timer2,changedTests=new Set,seen=new Set,{server,moduleCache}=process.__vitest__;server.watcher.on("change",async id=>{id=slash2(id),getAffectedTests(id,ctx,changedTests,seen),seen.forEach(i=>moduleCache.delete(i)),seen.clear(),changedTests.size!==0&&(clearTimeout(timer2),timer2=setTimeout(async()=>{var _a2,_b,_c,_d;if(changedTests.size===0)return;snapshotManager.clear();let paths=Array.from(changedTests);changedTests.clear(),await((_a2=reporter.onWatcherRerun)==null?void 0:_a2.call(reporter,paths,id,ctx)),paths.forEach(i=>moduleCache.delete(i));let newFilesMap=await collectTests(paths);Object.assign(filesMap,newFilesMap);let files=Object.values(filesMap);(_b=reporter.onCollected)==null||_b.call(reporter,files,ctx),await runSuites(files,ctx),snapshotManager.saveSnap(),await((_c=reporter.onFinished)==null?void 0:_c.call(reporter,ctx,Object.values(newFilesMap))),await((_d=reporter.onWatcherStart)==null?void 0:_d.call(reporter,ctx))},100))}),await new Promise(()=>{})}function getAffectedTests(id,ctx,set=new Set,seen=new Set){if(seen.has(id)||set.has(id))return set;if(seen.add(id),id in ctx.filesMap)return set.add(id),set;let mod=process.__vitest__.server.moduleGraph.getModuleById(id);return mod&&mod.importers.forEach(i=>{i.id&&getAffectedTests(i.id,ctx,set,seen)}),set}init_esm_shims();import fg from"fast-glob";async function globTestFiles(config){var _a;let testFilepaths=await fg(config.includes||defaultIncludes,{absolute:!0,cwd:config.root,ignore:config.excludes||defaultExcludes});return((_a=config.filters)==null?void 0:_a.length)&&(testFilepaths=testFilepaths.filter(i=>config.filters.some(f=>i.includes(f)))),testFilepaths}init_esm_shims();init_esm_shims();import{performance as performance2}from"perf_hooks";import{relative}from"path";import c4 from"picocolors";init_esm_shims();import{promises as fs,existsSync}from"fs";import c2 from"picocolors";init_esm_shims();function Diff(){}Diff.prototype={diff:function(oldString,newString){var options=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},callback=options.callback;typeof options=="function"&&(callback=options,options={}),this.options=options;var self=this;function done(value){return callback?(setTimeout(function(){callback(void 0,value)},0),!0):value}oldString=this.castInput(oldString),newString=this.castInput(newString),oldString=this.removeEmpty(this.tokenize(oldString)),newString=this.removeEmpty(this.tokenize(newString));var newLen=newString.length,oldLen=oldString.length,editLength=1,maxEditLength=newLen+oldLen,bestPath=[{newPos:-1,components:[]}],oldPos=this.extractCommon(bestPath[0],newString,oldString,0);if(bestPath[0].newPos+1>=newLen&&oldPos+1>=oldLen)return done([{value:this.join(newString),count:newString.length}]);function execEditLength(){for(var diagonalPath=-1*editLength;diagonalPath<=editLength;diagonalPath+=2){var basePath=void 0,addPath=bestPath[diagonalPath-1],removePath=bestPath[diagonalPath+1],_oldPos=(removePath?removePath.newPos:0)-diagonalPath;addPath&&(bestPath[diagonalPath-1]=void 0);var canAdd=addPath&&addPath.newPos+1<newLen,canRemove=removePath&&0<=_oldPos&&_oldPos<oldLen;if(!canAdd&&!canRemove){bestPath[diagonalPath]=void 0;continue}if(!canAdd||canRemove&&addPath.newPos<removePath.newPos?(basePath=clonePath(removePath),self.pushComponent(basePath.components,void 0,!0)):(basePath=addPath,basePath.newPos++,self.pushComponent(basePath.components,!0,void 0)),_oldPos=self.extractCommon(basePath,newString,oldString,diagonalPath),basePath.newPos+1>=newLen&&_oldPos+1>=oldLen)return done(buildValues(self,basePath.components,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath}editLength++}if(callback)(function exec2(){setTimeout(function(){if(editLength>maxEditLength)return callback();execEditLength()||exec2()},0)})();else for(;editLength<=maxEditLength;){var ret=execEditLength();if(ret)return ret}},pushComponent:function(components,added,removed){var last=components[components.length-1];last&&last.added===added&&last.removed===removed?components[components.length-1]={count:last.count+1,added,removed}:components.push({count:1,added,removed})},extractCommon:function(basePath,newString,oldString,diagonalPath){for(var newLen=newString.length,oldLen=oldString.length,newPos=basePath.newPos,oldPos=newPos-diagonalPath,commonCount=0;newPos+1<newLen&&oldPos+1<oldLen&&this.equals(newString[newPos+1],oldString[oldPos+1]);)newPos++,oldPos++,commonCount++;return commonCount&&basePath.components.push({count:commonCount}),basePath.newPos=newPos,oldPos},equals:function(left,right){return this.options.comparator?this.options.comparator(left,right):left===right||this.options.ignoreCase&&left.toLowerCase()===right.toLowerCase()},removeEmpty:function(array){for(var ret=[],i=0;i<array.length;i++)array[i]&&ret.push(array[i]);return ret},castInput:function(value){return value},tokenize:function(value){return value.split("")},join:function(chars){return chars.join("")}};function buildValues(diff3,components,newString,oldString,useLongestToken){for(var componentPos=0,componentLen=components.length,newPos=0,oldPos=0;componentPos<componentLen;componentPos++){var component=components[componentPos];if(component.removed){if(component.value=diff3.join(oldString.slice(oldPos,oldPos+component.count)),oldPos+=component.count,componentPos&&components[componentPos-1].added){var tmp=components[componentPos-1];components[componentPos-1]=components[componentPos],components[componentPos]=tmp}}else{if(!component.added&&useLongestToken){var value=newString.slice(newPos,newPos+component.count);value=value.map(function(value2,i){var oldValue=oldString[oldPos+i];return oldValue.length>value2.length?oldValue:value2}),component.value=diff3.join(value)}else component.value=diff3.join(newString.slice(newPos,newPos+component.count));newPos+=component.count,component.added||(oldPos+=component.count)}}var lastComponent=components[componentLen-1];return componentLen>1&&typeof lastComponent.value=="string"&&(lastComponent.added||lastComponent.removed)&&diff3.equals("",lastComponent.value)&&(components[componentLen-2].value+=lastComponent.value,components.pop()),components}function clonePath(path2){return{newPos:path2.newPos,components:path2.components.slice(0)}}var characterDiff=new Diff;var extendedWordChars=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,reWhitespace=/\S/,wordDiff=new Diff;wordDiff.equals=function(left,right){return this.options.ignoreCase&&(left=left.toLowerCase(),right=right.toLowerCase()),left===right||this.options.ignoreWhitespace&&!reWhitespace.test(left)&&!reWhitespace.test(right)};wordDiff.tokenize=function(value){for(var tokens=value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),i=0;i<tokens.length-1;i++)!tokens[i+1]&&tokens[i+2]&&extendedWordChars.test(tokens[i])&&extendedWordChars.test(tokens[i+2])&&(tokens[i]+=tokens[i+2],tokens.splice(i+1,2),i--);return tokens};var lineDiff=new Diff;lineDiff.tokenize=function(value){var retLines=[],linesAndNewlines=value.split(/(\n|\r\n)/);linesAndNewlines[linesAndNewlines.length-1]||linesAndNewlines.pop();for(var i=0;i<linesAndNewlines.length;i++){var line=linesAndNewlines[i];i%2&&!this.options.newlineIsToken?retLines[retLines.length-1]+=line:(this.options.ignoreWhitespace&&(line=line.trim()),retLines.push(line))}return retLines};function diffLines(oldStr,newStr,callback){return lineDiff.diff(oldStr,newStr,callback)}var sentenceDiff=new Diff;sentenceDiff.tokenize=function(value){return value.split(/(\S.+?[.!?])(?=\s+|$)/)};var cssDiff=new Diff;cssDiff.tokenize=function(value){return value.split(/([{}:;,]|\s+)/)};function _typeof(obj){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(obj2){return typeof obj2}:_typeof=function(obj2){return obj2&&typeof Symbol=="function"&&obj2.constructor===Symbol&&obj2!==Symbol.prototype?"symbol":typeof obj2},_typeof(obj)}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _iterableToArray(iter){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(iter))return Array.from(iter)}function _unsupportedIterableToArray(o,minLen){if(!!o){if(typeof o=="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor&&(n=o.constructor.name),n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}}function _arrayLikeToArray(arr,len){(len==null||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
6
+ `);return lfIndex!==-1&&(string=stringEncaseCRLFWithFirstIndex(string,closeAll,openAll,lfIndex)),openAll+string+closeAll},template,chalkTag=(chalk2,...strings)=>{let[firstString]=strings;if(!isArray(firstString)||!isArray(firstString.raw))return strings.join(" ");let arguments_=strings.slice(1),parts=[firstString.raw[0]];for(let i=1;i<firstString.length;i++)parts.push(String(arguments_[i-1]).replace(/[{}\\]/g,"\\$&"),String(firstString.raw[i]));return template===void 0&&(template=require_templates()),template(chalk2,parts.join(""))};Object.defineProperties(Chalk.prototype,styles);var chalk=Chalk();chalk.supportsColor=stdoutColor;chalk.stderr=Chalk({level:stderrColor?stderrColor.level:0});chalk.stderr.supportsColor=stderrColor;module.exports=chalk}});var require_is_unicode_supported=__commonJS({"node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js"(exports,module){init_esm_shims();"use strict";module.exports=()=>process.platform!=="win32"?!0:Boolean(process.env.CI)||Boolean(process.env.WT_SESSION)||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}});var require_log_symbols=__commonJS({"node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js"(exports,module){init_esm_shims();"use strict";var chalk=require_source(),isUnicodeSupported2=require_is_unicode_supported(),main={info:chalk.blue("\u2139"),success:chalk.green("\u2714"),warning:chalk.yellow("\u26A0"),error:chalk.red("\u2716")},fallback={info:chalk.blue("i"),success:chalk.green("\u221A"),warning:chalk.yellow("\u203C"),error:chalk.red("\xD7")};module.exports=isUnicodeSupported2()?main:fallback}});init_esm_shims();init_esm_shims();import{performance as performance3}from"perf_hooks";init_esm_shims();import Snap2 from"jest-snapshot";init_esm_shims();import chai from"chai";import Snap from"jest-snapshot";init_esm_shims();import Test from"@jest/test-result";var{makeEmptyAggregatedTestResult}=Test,makeEmptySnapshotSummary=options=>{let summary=makeEmptyAggregatedTestResult().snapshot;return summary.didUpdate=options.updateSnapshot==="all",summary},packSnapshotState=snapshotState=>{let snapshot={added:0,fileDeleted:!1,matched:0,unchecked:0,uncheckedKeys:[],unmatched:0,updated:0},uncheckedCount=snapshotState.getUncheckedCount(),uncheckedKeys=snapshotState.getUncheckedKeys();uncheckedCount&&snapshotState.removeUncheckedKeys();let status=snapshotState.save();return snapshot.fileDeleted=status.deleted,snapshot.added=snapshotState.added,snapshot.matched=snapshotState.matched,snapshot.unmatched=snapshotState.unmatched,snapshot.updated=snapshotState.updated,snapshot.unchecked=status.deleted?0:uncheckedCount,snapshot.uncheckedKeys=Array.from(uncheckedKeys),snapshot},addSnapshotResult=(snapshotSummary,snapshotResult,testFilePath)=>{snapshotResult.added&&snapshotSummary.filesAdded++,snapshotResult.fileDeleted&&snapshotSummary.filesRemoved++,snapshotResult.unmatched&&snapshotSummary.filesUnmatched++,snapshotResult.updated&&snapshotSummary.filesUpdated++,snapshotSummary.added+=snapshotResult.added,snapshotSummary.matched+=snapshotResult.matched,snapshotSummary.unchecked+=snapshotResult.unchecked,snapshotResult.uncheckedKeys&&snapshotResult.uncheckedKeys.length>0&&snapshotSummary.uncheckedKeysByFile.push({filePath:testFilePath,keys:snapshotResult.uncheckedKeys}),snapshotSummary.unmatched+=snapshotResult.unmatched,snapshotSummary.updated+=snapshotResult.updated,snapshotSummary.total+=snapshotResult.added+snapshotResult.matched+snapshotResult.unmatched+snapshotResult.updated};init_esm_shims();var import_slash=__toModule(require_slash());import path,{isAbsolute}from"path";import{pluralize}from"jest-util";import c from"picocolors";var formatTestPath=(rootDir,testPath)=>{isAbsolute(testPath)&&(testPath=path.relative(rootDir,testPath));let dirname=path.dirname(testPath),basename2=path.basename(testPath);return(0,import_slash.default)(c.dim(dirname+path.sep)+c.bold(basename2))},ARROW=" \u203A ",DOWN_ARROW=" \u21B3 ",DOT=" \u2022 ",FAIL_COLOR=v=>c.bold(c.red(v)),OBSOLETE_COLOR=v=>c.bold(c.yellow(v)),SNAPSHOT_ADDED=v=>c.bold(c.green(v)),SNAPSHOT_NOTE=c.dim,SNAPSHOT_REMOVED=v=>c.bold(c.green(v)),SNAPSHOT_SUMMARY=c.bold,SNAPSHOT_UPDATED=v=>c.bold(c.green(v)),updateCommand="re-run mocha with `--update` to update them",getSnapshotSummaryOutput=(rootDir,snapshots)=>{let summary=[];if(summary.push(SNAPSHOT_SUMMARY("Snapshot Summary")),snapshots.added&&summary.push(`${SNAPSHOT_ADDED(`${ARROW+pluralize("snapshot",snapshots.added)} written `)}from ${pluralize("test suite",snapshots.filesAdded)}.`),snapshots.unmatched&&summary.push(`${FAIL_COLOR(`${ARROW}${pluralize("snapshot",snapshots.unmatched)} failed`)} from ${pluralize("test suite",snapshots.filesUnmatched)}. ${SNAPSHOT_NOTE(`Inspect your code changes or ${updateCommand} to update them.`)}`),snapshots.updated&&summary.push(`${SNAPSHOT_UPDATED(`${ARROW+pluralize("snapshot",snapshots.updated)} updated `)}from ${pluralize("test suite",snapshots.filesUpdated)}.`),snapshots.filesRemoved&&(snapshots.didUpdate?summary.push(`${SNAPSHOT_REMOVED(`${ARROW}${pluralize("snapshot file",snapshots.filesRemoved)} removed `)}from ${pluralize("test suite",snapshots.filesRemoved)}.`):summary.push(`${OBSOLETE_COLOR(`${ARROW}${pluralize("snapshot file",snapshots.filesRemoved)} obsolete `)}from ${pluralize("test suite",snapshots.filesRemoved)}. ${SNAPSHOT_NOTE(`To remove ${snapshots.filesRemoved===1?"it":"them all"}, ${updateCommand}.`)}`)),snapshots.filesRemovedList&&snapshots.filesRemovedList.length){let[head,...tail]=snapshots.filesRemovedList;summary.push(` ${DOWN_ARROW} ${DOT}${formatTestPath(rootDir,head)}`),tail.forEach(key=>{summary.push(` ${DOT}${formatTestPath(rootDir,key)}`)})}return snapshots.unchecked&&(snapshots.didUpdate?summary.push(`${SNAPSHOT_REMOVED(`${ARROW}${pluralize("snapshot",snapshots.unchecked)} removed `)}from ${pluralize("test suite",snapshots.uncheckedKeysByFile.length)}.`):summary.push(`${OBSOLETE_COLOR(`${ARROW}${pluralize("snapshot",snapshots.unchecked)} obsolete `)}from ${pluralize("test suite",snapshots.uncheckedKeysByFile.length)}. ${SNAPSHOT_NOTE(`To remove ${snapshots.unchecked===1?"it":"them all"}, ${updateCommand}.`)}`),snapshots.uncheckedKeysByFile.forEach(uncheckedFile=>{summary.push(` ${DOWN_ARROW}${formatTestPath(rootDir,uncheckedFile.filePath)}`),uncheckedFile.keys.forEach(key=>{summary.push(` ${DOT}${key}`)})})),summary};var{expect}=chai,{SnapshotState}=Snap,SnapshotManager=class{snapshotState=null;snapshotSummary;snapshotOptions;ctx=null;testFile="";snapshotResolver;rootDir;constructor({rootDir,update,snapshotResolver=null}){this.rootDir=rootDir,this.snapshotResolver=snapshotResolver;let env=process.env,CI=!!env.CI,UPDATE_SNAPSHOT=update||env.UPDATE_SNAPSHOT;this.snapshotOptions={updateSnapshot:CI&&!UPDATE_SNAPSHOT?"none":UPDATE_SNAPSHOT?"all":"new"},this.snapshotSummary=makeEmptySnapshotSummary(this.snapshotOptions)}onFileChanged(){!this.ctx||(this.snapshotState!==null&&this.saveSnap(),this.testFile=this.ctx.file,this.snapshotState=new SnapshotState(this.snapshotResolver.resolveSnapshotPath(this.testFile),this.snapshotOptions))}setTest(test){var _a;this.setContext({file:((_a=test.file)==null?void 0:_a.filepath)||test.name,title:test.name,fullTitle:[test.suite.name,test.name].filter(Boolean).join(" > ")})}setContext(context2){!context2.title||!context2.file||(this.ctx=context2,this.testFile!==context2.file&&this.onFileChanged())}assert(received,message){if(!this.snapshotState||!this.ctx)return;let{actual,expected,key,pass}=this.snapshotState.match({testName:this.ctx.fullTitle||this.ctx.title||this.ctx.file,received,isInline:!1});pass||expect(actual.trim()).equals(expected?expected.trim():"",message||`Snapshot name: \`${key}\``)}clear(){this.snapshotSummary=makeEmptySnapshotSummary(this.snapshotOptions)}saveSnap(){if(!this.testFile||!this.snapshotState)return;let packedSnapshotState=packSnapshotState(this.snapshotState);addSnapshotResult(this.snapshotSummary,packedSnapshotState,this.testFile),this.testFile="",this.snapshotState=null}report(){let outputs=getSnapshotSummaryOutput(this.rootDir,this.snapshotSummary);if(outputs.length>1)return outputs}};var{addSerializer}=Snap2,_manager;function getSnapshotManager(){return _manager}async function SnapshotPlugin(options){let{root:rootDir}=options;return _manager=new SnapshotManager({rootDir,update:options.update}),_manager.snapshotResolver=await Snap2.buildSnapshotResolver({transform:[],rootDir}),function(chai3,utils){for(let key of["matchSnapshot","toMatchSnapshot"])utils.addMethod(chai3.Assertion.prototype,key,function(message){let expected=utils.flag(this,"object");_manager.assert(expected,message)});chai3.expect.addSnapshotSerializer=addSerializer}}init_esm_shims();import{slash as slash2}from"@antfu/utils";init_esm_shims();import{basename}from"path";import{performance}from"perf_hooks";init_esm_shims();import{toArray}from"@antfu/utils";function partitionSuiteChildren(suite){let tasksGroup=[],tasksGroups=[];for(let c5 of suite.tasks)tasksGroup.length===0||c5.computeMode===tasksGroup[0].computeMode?tasksGroup.push(c5):(tasksGroups.push(tasksGroup),tasksGroup=[c5]);return tasksGroup.length>0&&tasksGroups.push(tasksGroup),tasksGroups}function interpretOnlyMode(items){items.some(i=>i.mode==="only")&&items.forEach(i=>{i.mode==="run"?i.mode="skip":i.mode==="only"&&(i.mode="run")})}function getTests(suite){return toArray(suite).flatMap(s=>s.tasks.flatMap(c5=>c5.type==="test"?[c5]:getTests(c5)))}function getSuites(suite){return toArray(suite).flatMap(s=>s.type==="suite"?[s,...getSuites(s.tasks)]:[])}function hasTests(suite){return toArray(suite).some(s=>s.tasks.some(c5=>c5.type==="test"||hasTests(c5)))}function hasFailed(suite){return toArray(suite).some(s=>s.tasks.some(c5=>{var _a;return((_a=c5.result)==null?void 0:_a.state)==="fail"}))}async function collectTests(paths){let files={};for(let filepath of paths){let file={name:basename(filepath),type:"suite",mode:"run",computeMode:"serial",filepath,tasks:[],suite:{}};setHooks(file,createSuiteHooks()),clearContext();try{await import(filepath);for(let c5 of[defaultSuite,...context.tasks])if(c5.type==="test")file.tasks.push(c5);else{let suite=await c5.collect(file);(suite.name||suite.tasks.length)&&file.tasks.push(suite)}}catch(e){file.result={start:performance.now(),state:"fail",error:e},process.exitCode=1}files[filepath]=file}let allChildren=Object.values(files).reduce((tasks,file)=>tasks.concat(file.tasks),[]);return interpretOnlyMode(allChildren),allChildren.forEach(i=>{i.type==="suite"&&(i.mode==="skip"?i.tasks.forEach(c5=>c5.mode==="run"&&(c5.mode="skip")):interpretOnlyMode(i.tasks))}),files}async function startWatcher(ctx){var _a;let{reporter,snapshotManager,filesMap}=ctx;await((_a=reporter.onWatcherStart)==null?void 0:_a.call(reporter,ctx));let timer2,changedTests=new Set,seen=new Set,{server,moduleCache}=process.__vitest__;server.watcher.on("change",async id=>{id=slash2(id),getAffectedTests(id,ctx,changedTests,seen),seen.forEach(i=>moduleCache.delete(i)),seen.clear(),changedTests.size!==0&&(clearTimeout(timer2),timer2=setTimeout(async()=>{var _a2,_b,_c,_d;if(changedTests.size===0)return;snapshotManager.clear();let paths=Array.from(changedTests);changedTests.clear(),await((_a2=reporter.onWatcherRerun)==null?void 0:_a2.call(reporter,paths,id,ctx)),paths.forEach(i=>moduleCache.delete(i));let newFilesMap=await collectTests(paths);Object.assign(filesMap,newFilesMap);let files=Object.values(filesMap);(_b=reporter.onCollected)==null||_b.call(reporter,files,ctx),await runSuites(files,ctx),snapshotManager.saveSnap(),await((_c=reporter.onFinished)==null?void 0:_c.call(reporter,ctx,Object.values(newFilesMap))),await((_d=reporter.onWatcherStart)==null?void 0:_d.call(reporter,ctx))},100))}),await new Promise(()=>{})}function getAffectedTests(id,ctx,set=new Set,seen=new Set){if(seen.has(id)||set.has(id))return set;if(seen.add(id),id in ctx.filesMap)return set.add(id),set;let mod=process.__vitest__.server.moduleGraph.getModuleById(id);return mod&&mod.importers.forEach(i=>{i.id&&getAffectedTests(i.id,ctx,set,seen)}),set}init_esm_shims();import fg from"fast-glob";async function globTestFiles(config){var _a;let testFilepaths=await fg(config.includes||defaultIncludes,{absolute:!0,cwd:config.root,ignore:config.excludes||defaultExcludes});return((_a=config.filters)==null?void 0:_a.length)&&(testFilepaths=testFilepaths.filter(i=>config.filters.some(f=>i.includes(f)))),testFilepaths}init_esm_shims();init_esm_shims();import{performance as performance2}from"perf_hooks";import{relative}from"path";import c4 from"picocolors";init_esm_shims();import{promises as fs,existsSync}from"fs";import c2 from"picocolors";init_esm_shims();function Diff(){}Diff.prototype={diff:function(oldString,newString){var options=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},callback=options.callback;typeof options=="function"&&(callback=options,options={}),this.options=options;var self=this;function done(value){return callback?(setTimeout(function(){callback(void 0,value)},0),!0):value}oldString=this.castInput(oldString),newString=this.castInput(newString),oldString=this.removeEmpty(this.tokenize(oldString)),newString=this.removeEmpty(this.tokenize(newString));var newLen=newString.length,oldLen=oldString.length,editLength=1,maxEditLength=newLen+oldLen,bestPath=[{newPos:-1,components:[]}],oldPos=this.extractCommon(bestPath[0],newString,oldString,0);if(bestPath[0].newPos+1>=newLen&&oldPos+1>=oldLen)return done([{value:this.join(newString),count:newString.length}]);function execEditLength(){for(var diagonalPath=-1*editLength;diagonalPath<=editLength;diagonalPath+=2){var basePath=void 0,addPath=bestPath[diagonalPath-1],removePath=bestPath[diagonalPath+1],_oldPos=(removePath?removePath.newPos:0)-diagonalPath;addPath&&(bestPath[diagonalPath-1]=void 0);var canAdd=addPath&&addPath.newPos+1<newLen,canRemove=removePath&&0<=_oldPos&&_oldPos<oldLen;if(!canAdd&&!canRemove){bestPath[diagonalPath]=void 0;continue}if(!canAdd||canRemove&&addPath.newPos<removePath.newPos?(basePath=clonePath(removePath),self.pushComponent(basePath.components,void 0,!0)):(basePath=addPath,basePath.newPos++,self.pushComponent(basePath.components,!0,void 0)),_oldPos=self.extractCommon(basePath,newString,oldString,diagonalPath),basePath.newPos+1>=newLen&&_oldPos+1>=oldLen)return done(buildValues(self,basePath.components,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath}editLength++}if(callback)(function exec2(){setTimeout(function(){if(editLength>maxEditLength)return callback();execEditLength()||exec2()},0)})();else for(;editLength<=maxEditLength;){var ret=execEditLength();if(ret)return ret}},pushComponent:function(components,added,removed){var last=components[components.length-1];last&&last.added===added&&last.removed===removed?components[components.length-1]={count:last.count+1,added,removed}:components.push({count:1,added,removed})},extractCommon:function(basePath,newString,oldString,diagonalPath){for(var newLen=newString.length,oldLen=oldString.length,newPos=basePath.newPos,oldPos=newPos-diagonalPath,commonCount=0;newPos+1<newLen&&oldPos+1<oldLen&&this.equals(newString[newPos+1],oldString[oldPos+1]);)newPos++,oldPos++,commonCount++;return commonCount&&basePath.components.push({count:commonCount}),basePath.newPos=newPos,oldPos},equals:function(left,right){return this.options.comparator?this.options.comparator(left,right):left===right||this.options.ignoreCase&&left.toLowerCase()===right.toLowerCase()},removeEmpty:function(array){for(var ret=[],i=0;i<array.length;i++)array[i]&&ret.push(array[i]);return ret},castInput:function(value){return value},tokenize:function(value){return value.split("")},join:function(chars){return chars.join("")}};function buildValues(diff3,components,newString,oldString,useLongestToken){for(var componentPos=0,componentLen=components.length,newPos=0,oldPos=0;componentPos<componentLen;componentPos++){var component=components[componentPos];if(component.removed){if(component.value=diff3.join(oldString.slice(oldPos,oldPos+component.count)),oldPos+=component.count,componentPos&&components[componentPos-1].added){var tmp=components[componentPos-1];components[componentPos-1]=components[componentPos],components[componentPos]=tmp}}else{if(!component.added&&useLongestToken){var value=newString.slice(newPos,newPos+component.count);value=value.map(function(value2,i){var oldValue=oldString[oldPos+i];return oldValue.length>value2.length?oldValue:value2}),component.value=diff3.join(value)}else component.value=diff3.join(newString.slice(newPos,newPos+component.count));newPos+=component.count,component.added||(oldPos+=component.count)}}var lastComponent=components[componentLen-1];return componentLen>1&&typeof lastComponent.value=="string"&&(lastComponent.added||lastComponent.removed)&&diff3.equals("",lastComponent.value)&&(components[componentLen-2].value+=lastComponent.value,components.pop()),components}function clonePath(path2){return{newPos:path2.newPos,components:path2.components.slice(0)}}var characterDiff=new Diff;var extendedWordChars=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,reWhitespace=/\S/,wordDiff=new Diff;wordDiff.equals=function(left,right){return this.options.ignoreCase&&(left=left.toLowerCase(),right=right.toLowerCase()),left===right||this.options.ignoreWhitespace&&!reWhitespace.test(left)&&!reWhitespace.test(right)};wordDiff.tokenize=function(value){for(var tokens=value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),i=0;i<tokens.length-1;i++)!tokens[i+1]&&tokens[i+2]&&extendedWordChars.test(tokens[i])&&extendedWordChars.test(tokens[i+2])&&(tokens[i]+=tokens[i+2],tokens.splice(i+1,2),i--);return tokens};var lineDiff=new Diff;lineDiff.tokenize=function(value){var retLines=[],linesAndNewlines=value.split(/(\n|\r\n)/);linesAndNewlines[linesAndNewlines.length-1]||linesAndNewlines.pop();for(var i=0;i<linesAndNewlines.length;i++){var line=linesAndNewlines[i];i%2&&!this.options.newlineIsToken?retLines[retLines.length-1]+=line:(this.options.ignoreWhitespace&&(line=line.trim()),retLines.push(line))}return retLines};function diffLines(oldStr,newStr,callback){return lineDiff.diff(oldStr,newStr,callback)}var sentenceDiff=new Diff;sentenceDiff.tokenize=function(value){return value.split(/(\S.+?[.!?])(?=\s+|$)/)};var cssDiff=new Diff;cssDiff.tokenize=function(value){return value.split(/([{}:;,]|\s+)/)};function _typeof(obj){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(obj2){return typeof obj2}:_typeof=function(obj2){return obj2&&typeof Symbol=="function"&&obj2.constructor===Symbol&&obj2!==Symbol.prototype?"symbol":typeof obj2},_typeof(obj)}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _iterableToArray(iter){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(iter))return Array.from(iter)}function _unsupportedIterableToArray(o,minLen){if(!!o){if(typeof o=="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor&&(n=o.constructor.name),n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}}function _arrayLikeToArray(arr,len){(len==null||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
7
7
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var objectPrototypeToString=Object.prototype.toString,jsonDiff=new Diff;jsonDiff.useLongestToken=!0;jsonDiff.tokenize=lineDiff.tokenize;jsonDiff.castInput=function(value){var _this$options=this.options,undefinedReplacement=_this$options.undefinedReplacement,_this$options$stringi=_this$options.stringifyReplacer,stringifyReplacer=_this$options$stringi===void 0?function(k,v){return typeof v=="undefined"?undefinedReplacement:v}:_this$options$stringi;return typeof value=="string"?value:JSON.stringify(canonicalize(value,null,null,stringifyReplacer),stringifyReplacer," ")};jsonDiff.equals=function(left,right){return Diff.prototype.equals.call(jsonDiff,left.replace(/,([\r\n])/g,"$1"),right.replace(/,([\r\n])/g,"$1"))};function canonicalize(obj,stack,replacementStack,replacer,key){stack=stack||[],replacementStack=replacementStack||[],replacer&&(obj=replacer(key,obj));var i;for(i=0;i<stack.length;i+=1)if(stack[i]===obj)return replacementStack[i];var canonicalizedObj;if(objectPrototypeToString.call(obj)==="[object Array]"){for(stack.push(obj),canonicalizedObj=new Array(obj.length),replacementStack.push(canonicalizedObj),i=0;i<obj.length;i+=1)canonicalizedObj[i]=canonicalize(obj[i],stack,replacementStack,replacer,key);return stack.pop(),replacementStack.pop(),canonicalizedObj}if(obj&&obj.toJSON&&(obj=obj.toJSON()),_typeof(obj)==="object"&&obj!==null){stack.push(obj),canonicalizedObj={},replacementStack.push(canonicalizedObj);var sortedKeys=[],_key;for(_key in obj)obj.hasOwnProperty(_key)&&sortedKeys.push(_key);for(sortedKeys.sort(),i=0;i<sortedKeys.length;i+=1)_key=sortedKeys[i],canonicalizedObj[_key]=canonicalize(obj[_key],stack,replacementStack,replacer,_key);stack.pop(),replacementStack.pop()}else canonicalizedObj=obj;return canonicalizedObj}var arrayDiff=new Diff;arrayDiff.tokenize=function(value){return value.slice()};arrayDiff.join=arrayDiff.removeEmpty=function(value){return value};function structuredPatch(oldFileName,newFileName,oldStr,newStr,oldHeader,newHeader,options){options||(options={}),typeof options.context=="undefined"&&(options.context=4);var diff3=diffLines(oldStr,newStr,options);diff3.push({value:"",lines:[]});function contextLines(lines){return lines.map(function(entry){return" "+entry})}for(var hunks=[],oldRangeStart=0,newRangeStart=0,curRange=[],oldLine=1,newLine=1,_loop=function(i2){var current=diff3[i2],lines=current.lines||current.value.replace(/\n$/,"").split(`
8
8
  `);if(current.lines=lines,current.added||current.removed){var _curRange;if(!oldRangeStart){var prev=diff3[i2-1];oldRangeStart=oldLine,newRangeStart=newLine,prev&&(curRange=options.context>0?contextLines(prev.lines.slice(-options.context)):[],oldRangeStart-=curRange.length,newRangeStart-=curRange.length)}(_curRange=curRange).push.apply(_curRange,_toConsumableArray(lines.map(function(entry){return(current.added?"+":"-")+entry}))),current.added?newLine+=lines.length:oldLine+=lines.length}else{if(oldRangeStart)if(lines.length<=options.context*2&&i2<diff3.length-2){var _curRange2;(_curRange2=curRange).push.apply(_curRange2,_toConsumableArray(contextLines(lines)))}else{var _curRange3,contextSize=Math.min(lines.length,options.context);(_curRange3=curRange).push.apply(_curRange3,_toConsumableArray(contextLines(lines.slice(0,contextSize))));var hunk={oldStart:oldRangeStart,oldLines:oldLine-oldRangeStart+contextSize,newStart:newRangeStart,newLines:newLine-newRangeStart+contextSize,lines:curRange};if(i2>=diff3.length-2&&lines.length<=options.context){var oldEOFNewline=/\n$/.test(oldStr),newEOFNewline=/\n$/.test(newStr),noNlBeforeAdds=lines.length==0&&curRange.length>hunk.oldLines;!oldEOFNewline&&noNlBeforeAdds&&oldStr.length>0&&curRange.splice(hunk.oldLines,0,"\"),(!oldEOFNewline&&!noNlBeforeAdds||!newEOFNewline)&&curRange.push("\")}hunks.push(hunk),oldRangeStart=0,newRangeStart=0,curRange=[]}oldLine+=lines.length,newLine+=lines.length}},i=0;i<diff3.length;i++)_loop(i);return{oldFileName,newFileName,oldHeader,newHeader,hunks}}function formatPatch(diff3){var ret=[];diff3.oldFileName==diff3.newFileName&&ret.push("Index: "+diff3.oldFileName),ret.push("==================================================================="),ret.push("--- "+diff3.oldFileName+(typeof diff3.oldHeader=="undefined"?"":" "+diff3.oldHeader)),ret.push("+++ "+diff3.newFileName+(typeof diff3.newHeader=="undefined"?"":" "+diff3.newHeader));for(var i=0;i<diff3.hunks.length;i++){var hunk=diff3.hunks[i];hunk.oldLines===0&&(hunk.oldStart-=1),hunk.newLines===0&&(hunk.newStart-=1),ret.push("@@ -"+hunk.oldStart+","+hunk.oldLines+" +"+hunk.newStart+","+hunk.newLines+" @@"),ret.push.apply(ret,hunk.lines)}return ret.join(`
9
9
  `)+`
@@ -25,9 +25,9 @@ ${lines.map(cleanUp).filter(notBlank).join(`
25
25
  `),toRemove=lines.length-terminalHeight;return toRemove<=0?text:sliceAnsi(text,lines.slice(0,toRemove).join(`
26
26
  `).length+1,text.length)};function createLogUpdate(stream,{showCursor=!1}={}){let previousLineCount=0,previousWidth=getWidth(stream),previousOutput="",render=(...arguments_)=>{showCursor||cli_cursor_default.hide();let output=arguments_.join(" ")+`
27
27
  `;output=fitToTerminalHeight(stream,output);let width=getWidth(stream);output===previousOutput&&previousWidth===width||(previousOutput=output,previousWidth=width,output=wrapAnsi(output,width,{trim:!1,hard:!0,wordWrap:!1}),stream.write(ansi_escapes_default.eraseLines(previousLineCount)+output),previousLineCount=output.split(`
28
- `).length)};return render.clear=()=>{stream.write(ansi_escapes_default.eraseLines(previousLineCount)),previousOutput="",previousWidth=getWidth(stream),previousLineCount=0},render.done=()=>{previousOutput="",previousWidth=getWidth(stream),previousLineCount=0,showCursor||cli_cursor_default.show()},render}var logUpdate=createLogUpdate(process4.stdout);var logUpdateStderr=createLogUpdate(process4.stderr);var import_indent_string=__toModule(require_indent_string());import c3 from"picocolors";import figures from"figures";init_esm_shims();function getIndexOfNearestSpace(string,wantedIndex,shouldSearchRight){if(string.charAt(wantedIndex)===" ")return wantedIndex;for(let index=1;index<=3;index++)if(shouldSearchRight){if(string.charAt(wantedIndex+index)===" ")return wantedIndex+index}else if(string.charAt(wantedIndex-index)===" ")return wantedIndex-index;return wantedIndex}function cliTruncate(text,columns,options){options=__spreadValues({position:"end",preferTruncationOnSpace:!1,truncationCharacter:"\u2026"},options);let{position,space,preferTruncationOnSpace}=options,{truncationCharacter}=options;if(typeof text!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);if(typeof columns!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);if(columns<1)return"";if(columns===1)return truncationCharacter;let length=stringWidth(text);if(length<=columns)return text;if(position==="start"){if(preferTruncationOnSpace){let nearestSpace=getIndexOfNearestSpace(text,length-columns+1,!0);return truncationCharacter+sliceAnsi(text,nearestSpace,length).trim()}return space===!0&&(truncationCharacter+=" "),truncationCharacter+sliceAnsi(text,length-columns+stringWidth(truncationCharacter),length)}if(position==="middle"){space===!0&&(truncationCharacter=` ${truncationCharacter} `);let half=Math.floor(columns/2);if(preferTruncationOnSpace){let spaceNearFirstBreakPoint=getIndexOfNearestSpace(text,half),spaceNearSecondBreakPoint=getIndexOfNearestSpace(text,length-(columns-half)+1,!0);return sliceAnsi(text,0,spaceNearFirstBreakPoint)+truncationCharacter+sliceAnsi(text,spaceNearSecondBreakPoint,length).trim()}return sliceAnsi(text,0,half)+truncationCharacter+sliceAnsi(text,length-(columns-half)+stringWidth(truncationCharacter),length)}if(position==="end"){if(preferTruncationOnSpace){let nearestSpace=getIndexOfNearestSpace(text,columns-1);return sliceAnsi(text,0,nearestSpace)+truncationCharacter}return space===!0&&(truncationCharacter=` ${truncationCharacter}`),sliceAnsi(text,0,columns-stringWidth(truncationCharacter))+truncationCharacter}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`)}init_esm_shims();import process5 from"node:process";var spinnerFrames=process5.platform==="win32"?["-","\\","|","/"]:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function elegantSpinner(){let index=0;return()=>(index=++index%spinnerFrames.length,spinnerFrames[index])}var import_log_symbols=__toModule(require_log_symbols());var DURATION_LONG=300,pointer=c3.yellow(figures.pointer),skipped=c3.yellow(figures.arrowDown),spinnerMap=new WeakMap,outputMap=new WeakMap,getSymbol=task=>{if(task.mode==="skip"||task.mode==="todo")return skipped;if(!task.result)return c3.gray("\xB7");if(task.result.state==="run"){if(task.type==="suite")return pointer;let spinner=spinnerMap.get(task);return spinner||(spinner=elegantSpinner(),spinnerMap.set(task,spinner)),c3.yellow(spinner())}return task.result.state==="pass"?import_log_symbols.default.success:task.result.state==="fail"?task.type==="suite"?pointer:import_log_symbols.default.error:" "},renderHelper=(tasks,level=0)=>{var _a,_b,_c,_d;let output=[];for(let task of tasks){let delta=1,suffix=task.mode==="skip"||task.mode==="todo"?` ${c3.dim("[skipped]")}`:"";if(task.type==="suite"&&(suffix+=c3.dim(` (${getTests(task).length})`)),(_a=task.result)==null?void 0:_a.end){let duration=task.result.end-task.result.start;duration>DURATION_LONG&&(suffix+=c3.yellow(` ${Math.round(duration)}${c3.dim("ms")}`))}if(task.name?output.push((0,import_indent_string.default)(` ${getSymbol(task)} ${task.name}${suffix}`,level,{indent:" "})):delta=0,((_b=task.result)==null?void 0:_b.state)!=="pass"&&outputMap.get(task)!=null){let data=outputMap.get(task);if(typeof data=="string"&&(data=stripAnsi(data.trim().split(`
29
- `).filter(Boolean).pop()),data===""&&(data=void 0)),data!=null){let out=(0,import_indent_string.default)(`${figures.arrowRight} ${data}`,level,{indent:" "});output.push(` ${c3.gray(cliTruncate(out,process.stdout.columns-3))}`)}}(((_c=task.result)==null?void 0:_c.state)==="fail"||((_d=task.result)==null?void 0:_d.state)==="run")&&task.type==="suite"&&task.tasks.length>0&&(output=output.concat(renderHelper(task.tasks,level+delta)))}return output},createRenderer=_tasks=>{let tasks=_tasks,timer2,log=createLogUpdate(process.stdout);function run2(){let content=renderHelper(tasks);log(content.slice(0,20).join(`
30
- `))}return{start(){return timer2?this:(timer2=setInterval(run2,200),this)},update(_tasks2){return tasks=_tasks2,run2(),this},stop(){return timer2&&(clearInterval(timer2),timer2=void 0),run2(),log.done(),this}}};var DefaultReporter=class{constructor(config){this.config=config}start=0;end=0;renderer=void 0;relative(path2){return relative(this.config.root,path2)}onStart(){console.log(c4.green(`Running tests under ${c4.gray(this.config.root)}
28
+ `).length)};return render.clear=()=>{stream.write(ansi_escapes_default.eraseLines(previousLineCount)),previousOutput="",previousWidth=getWidth(stream),previousLineCount=0},render.done=()=>{previousOutput="",previousWidth=getWidth(stream),previousLineCount=0,showCursor||cli_cursor_default.show()},render}var logUpdate=createLogUpdate(process4.stdout);var logUpdateStderr=createLogUpdate(process4.stderr);import c3 from"picocolors";init_esm_shims();init_esm_shims();init_esm_shims();function isUnicodeSupported(){return process.platform!=="win32"?process.env.TERM!=="linux":Boolean(process.env.CI)||Boolean(process.env.WT_SESSION)||process.env.ConEmuTask==="{cmd::Cmder}"||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}var{platform}=process,common={square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},mainSymbols=__spreadProps(__spreadValues(__spreadValues({},common),platform==="linux"?{circleQuestionMark:"?\u20DD",questionMarkPrefix:"?\u20DD"}:{circleQuestionMark:"?",questionMarkPrefix:"?"}),{tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2716",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"}),fallbackSymbols=__spreadProps(__spreadValues({},common),{tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",circleQuestionMark:"(?)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",questionMarkPrefix:"\uFF1F",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"}),shouldUseMain=isUnicodeSupported(),figures=shouldUseMain?mainSymbols:fallbackSymbols,figures_default=figures;var import_indent_string=__toModule(require_indent_string());init_esm_shims();function getIndexOfNearestSpace(string,wantedIndex,shouldSearchRight){if(string.charAt(wantedIndex)===" ")return wantedIndex;for(let index=1;index<=3;index++)if(shouldSearchRight){if(string.charAt(wantedIndex+index)===" ")return wantedIndex+index}else if(string.charAt(wantedIndex-index)===" ")return wantedIndex-index;return wantedIndex}function cliTruncate(text,columns,options){options=__spreadValues({position:"end",preferTruncationOnSpace:!1,truncationCharacter:"\u2026"},options);let{position,space,preferTruncationOnSpace}=options,{truncationCharacter}=options;if(typeof text!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);if(typeof columns!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);if(columns<1)return"";if(columns===1)return truncationCharacter;let length=stringWidth(text);if(length<=columns)return text;if(position==="start"){if(preferTruncationOnSpace){let nearestSpace=getIndexOfNearestSpace(text,length-columns+1,!0);return truncationCharacter+sliceAnsi(text,nearestSpace,length).trim()}return space===!0&&(truncationCharacter+=" "),truncationCharacter+sliceAnsi(text,length-columns+stringWidth(truncationCharacter),length)}if(position==="middle"){space===!0&&(truncationCharacter=` ${truncationCharacter} `);let half=Math.floor(columns/2);if(preferTruncationOnSpace){let spaceNearFirstBreakPoint=getIndexOfNearestSpace(text,half),spaceNearSecondBreakPoint=getIndexOfNearestSpace(text,length-(columns-half)+1,!0);return sliceAnsi(text,0,spaceNearFirstBreakPoint)+truncationCharacter+sliceAnsi(text,spaceNearSecondBreakPoint,length).trim()}return sliceAnsi(text,0,half)+truncationCharacter+sliceAnsi(text,length-(columns-half)+stringWidth(truncationCharacter),length)}if(position==="end"){if(preferTruncationOnSpace){let nearestSpace=getIndexOfNearestSpace(text,columns-1);return sliceAnsi(text,0,nearestSpace)+truncationCharacter}return space===!0&&(truncationCharacter=` ${truncationCharacter}`),sliceAnsi(text,0,columns-stringWidth(truncationCharacter))+truncationCharacter}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`)}init_esm_shims();import process5 from"node:process";var spinnerFrames=process5.platform==="win32"?["-","\\","|","/"]:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function elegantSpinner(){let index=0;return()=>(index=++index%spinnerFrames.length,spinnerFrames[index])}var import_log_symbols=__toModule(require_log_symbols());var DURATION_LONG=300,MAX_HEIGHT=20,pointer=c3.yellow(figures_default.pointer),skipped=c3.yellow(figures_default.arrowDown),spinnerMap=new WeakMap,outputMap=new WeakMap,getSymbol=task=>{if(task.mode==="skip"||task.mode==="todo")return skipped;if(!task.result)return c3.gray("\xB7");if(task.result.state==="run"){if(task.type==="suite")return pointer;let spinner=spinnerMap.get(task);return spinner||(spinner=elegantSpinner(),spinnerMap.set(task,spinner)),c3.yellow(spinner())}return task.result.state==="pass"?import_log_symbols.default.success:task.result.state==="fail"?task.type==="suite"?pointer:import_log_symbols.default.error:" "};function renderTree(tasks,level=0){var _a,_b,_c,_d;let output=[];for(let task of tasks){let delta=1,suffix=task.mode==="skip"||task.mode==="todo"?` ${c3.dim("[skipped]")}`:"",prefix=` ${getSymbol(task)} `;if(task.type==="suite"&&(suffix+=c3.dim(` (${getTests(task).length})`)),(_a=task.result)==null?void 0:_a.end){let duration=task.result.end-task.result.start;duration>DURATION_LONG&&(suffix+=c3.yellow(` ${Math.round(duration)}${c3.dim("ms")}`))}if(task.name?output.push((0,import_indent_string.default)(prefix+task.name+suffix,level,{indent:" "})):delta=0,((_b=task.result)==null?void 0:_b.state)!=="pass"&&outputMap.get(task)!=null){let data=outputMap.get(task);if(typeof data=="string"&&(data=stripAnsi(data.trim().split(`
29
+ `).filter(Boolean).pop()),data===""&&(data=void 0)),data!=null){let out=(0,import_indent_string.default)(`${figures_default.arrowRight} ${data}`,level,{indent:" "});output.push(` ${c3.gray(cliTruncate(out,process.stdout.columns-3))}`)}}(((_c=task.result)==null?void 0:_c.state)==="fail"||((_d=task.result)==null?void 0:_d.state)==="run")&&task.type==="suite"&&task.tasks.length>0&&(output=output.concat(renderTree(task.tasks,level+delta)))}return output.slice(0,MAX_HEIGHT).join(`
30
+ `)}var createRenderer=_tasks=>{let tasks=_tasks,timer2,log=createLogUpdate(process.stdout);function update(){log(renderTree(tasks))}return{start(){return timer2?this:(timer2=setInterval(update,200),this)},update(_tasks2){return tasks=_tasks2,update(),this},stop(){return timer2&&(clearInterval(timer2),timer2=void 0),log.clear(),console.log(renderTree(tasks)),this}}};var DefaultReporter=class{constructor(config){this.config=config}start=0;end=0;renderer=void 0;relative(path2){return relative(this.config.root,path2)}onStart(){console.log(c4.green(`Running tests under ${c4.gray(this.config.root)}
31
31
  `))}onCollected(files){var _a;this.start=performance2.now(),(_a=this.renderer)==null||_a.stop(),this.renderer=createRenderer(files).start()}async onFinished(ctx,files=ctx.files){var _a,_b,_c,_d;(_a=this.renderer)==null||_a.stop(),this.end=performance2.now(),console.log();let snapshot=ctx.snapshotManager.report();snapshot&&console.log(snapshot.join(`
32
32
  `));let suites=getSuites(files),tests=getTests(files),failedSuites=suites.filter(i=>{var _a2;return(_a2=i.result)==null?void 0:_a2.error}),runnable=tests.filter(i=>{var _a2,_b2;return((_a2=i.result)==null?void 0:_a2.state)==="pass"||((_b2=i.result)==null?void 0:_b2.state)==="fail"}),passed=tests.filter(i=>{var _a2;return((_a2=i.result)==null?void 0:_a2.state)==="pass"}),failed=tests.filter(i=>{var _a2;return((_a2=i.result)==null?void 0:_a2.state)==="fail"}),skipped2=tests.filter(i=>i.mode==="skip"),todo=tests.filter(i=>i.mode==="todo");if(failedSuites.length){console.error(c4.bold(c4.red(`
33
33
  Failed to run ${failedSuites.length} suites:`)));for(let suite of failedSuites)console.error(c4.red(`
@@ -36,4 +36,4 @@ Failed Tests (${failed.length})`)));for(let test of failed)console.error(`${c4.r
36
36
  ${c4.inverse(" FAIL ")}`)} ${[test.suite.name,test.name].filter(Boolean).join(" > ")}`),await printError((_d=test.result)==null?void 0:_d.error),console.log()}console.log(c4.bold(c4.green(`Passed ${passed.length} / ${runnable.length}`))),failed.length&&console.log(c4.bold(c4.red(`Failed ${failed.length} / ${runnable.length}`))),skipped2.length&&console.log(c4.yellow(`Skipped ${skipped2.length}`)),todo.length&&console.log(c4.dim(`Todo ${todo.length}`)),console.log(`Time ${(this.end-this.start).toFixed(2)}ms`)}async onWatcherStart(ctx){var _a;(_a=this.renderer)==null||_a.stop();let failed=ctx.tests.filter(i=>{var _a2;return((_a2=i.result)==null?void 0:_a2.state)==="fail"});failed.length?console.log(`
37
37
  ${c4.bold(c4.inverse(c4.red(" FAIL ")))}${c4.red(` ${failed.length} tests failed. Watching for file changes...`)}`):console.log(`
38
38
  ${c4.bold(c4.inverse(c4.green(" PASS ")))}${c4.green(" Watching for file changes...")}`)}async onWatcherRerun(files,trigger){var _a;(_a=this.renderer)==null||_a.stop(),console.clear(),console.log(c4.blue("Re-running tests...")+c4.dim(` [ ${this.relative(trigger)} ]
39
- `))}};init_esm_shims();init_esm_shims();var import_sinon_chai=__toModule(require_sinon_chai());import chai3 from"chai";import Subset from"chai-subset";init_esm_shims();function JestChaiExpect(){return(chai4,utils)=>{let proto=chai4.Assertion.prototype;utils.addMethod(proto,"toEqual",function(expected){return this.eql(expected)}),utils.addMethod(proto,"toStrictEqual",function(expected){return this.equal(expected)}),utils.addMethod(proto,"toBe",function(expected){return this.equal(expected)}),utils.addMethod(proto,"toMatchObject",function(expected){return this.containSubset(expected)}),utils.addMethod(proto,"toMatch",function(expected){return typeof expected=="string"?this.include(expected):this.match(expected)}),utils.addMethod(proto,"toContain",function(item){return this.contain(item)}),utils.addMethod(proto,"toBeTruthy",function(){let obj=utils.flag(this,"object");this.assert(Boolean(obj),"expected #{this} to be truthy","expected #{this} to not be truthy",obj)}),utils.addMethod(proto,"toBeFalsy",function(){let obj=utils.flag(this,"object");this.assert(!obj,"expected #{this} to be falsy","expected #{this} to not be falsy",obj)}),utils.addMethod(proto,"toBeNaN",function(){return this.be.NaN}),utils.addMethod(proto,"toBeUndefined",function(){return this.be.undefined}),utils.addMethod(proto,"toBeNull",function(){return this.be.null}),utils.addMethod(proto,"toBeDefined",function(){return this.not.be.undefined}),utils.addMethod(proto,"toBeInstanceOf",function(obj){return this.instanceOf(obj)}),utils.addMethod(proto,"toHaveBeenCalledTimes",function(number){return this.callCount(number)}),utils.addMethod(proto,"toHaveBeenCalledOnce",function(){return this.callCount(1)}),utils.addMethod(proto,"toHaveBeenCalled",function(){return this.called}),utils.addMethod(proto,"toHaveBeenCalled",function(){return this.called}),utils.addMethod(proto,"toHaveBeenCalledWith",function(...args){return this.calledWith(...args)})}}async function setupChai(config){chai3.use(import_sinon_chai.default),chai3.use(JestChaiExpect()),chai3.use(Subset),chai3.use(await SnapshotPlugin(config))}async function setupEnv(config){await setupChai(config),config.global&&(await import("../global-MUBPT26L.js")).registerApiGlobally(),config.dom==="happy-dom"?(await import("../happy-dom-UCCFJZ4E.js")).setupHappyDOM(globalThis):config.dom&&(await import("../jsdom-6UH2UV3A.js")).setupJSDOM(globalThis)}async function setupRunner(config){return await setupEnv(config),{filesMap:{},get files(){return Object.values(this.filesMap)},get tests(){return getTests(Object.values(this.filesMap))},config,reporter:config.reporter||new DefaultReporter(config),snapshotManager:getSnapshotManager()}}async function callHook(suite,name,args){await Promise.all(getHooks(suite)[name].map(fn=>fn(...args)))}async function runTest(test,ctx){var _a,_b,_c;if(test.mode!=="run")return;let{reporter}=ctx;(_a=getSnapshotManager())==null||_a.setTest(test),await((_b=reporter.onTestBegin)==null?void 0:_b.call(reporter,test,ctx)),test.result={start:performance3.now(),state:"run"};try{await callHook(test.suite,"beforeEach",[test,test.suite]),await getFn(test)(),test.result.state="pass"}catch(e){test.result.state="fail",test.result.error=e,process.exitCode=1}try{await callHook(test.suite,"afterEach",[test,test.suite])}catch(e){test.result.state="fail",test.result.error=e,process.exitCode=1}test.result.end=performance3.now(),await((_c=reporter.onTestEnd)==null?void 0:_c.call(reporter,test,ctx))}async function runSuite(suite,ctx){var _a,_b;let{reporter}=ctx;if(await((_a=reporter.onSuiteBegin)==null?void 0:_a.call(reporter,suite,ctx)),suite.result={start:performance3.now(),state:"run"},suite.mode==="skip")suite.result.state="skip";else if(suite.mode==="todo")suite.result.state="todo";else try{await callHook(suite,"beforeAll",[suite]);for(let tasksGroup of partitionSuiteChildren(suite)){let computeMode=tasksGroup[0].computeMode;if(computeMode==="serial")for(let c5 of tasksGroup)await runSuiteChild(c5,ctx);else computeMode==="concurrent"&&await Promise.all(tasksGroup.map(c5=>runSuiteChild(c5,ctx)))}await callHook(suite,"afterAll",[suite])}catch(e){suite.result.state="fail",suite.result.error=e,process.exitCode=1}suite.result.end=performance3.now(),suite.mode==="run"&&(hasTests(suite)?hasFailed(suite)?suite.result.state="fail":suite.result.state="pass":(suite.result.state="fail",suite.result.error=new Error(`No tests found in suite ${suite.name}`),process.exitCode=1)),await((_b=reporter.onSuiteEnd)==null?void 0:_b.call(reporter,suite,ctx))}async function runSuiteChild(c5,ctx){return c5.type==="test"?runTest(c5,ctx):runSuite(c5,ctx)}async function runSuites(suites,ctx){for(let suite of suites)await runSuite(suite,ctx)}async function run(config){var _a,_b,_c;let testFilepaths=await globTestFiles(config);if(!testFilepaths.length){console.error("No test files found"),process.exitCode=1;return}let ctx=await setupRunner(config),{filesMap,snapshotManager,reporter}=ctx;await((_a=reporter.onStart)==null?void 0:_a.call(reporter,config));let newFileMap=await collectTests(testFilepaths);Object.assign(filesMap,newFileMap);let files=Object.values(filesMap);await((_b=reporter.onCollected)==null?void 0:_b.call(reporter,files,ctx)),await runSuites(files,ctx),snapshotManager.saveSnap(),await((_c=reporter.onFinished)==null?void 0:_c.call(reporter,ctx)),config.watch&&await startWatcher(ctx)}if(!process.__vitest__)throw new Error("Vitest can only run in vite-node environment, please use the CLI to start the process");await run(process.__vitest__.config);var timer=setTimeout(()=>{process.exit()},500);timer.unref();
39
+ `))}};init_esm_shims();init_esm_shims();import chai2 from"chai";import SinonChai from"sinon-chai";import Subset from"chai-subset";init_esm_shims();function JestChaiExpect(){return(chai3,utils)=>{let proto=chai3.Assertion.prototype;utils.addMethod(proto,"toEqual",function(expected){return this.eql(expected)}),utils.addMethod(proto,"toStrictEqual",function(expected){return this.equal(expected)}),utils.addMethod(proto,"toBe",function(expected){return this.equal(expected)}),utils.addMethod(proto,"toMatchObject",function(expected){return this.containSubset(expected)}),utils.addMethod(proto,"toMatch",function(expected){return typeof expected=="string"?this.include(expected):this.match(expected)}),utils.addMethod(proto,"toContain",function(item){return this.contain(item)}),utils.addMethod(proto,"toBeTruthy",function(){let obj=utils.flag(this,"object");this.assert(Boolean(obj),"expected #{this} to be truthy","expected #{this} to not be truthy",obj)}),utils.addMethod(proto,"toBeFalsy",function(){let obj=utils.flag(this,"object");this.assert(!obj,"expected #{this} to be falsy","expected #{this} to not be falsy",obj)}),utils.addMethod(proto,"toBeNaN",function(){return this.be.NaN}),utils.addMethod(proto,"toBeUndefined",function(){return this.be.undefined}),utils.addMethod(proto,"toBeNull",function(){return this.be.null}),utils.addMethod(proto,"toBeDefined",function(){return this.not.be.undefined}),utils.addMethod(proto,"toBeInstanceOf",function(obj){return this.instanceOf(obj)}),utils.addMethod(proto,"toHaveBeenCalledTimes",function(number){return this.callCount(number)}),utils.addMethod(proto,"toHaveBeenCalledOnce",function(){return this.callCount(1)}),utils.addMethod(proto,"toHaveBeenCalled",function(){return this.called}),utils.addMethod(proto,"toHaveBeenCalled",function(){return this.called}),utils.addMethod(proto,"toHaveBeenCalledWith",function(...args){return this.calledWith(...args)})}}async function setupChai(config){chai2.use(SinonChai),chai2.use(JestChaiExpect()),chai2.use(Subset),chai2.use(await SnapshotPlugin(config))}async function setupEnv(config){await setupChai(config),config.global&&(await import("../global-MUBPT26L.js")).registerApiGlobally(),config.dom==="happy-dom"?(await import("../happy-dom-UCCFJZ4E.js")).setupHappyDOM(globalThis):config.dom&&(await import("../jsdom-6UH2UV3A.js")).setupJSDOM(globalThis)}async function setupRunner(config){return await setupEnv(config),{filesMap:{},get files(){return Object.values(this.filesMap)},get tests(){return getTests(Object.values(this.filesMap))},config,reporter:config.reporter||new DefaultReporter(config),snapshotManager:getSnapshotManager()}}async function callHook(suite,name,args){await Promise.all(getHooks(suite)[name].map(fn=>fn(...args)))}async function runTest(test,ctx){var _a,_b,_c;if(test.mode!=="run")return;let{reporter}=ctx;(_a=getSnapshotManager())==null||_a.setTest(test),await((_b=reporter.onTestBegin)==null?void 0:_b.call(reporter,test,ctx)),test.result={start:performance3.now(),state:"run"};try{await callHook(test.suite,"beforeEach",[test,test.suite]),await getFn(test)(),test.result.state="pass"}catch(e){test.result.state="fail",test.result.error=e,process.exitCode=1}try{await callHook(test.suite,"afterEach",[test,test.suite])}catch(e){test.result.state="fail",test.result.error=e,process.exitCode=1}test.result.end=performance3.now(),await((_c=reporter.onTestEnd)==null?void 0:_c.call(reporter,test,ctx))}async function runSuite(suite,ctx){var _a,_b;let{reporter}=ctx;if(await((_a=reporter.onSuiteBegin)==null?void 0:_a.call(reporter,suite,ctx)),suite.result={start:performance3.now(),state:"run"},suite.mode==="skip")suite.result.state="skip";else if(suite.mode==="todo")suite.result.state="todo";else try{await callHook(suite,"beforeAll",[suite]);for(let tasksGroup of partitionSuiteChildren(suite)){let computeMode=tasksGroup[0].computeMode;if(computeMode==="serial")for(let c5 of tasksGroup)await runSuiteChild(c5,ctx);else computeMode==="concurrent"&&await Promise.all(tasksGroup.map(c5=>runSuiteChild(c5,ctx)))}await callHook(suite,"afterAll",[suite])}catch(e){suite.result.state="fail",suite.result.error=e,process.exitCode=1}suite.result.end=performance3.now(),suite.mode==="run"&&(hasTests(suite)?hasFailed(suite)?suite.result.state="fail":suite.result.state="pass":(suite.result.state="fail",suite.result.error=new Error(`No tests found in suite ${suite.name}`),process.exitCode=1)),await((_b=reporter.onSuiteEnd)==null?void 0:_b.call(reporter,suite,ctx))}async function runSuiteChild(c5,ctx){return c5.type==="test"?runTest(c5,ctx):runSuite(c5,ctx)}async function runSuites(suites,ctx){for(let suite of suites)await runSuite(suite,ctx)}async function run(config){var _a,_b,_c;let testFilepaths=await globTestFiles(config);if(!testFilepaths.length){console.error("No test files found"),process.exitCode=1;return}let ctx=await setupRunner(config),{filesMap,snapshotManager,reporter}=ctx;await((_a=reporter.onStart)==null?void 0:_a.call(reporter,config));let newFileMap=await collectTests(testFilepaths);Object.assign(filesMap,newFileMap);let files=Object.values(filesMap);await((_b=reporter.onCollected)==null?void 0:_b.call(reporter,files,ctx)),await runSuites(files,ctx),snapshotManager.saveSnap(),await((_c=reporter.onFinished)==null?void 0:_c.call(reporter,ctx)),config.watch&&await startWatcher(ctx)}if(!process.__vitest__)throw new Error("Vitest can only run in vite-node environment, please use the CLI to start the process");await run(process.__vitest__.config);var timer=setTimeout(()=>{process.exit()},500);timer.unref();
@@ -112,28 +112,34 @@ interface ResolvedConfig extends Omit<Required<UserOptions>, 'config' | 'filters
112
112
  }
113
113
  declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
114
114
  declare type TestState = RunMode | 'pass' | 'fail';
115
- declare type SuiteState = RunMode | 'pass' | 'fail';
116
115
  declare type ComputeMode = 'serial' | 'concurrent';
117
- declare type TaskType = 'test' | 'suite';
118
- interface Task {
119
- type: TaskType;
116
+ interface TaskBase {
120
117
  name: string;
121
118
  mode: RunMode;
122
119
  computeMode: ComputeMode;
123
- suite: Suite;
120
+ suite?: Suite;
124
121
  file?: File;
125
122
  result?: TaskResult;
126
123
  }
127
- interface Test extends Task {
128
- type: 'test';
129
- result?: TaskResult;
130
- }
131
124
  interface TaskResult {
132
125
  state: TestState;
133
126
  start: number;
134
127
  end?: number;
135
128
  error?: unknown;
136
129
  }
130
+ interface Suite extends TaskBase {
131
+ type: 'suite';
132
+ tasks: Task[];
133
+ }
134
+ interface File extends Suite {
135
+ filepath: string;
136
+ }
137
+ interface Test extends TaskBase {
138
+ type: 'test';
139
+ suite: Suite;
140
+ result?: TaskResult;
141
+ }
142
+ declare type Task = Test | Suite | File;
137
143
  declare type TestFunction = () => Awaitable<void>;
138
144
  interface ConcurrentCollector {
139
145
  (name: string, fn: TestFunction): void;
@@ -167,11 +173,6 @@ interface SuiteHooks {
167
173
  beforeEach: HookListener<[Test, Suite]>[];
168
174
  afterEach: HookListener<[Test, Suite]>[];
169
175
  }
170
- interface Suite extends Task {
171
- type: 'suite';
172
- tasks: Task[];
173
- result?: TaskResult;
174
- }
175
176
  interface SuiteCollector {
176
177
  readonly name: string;
177
178
  readonly mode: RunMode;
@@ -183,9 +184,6 @@ interface SuiteCollector {
183
184
  on: <T extends keyof SuiteHooks>(name: T, ...fn: SuiteHooks[T]) => void;
184
185
  }
185
186
  declare type TestFactory = (test: (name: string, fn: TestFunction) => void) => Awaitable<void>;
186
- interface File extends Suite {
187
- filepath: string;
188
- }
189
187
  interface RunnerContext {
190
188
  filesMap: Record<string, File>;
191
189
  files: File[];
@@ -210,4 +208,4 @@ interface Reporter {
210
208
  onWatcherRerun?: (files: string[], trigger: string, ctx: RunnerContext) => Awaitable<void>;
211
209
  }
212
210
 
213
- export { ComputeMode as C, File as F, GlobalContext as G, HookListener as H, ResolvedConfig as R, SuiteCollector as S, TestFactory as T, UserOptions as U, TestFunction as a, SuiteHooks as b, RunMode as c, TestState as d, SuiteState as e, TaskType as f, Task as g, Test as h, TaskResult as i, TestCollector as j, Suite as k, RunnerContext as l, Reporter as m };
211
+ export { ComputeMode as C, File as F, GlobalContext as G, HookListener as H, ResolvedConfig as R, SuiteCollector as S, TestFactory as T, UserOptions as U, TestFunction as a, SuiteHooks as b, RunMode as c, TestState as d, TaskBase as e, TaskResult as f, Suite as g, Test as h, Task as i, TestCollector as j, RunnerContext as k, Reporter as l };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "keywords": [
6
6
  "vite",
@@ -58,8 +58,6 @@
58
58
  "chai": "^4.3.4",
59
59
  "chai-subset": "^1.6.0",
60
60
  "fast-glob": "^3.2.7",
61
- "figures": "^4.0.0",
62
- "find-up": "^6.2.0",
63
61
  "happy-dom": "^2.24.5",
64
62
  "jest-snapshot": "^27.4.2",
65
63
  "jest-util": "^27.4.2",
@@ -67,6 +65,7 @@
67
65
  "picocolors": "^1.0.0",
68
66
  "sade": "^1.7.4",
69
67
  "sinon": "^12.0.1",
68
+ "sinon-chai": "^3.7.0",
70
69
  "source-map": "^0.7.3",
71
70
  "source-map-support": "^0.5.21"
72
71
  },
@@ -85,11 +84,12 @@
85
84
  "elegant-spinner": "^3.0.0",
86
85
  "eslint": "^8.4.1",
87
86
  "esno": "^0.12.1",
87
+ "figures": "^4.0.0",
88
+ "find-up": "^6.2.0",
88
89
  "log-symbols": "^4.1.0",
89
90
  "log-update": "^5.0.0",
90
91
  "npm-run-all": "^4.1.5",
91
92
  "rimraf": "^3.0.2",
92
- "sinon-chai": "^3.7.0",
93
93
  "strip-ansi": "^7.0.1",
94
94
  "tsup": "^5.10.3",
95
95
  "typescript": "^4.5.2",