vitest 0.0.40 → 0.0.44

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/README.gh.md CHANGED
@@ -193,21 +193,21 @@ basic.test.ts
193
193
  basic-foo.test.ts
194
194
  ```
195
195
 
196
- ### Skipping suites and tasks
196
+ ### Skipping suites and tests
197
197
 
198
198
  Use `.skip` to avoid running certain suites or tests
199
199
 
200
200
  ```ts
201
201
  describe.skip('skipped suite', () => {
202
- it('task', () => {
202
+ it('test', () => {
203
203
  // Suite skipped, no error
204
204
  assert.equal(Math.sqrt(4), 3)
205
205
  })
206
206
  })
207
207
 
208
208
  describe('suite', () => {
209
- it.skip('skipped task', () => {
210
- // Task skipped, no error
209
+ it.skip('skipped test', () => {
210
+ // Test skipped, no error
211
211
  assert.equal(Math.sqrt(4), 3)
212
212
  })
213
213
  })
@@ -220,19 +220,19 @@ Use `.only` to only run certain suites or tests
220
220
  ```ts
221
221
  // Only this suite (and others marked with only) are run
222
222
  describe.only('suite', () => {
223
- it('task', () => {
223
+ it('test', () => {
224
224
  assert.equal(Math.sqrt(4), 3)
225
225
  })
226
226
  })
227
227
 
228
228
  describe('another suite', () => {
229
- it('skipped task', () => {
230
- // Task skipped, as tests are running in Only mode
229
+ it('skipped test', () => {
230
+ // Test skipped, as tests are running in Only mode
231
231
  assert.equal(Math.sqrt(4), 3)
232
232
  })
233
233
 
234
- it.only('task', () => {
235
- // Only this task (and others marked with only) are run
234
+ it.only('test', () => {
235
+ // Only this test (and others marked with only) are run
236
236
  assert.equal(Math.sqrt(4), 2)
237
237
  })
238
238
  })
@@ -246,9 +246,9 @@ Use `.todo` to stub suites and tests that should be implemented
246
246
  // An entry will be shown in the report for this suite
247
247
  describe.todo('unimplemented suite')
248
248
 
249
- // An entry will be shown in the report for this task
249
+ // An entry will be shown in the report for this test
250
250
  describe('suite', () => {
251
- it.todo('unimplemented task')
251
+ it.todo('unimplemented test')
252
252
  })
253
253
  ```
254
254
 
@@ -257,38 +257,38 @@ describe('suite', () => {
257
257
  Use `.concurrent` in consecutive tests to run them in parallel
258
258
 
259
259
  ```ts
260
- // The two tasks marked with concurrent will be run in parallel
260
+ // The two tests marked with concurrent will be run in parallel
261
261
  describe('suite', () => {
262
- it('serial task', () => {
262
+ it('serial test', () => {
263
263
  assert.equal(Math.sqrt(4), 3)
264
264
  })
265
- it.concurrent('concurrent task 1', () => {
265
+ it.concurrent('concurrent test 1', () => {
266
266
  assert.equal(Math.sqrt(4), 3)
267
267
  })
268
- it.concurrent('concurrent task 2', () => {
268
+ it.concurrent('concurrent test 2', () => {
269
269
  assert.equal(Math.sqrt(4), 3)
270
270
  })
271
271
  })
272
272
  ```
273
273
 
274
- If you use `.concurrent` in a suite, every tasks in it will be run in parallel
274
+ If you use `.concurrent` in a suite, every tests in it will be run in parallel
275
275
  ```ts
276
- // The two tasks marked with concurrent will be run in parallel
276
+ // The two tests marked with concurrent will be run in parallel
277
277
  describe.concurrent('suite', () => {
278
- it('concurrent task 1', () => {
278
+ it('concurrent test 1', () => {
279
279
  assert.equal(Math.sqrt(4), 3)
280
280
  })
281
- it('concurrent task 2', () => {
281
+ it('concurrent test 2', () => {
282
282
  assert.equal(Math.sqrt(4), 3)
283
283
  })
284
284
  // No effect, same as not using .concurrent
285
- it.concurrent('concurrent task 3', () => {
285
+ it.concurrent('concurrent test 3', () => {
286
286
  assert.equal(Math.sqrt(4), 3)
287
287
  })
288
288
  })
289
289
  ```
290
290
 
291
- You can also use `.skip`, `.only`, and `.todo` with concurrent suite and tasks. All the following combinations are valid:
291
+ You can also use `.skip`, `.only`, and `.todo` with concurrent suite and tests. All the following combinations are valid:
292
292
  ```js
293
293
  describe.concurrent(...)
294
294
 
package/bin/vitest.mjs CHANGED
@@ -3,6 +3,10 @@
3
3
  import { fileURLToPath } from 'url'
4
4
  import { resolve } from 'path'
5
5
 
6
+ // TODO: enable source map when public
7
+ // import { install } from 'source-map-support'
8
+ // install({ environment: 'node', hookRequire: true })
9
+
6
10
  const argv = process.argv.slice(2)
7
11
  const filename = fileURLToPath(import.meta.url)
8
12
  const entry = resolve(filename, '../../dist/node/cli.js')
@@ -0,0 +1 @@
1
+ import{init_esm_shims}from"./chunk-6IXNQZKF.js";init_esm_shims();var LIVING_KEYS=["DOMException","URL","URLSearchParams","EventTarget","NamedNodeMap","Node","Attr","Element","DocumentFragment","DOMImplementation","Document","XMLDocument","CharacterData","Text","CDATASection","ProcessingInstruction","Comment","DocumentType","NodeList","HTMLCollection","HTMLOptionsCollection","DOMStringMap","DOMTokenList","StyleSheetList","HTMLElement","HTMLHeadElement","HTMLTitleElement","HTMLBaseElement","HTMLLinkElement","HTMLMetaElement","HTMLStyleElement","HTMLBodyElement","HTMLHeadingElement","HTMLParagraphElement","HTMLHRElement","HTMLPreElement","HTMLUListElement","HTMLOListElement","HTMLLIElement","HTMLMenuElement","HTMLDListElement","HTMLDivElement","HTMLAnchorElement","HTMLAreaElement","HTMLBRElement","HTMLButtonElement","HTMLCanvasElement","HTMLDataElement","HTMLDataListElement","HTMLDetailsElement","HTMLDialogElement","HTMLDirectoryElement","HTMLFieldSetElement","HTMLFontElement","HTMLFormElement","HTMLHtmlElement","HTMLImageElement","HTMLInputElement","HTMLLabelElement","HTMLLegendElement","HTMLMapElement","HTMLMarqueeElement","HTMLMediaElement","HTMLMeterElement","HTMLModElement","HTMLOptGroupElement","HTMLOptionElement","HTMLOutputElement","HTMLPictureElement","HTMLProgressElement","HTMLQuoteElement","HTMLScriptElement","HTMLSelectElement","HTMLSlotElement","HTMLSourceElement","HTMLSpanElement","HTMLTableCaptionElement","HTMLTableCellElement","HTMLTableColElement","HTMLTableElement","HTMLTimeElement","HTMLTableRowElement","HTMLTableSectionElement","HTMLTemplateElement","HTMLTextAreaElement","HTMLUnknownElement","HTMLFrameElement","HTMLFrameSetElement","HTMLIFrameElement","HTMLEmbedElement","HTMLObjectElement","HTMLParamElement","HTMLVideoElement","HTMLAudioElement","HTMLTrackElement","SVGElement","SVGGraphicsElement","SVGSVGElement","SVGTitleElement","SVGAnimatedString","SVGNumber","SVGStringList","Event","CloseEvent","CustomEvent","MessageEvent","ErrorEvent","HashChangeEvent","PopStateEvent","StorageEvent","ProgressEvent","PageTransitionEvent","UIEvent","FocusEvent","InputEvent","MouseEvent","KeyboardEvent","TouchEvent","CompositionEvent","WheelEvent","BarProp","External","Location","History","Screen","Performance","Navigator","PluginArray","MimeTypeArray","Plugin","MimeType","FileReader","Blob","File","FileList","ValidityState","DOMParser","XMLSerializer","FormData","XMLHttpRequestEventTarget","XMLHttpRequestUpload","XMLHttpRequest","WebSocket","NodeFilter","NodeIterator","TreeWalker","AbstractRange","Range","StaticRange","Selection","Storage","CustomElementRegistry","ShadowRoot","MutationObserver","MutationRecord","Headers","AbortController","AbortSignal"],OTHER_KEYS=["addEventListener","alert","atob","blur","btoa","close","confirm","createPopup","dispatchEvent","document","focus","frames","getComputedStyle","history","innerHeight","innerWidth","length","location","moveBy","moveTo","name","navigator","open","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","postMessage","print","prompt","removeEventListener","resizeBy","resizeTo","screen","screenLeft","screenTop","screenX","screenY","scroll","scrollBy","scrollLeft","scrollTo","scrollTop","scrollX","scrollY","self","stop","top","window"],KEYS=LIVING_KEYS.concat(OTHER_KEYS);export{KEYS};
@@ -0,0 +1 @@
1
+ var __create=Object.create;var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropSymbols=Object.getOwnPropertySymbols,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__markAsModule=target=>__defProp(target,"__esModule",{value:!0});var __esm=(fn,res)=>function(){return fn&&(res=(0,fn[Object.keys(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod)=>function(){return mod||(0,cb[Object.keys(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __export=(target,all)=>{__markAsModule(target);for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__reExport=(target,module,desc)=>{if(module&&typeof module=="object"||typeof module=="function")for(let key of __getOwnPropNames(module))!__hasOwnProp.call(target,key)&&key!=="default"&&__defProp(target,key,{get:()=>module[key],enumerable:!(desc=__getOwnPropDesc(module,key))||desc.enumerable});return target},__toModule=module=>__reExport(__markAsModule(__defProp(module!=null?__create(__getProtoOf(module)):{},"default",module&&module.__esModule&&"default"in module?{get:()=>module.default,enumerable:!0}:{value:module,enumerable:!0})),module);import{fileURLToPath}from"url";import path from"path";var __filename,__dirname,init_esm_shims=__esm({"node_modules/.pnpm/tsup@5.10.3_typescript@4.5.2/node_modules/tsup/assets/esm_shims.js"(){__filename=fileURLToPath(import.meta.url),__dirname=path.dirname(__filename)}});export{__spreadValues,__spreadProps,__commonJS,__export,__toModule,__filename,init_esm_shims};
@@ -0,0 +1 @@
1
+ import{__filename,init_esm_shims}from"./chunk-6IXNQZKF.js";init_esm_shims();init_esm_shims();var context={tasks:[],currentSuite:null};process.__vitest__||(console.warn("[vitest] Runtime is running in non-Vite environment, there might be some issues with your setup..."),console.warn("cwd: ",process.cwd()),console.warn("path:",__filename));init_esm_shims();var fnMap=new WeakMap,hooksMap=new WeakMap;function setFn(key,fn){fnMap.set(key,fn)}function getFn(key){return fnMap.get(key)}function setHooks(key,hooks){hooksMap.set(key,hooks)}function getHooks(key){return hooksMap.get(key)}var suite=createSuite(),defaultSuite=suite("");function getCurrentSuite(){return context.currentSuite||defaultSuite}function createSuiteHooks(){return{beforeAll:[],afterAll:[],beforeEach:[],afterEach:[]}}function createSuiteCollector(name,factory=()=>{},mode,suiteComputeMode){var _a;let tasks=[],factoryQueue=[],suite2;initSuite();let test2=createTestCollector((name2,fn,mode2,computeMode)=>{let test3={type:"test",name:name2,mode:mode2,computeMode:computeMode??suiteComputeMode??"serial",suite:{}};setFn(test3,fn),tasks.push(test3)}),collector={type:"collector",name,mode,test:test2,tasks,collect,clear,on:addHook};function addHook(name2,...fn){getHooks(suite2)[name2].push(...fn)}function initSuite(){suite2={type:"suite",computeMode:"serial",name,mode,tasks:[]},setHooks(suite2,createSuiteHooks())}function clear(){tasks.length=0,factoryQueue.length=0,initSuite()}async function collect(file){if(factoryQueue.length=0,factory){let prev=context.currentSuite;context.currentSuite=collector,await factory(test2),context.currentSuite=prev}let allChildren=await Promise.all([...factoryQueue,...tasks].map(i=>i.type==="collector"?i.collect(file):i));return suite2.file=file,suite2.tasks=allChildren,allChildren.forEach(task=>{task.type==="test"&&(task.suite=suite2,file&&(task.file=file))}),suite2}return(_a=context.currentSuite)==null||_a.tasks.push(collector),collector}function createTestCollector(collectTest){function test2(name,fn){collectTest(name,fn,"run")}test2.concurrent=concurrent,test2.skip=skip,test2.only=only,test2.todo=todo;function concurrent(name,fn){collectTest(name,fn,"run","concurrent")}concurrent.skip=(name,fn)=>collectTest(name,fn,"skip","concurrent"),concurrent.only=(name,fn)=>collectTest(name,fn,"only","concurrent"),concurrent.todo=todo;function skip(name,fn){collectTest(name,fn,"skip")}skip.concurrent=concurrent.skip;function only(name,fn){collectTest(name,fn,"only")}only.concurrent=concurrent.only;function todo(name){collectTest(name,()=>{},"todo")}return todo.concurrent=todo,test2}var test=function(){function test2(name,fn){return getCurrentSuite().test(name,fn)}function concurrent(name,fn){return getCurrentSuite().test.concurrent(name,fn)}concurrent.skip=(name,fn)=>getCurrentSuite().test.concurrent.skip(name,fn),concurrent.only=(name,fn)=>getCurrentSuite().test.concurrent.only(name,fn),concurrent.todo=name=>getCurrentSuite().test.concurrent.todo(name);function skip(name,fn){return getCurrentSuite().test.skip(name,fn)}skip.concurrent=(name,fn)=>getCurrentSuite().test.skip.concurrent(name,fn);function only(name,fn){return getCurrentSuite().test.only(name,fn)}only.concurrent=(name,fn)=>getCurrentSuite().test.only.concurrent(name,fn);function todo(name){return getCurrentSuite().test.todo(name)}return todo.concurrent=name=>getCurrentSuite().test.todo.concurrent(name),test2.concurrent=concurrent,test2.skip=skip,test2.only=only,test2.todo=todo,test2}();function createSuite(){function suite2(suiteName,factory){return createSuiteCollector(suiteName,factory,"run")}function concurrent(suiteName,factory){return createSuiteCollector(suiteName,factory,"run","concurrent")}concurrent.skip=(suiteName,factory)=>createSuiteCollector(suiteName,factory,"skip","concurrent"),concurrent.only=(suiteName,factory)=>createSuiteCollector(suiteName,factory,"only","concurrent"),concurrent.todo=suiteName=>createSuiteCollector(suiteName,void 0,"todo");function skip(suiteName,factory){return createSuiteCollector(suiteName,factory,"skip")}skip.concurrent=concurrent.skip;function only(suiteName,factory){return createSuiteCollector(suiteName,factory,"only")}only.concurrent=concurrent.only;function todo(suiteName){return createSuiteCollector(suiteName,void 0,"todo")}return todo.concurrent=concurrent.todo,suite2.concurrent=concurrent,suite2.skip=skip,suite2.only=only,suite2.todo=todo,suite2}var describe=suite,it=test,beforeAll=fn=>getCurrentSuite().on("beforeAll",fn),afterAll=fn=>getCurrentSuite().on("afterAll",fn),beforeEach=fn=>getCurrentSuite().on("beforeEach",fn),afterEach=fn=>getCurrentSuite().on("afterEach",fn);function clearContext(){context.tasks.length=0,defaultSuite.clear(),context.currentSuite=defaultSuite}export{context,getFn,setHooks,getHooks,suite,defaultSuite,createSuiteHooks,test,describe,it,beforeAll,afterAll,beforeEach,afterEach,clearContext};
@@ -0,0 +1 @@
1
+ import{init_esm_shims}from"./chunk-6IXNQZKF.js";init_esm_shims();import{resolve}from"path";import{fileURLToPath}from"url";var distDir=resolve(fileURLToPath(import.meta.url),"../../dist"),defaultIncludes=["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],defaultExcludes=["**/node_modules/**","**/dist/**"],globalApis=["suite","test","describe","it","chai","expect","assert","sinon","spy","mock","stub","beforeAll","afterAll","beforeEach","afterEach"];export{distDir,defaultIncludes,defaultExcludes,globalApis};
@@ -0,0 +1 @@
1
+ import{afterAll,afterEach,beforeAll,beforeEach,clearContext,createSuiteHooks,defaultSuite,describe,it,suite,test}from"./chunk-AQN47UC5.js";import{__export,init_esm_shims}from"./chunk-6IXNQZKF.js";var src_exports={};__export(src_exports,{afterAll:()=>afterAll,afterEach:()=>afterEach,assert:()=>assert,beforeAll:()=>beforeAll,beforeEach:()=>beforeEach,chai:()=>chai,clearContext:()=>clearContext,createSuiteHooks:()=>createSuiteHooks,defaultSuite:()=>defaultSuite,describe:()=>describe,expect:()=>expect,it:()=>it,mock:()=>mock,should:()=>should,sinon:()=>sinon,spy:()=>spy,stub:()=>stub,suite:()=>suite,test:()=>test});init_esm_shims();init_esm_shims();init_esm_shims();import chai from"chai";import{assert,should,expect}from"chai";init_esm_shims();import sinon from"sinon";var{mock,spy,stub}=sinon;sinon.fn=sinon.spy;export{chai,assert,should,expect,sinon,mock,spy,stub,src_exports};
@@ -0,0 +1 @@
1
+ import{src_exports}from"./chunk-MTU4HR6S.js";import"./chunk-AQN47UC5.js";import{globalApis}from"./chunk-HKVZR3WA.js";import{init_esm_shims}from"./chunk-6IXNQZKF.js";init_esm_shims();function registerApiGlobally(){globalApis.forEach(api=>{globalThis[api]=src_exports[api]})}export{registerApiGlobally};
@@ -0,0 +1 @@
1
+ import{KEYS}from"./chunk-3SFPYX4Z.js";import{init_esm_shims}from"./chunk-6IXNQZKF.js";init_esm_shims();import{Window}from"happy-dom";function setupHappyDOM(global){let win=new Window,keys=KEYS.concat(Object.getOwnPropertyNames(win)).filter(k=>!k.startsWith("_")).filter(k=>!(k in global));for(let key of keys)global[key]=win[key];return{dom:win,restore(){win.happyDOM.cancelAsync(),keys.forEach(key=>delete global[key])}}}export{setupHappyDOM};
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-15d74511';
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, j as Suite, S as SuiteCollector, b as SuiteHooks, e as SuiteState, f as Task, h as TaskOrSuite, g as TaskResult, d as TaskState, i as TestCollector, T as TestFactory, a as TestFunction, U as UserOptions } from './types-15d74511';
2
+ import { T as TestFactory, S as SuiteCollector, a as TestFunction, b as SuiteHooks, U as UserOptions } from './types-1e901cba';
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, j as Suite, S as SuiteCollector, b as SuiteHooks, e as SuiteState, h as Task, f as Test, i as TestCollector, T as TestFactory, a as TestFunction, g as TestResult, d as TestState, U as UserOptions } from './types-1e901cba';
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';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as l,b as m,c as n,d as o,e as p,f as q,g as r,h as s}from"./chunk-LUQHGOPU.js";import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k}from"./chunk-Z2OPSSDM.js";import"./chunk-XPSQDVUG.js";export{h as afterAll,j as afterEach,m as assert,g as beforeAll,i as beforeEach,l as chai,k as clearContext,c as createSuiteHooks,b as defaultSuite,e as describe,o as expect,f as it,q as mock,n as should,p as sinon,r as spy,s as stub,a as suite,d as test};
1
+ import{assert,chai,expect,mock,should,sinon,spy,stub}from"./chunk-MTU4HR6S.js";import{afterAll,afterEach,beforeAll,beforeEach,clearContext,createSuiteHooks,defaultSuite,describe,it,suite,test}from"./chunk-AQN47UC5.js";import"./chunk-6IXNQZKF.js";export{afterAll,afterEach,assert,beforeAll,beforeEach,chai,clearContext,createSuiteHooks,defaultSuite,describe,expect,it,mock,should,sinon,spy,stub,suite,test};
@@ -0,0 +1 @@
1
+ import{KEYS}from"./chunk-3SFPYX4Z.js";import{init_esm_shims}from"./chunk-6IXNQZKF.js";init_esm_shims();import{JSDOM}from"jsdom";function setupJSDOM(global){let dom=new JSDOM("<!DOCTYPE html>",{pretendToBeVisual:!0,runScripts:"dangerously",url:"http://localhost:3000"}),keys=KEYS.concat(Object.getOwnPropertyNames(dom.window)).filter(k=>!k.startsWith("_")).filter(k=>!(k in global));for(let key of keys)global[key]=dom.window[key];return{dom,restore(){keys.forEach(key=>delete global[key])}}}export{setupJSDOM};
@@ -1,5 +1,5 @@
1
1
  import { TransformResult, ViteDevServer } from 'vite';
2
- import { R as ResolvedConfig } from '../types-15d74511';
2
+ import { R as ResolvedConfig } from '../types-1e901cba';
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{a as V}from"../chunk-W4BWZKS2.js";import{a as x,b as O,f as p}from"../chunk-XPSQDVUG.js";p();import{resolve as Y}from"path";import Z from"sade";import v from"picocolors";var M="0.0.40";p();p();import{builtinModules as z,createRequire as L}from"module";import{fileURLToPath as N,pathToFileURL as $}from"url";import{dirname as E,resolve as q}from"path";import B from"vm";var H=process.platform==="win32",D={"/@vite/client":{injectQuery:e=>e,createHotContext(){return{accept:()=>{},prune:()=>{}}},updateStyle(){}}};async function T({moduleCache:e,root:r,files:t,fetch:f,inline:n,external:c}){let g=[];for(let s of t)g.push(await R(`/@fs/${j(q(s))}`,[]));return g;async function y(s,i,o){o=[...o,s];let a=async l=>{if(o.includes(l)){if(!e.get(l))throw new Error(`Circular dependency detected
1
+ import{distDir}from"../chunk-HKVZR3WA.js";import{__spreadProps,__spreadValues,init_esm_shims}from"../chunk-6IXNQZKF.js";init_esm_shims();import{resolve as resolve3}from"path";import sade from"sade";import c from"picocolors";var version="0.0.44";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";import{isExternal}from"externality";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 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
- ${[...o,l].reverse().map(U=>`- ${U}`).join(`
4
- `)}`);return e.get(l).exports}return R(l,o)};if(s in D)return D[s];let m=await f(s);if(!m)throw new Error(`failed to load ${s}`);let d=$(i).href,u={};h(s,{transformResult:m,exports:u});let C=N(d),S={require:L(d),__filename:C,__dirname:E(C),__vite_ssr_import__:a,__vite_ssr_dynamic_import__:a,__vite_ssr_exports__:u,__vite_ssr_exportAll__:l=>A(u,l),__vite_ssr_import_meta__:{url:d}};return await B.runInThisContext(`async (${Object.keys(S).join(",")}) => { ${m.code} }`,{filename:i,lineOffset:0})(...Object.values(S)),u}function h(s,i){e.has(s)?Object.assign(e.get(s),i):e.set(s,i)}function _(s){for(let i of n)if(typeof i=="string"){if(s.includes(`/node_modules/${i}/`))return!1}else if(i.test(s))return!1;for(let i of c)if(typeof i=="string"){if(s.includes(`/node_modules/${i}/`))return!0}else if(i.test(s))return!0;return s.includes("/node_modules/")}async function R(s,i){var d,u;let o=J(s);if(z.includes(o))return import(o);let a=Q(o,r);if(_(a))return a.match(/^\w:\//)?import(`/${a}`):import(a);if((d=e.get(a))==null?void 0:d.promise)return(u=e.get(a))==null?void 0:u.promise;let m=y(o,a,i);return h(a,{promise:m}),await m}function A(s,i){for(let o in i)if(o!=="default")try{Object.defineProperty(s,o,{enumerable:!0,configurable:!0,get(){return i[o]}})}catch{}}}function J(e){return e&&e.startsWith("/@id/__x00__")&&(e=`\0${e.slice("/@id/__x00__".length)}`),e&&e.startsWith("/@id/")&&(e=e.slice("/@id/".length)),e.startsWith("__vite-browser-external:")&&(e=e.slice("__vite-browser-external:".length)),e}function Q(e,r){let t=j(e).startsWith("/@fs/")?e.slice(4):e.startsWith(E(r))?e:e.startsWith("/")?j(q(r,e.slice(1))):e;return t.startsWith("//")&&(t=t.slice(1)),H&&t.startsWith("/")?$(t.slice(1)).href:t}function j(e){return e.replace(/\\/g,"/")}p();async function F(e,r){if(r.match(/\.(?:[cm]?[jt]sx?|json)$/))return await e.transformRequest(r,{ssr:!0});{let t=await e.transformRequest(r);return t?await e.ssrTransform(t.code,t.map,r):void 0}}async function W(e,r,t,f){let n={root:e.config.root,files:f,fetch:c=>F(e,c),inline:r.depsInline,external:r.depsExternal,moduleCache:t};try{await T(n)}catch(c){throw process.exitCode=1,c}finally{r.watch||await e.close()}}p();import{resolve as I}from"path";import{findUp as G}from"find-up";import{createServer as K}from"vite";var X=["vitest.config.ts","vitest.config.js","vitest.config.mjs","vite.config.ts","vite.config.js","vite.config.mjs"];async function P(e={}){var g,y,h,_;let{filters:r}=e,t=I(e.root||process.cwd());process.chdir(t);let f=e.config?I(t,e.config):await G(X,{cwd:t}),n=x({},e);n.config=f,n.root=t,n.filters=r?Array.isArray(r)?r:[r]:void 0;let c=await K({root:t,logLevel:"error",clearScreen:!1,configFile:n.config,optimizeDeps:{exclude:["vitest"]}});return await c.pluginContainer.buildStart({}),Object.assign(n,c.config.test),n.depsInline=["vitest/dist","vitest/src","vue","@vue","diff",...((y=(g=c.config.test)==null?void 0:g.deps)==null?void 0:y.inline)||[]],n.depsExternal=((_=(h=c.config.test)==null?void 0:h.deps)==null?void 0:_.external)||[],{server:c,config:n}}Z("vitest [filter]",!0).version(M).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(e,r)=>{process.env.VITEST="true",console.log(v.yellow(v.bold(`
5
- Vitest is currently in closed beta exclusively for Sponsors`))),console.log(v.magenta(`Become a Sponsor of ${v.underline("https://github.com/sponsors/patak-js")} or ${v.underline("https://github.com/sponsors/antfu")}
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)}function shouldExternalize(id){return isExternal(id,root,{inline:[/virtual:/,/\.ts$/,/\/esm\/.*\.js$/,/\.(es|esm|esm-browser|esm-bundler|es6).js$/,...inline],external:[...external,/node_modules/],resolve:{type:"module",extensions:[".ts",".js",".json",".vue",".mjs",".jsx",".tsx",".wasm"]}})}async function cachedRequest(rawId,callstack){var _a,_b;let id=normalizeId(rawId);if(builtinModules.includes(id))return import(id);let fsPath=toFilePath(id,root);if(await shouldExternalize(fsPath))return 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}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","diff","vue-demi","vue",...((_b=(_a=server.config.test)==null?void 0:_a.deps)==null?void 0:_b.inline)||[]],resolved.depsExternal=((_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
+ 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
- `));let{config:t,server:f}=await P(O(x({},r),{filters:e})),n=new Map;process.__vitest__={server:f,config:t,moduleCache:n},await W(f,t,n,[Y(V,"./node/entry.js")])}).parse(process.argv);
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);
@@ -1,18 +1,18 @@
1
- import{a as z,b as G,c as J,d as V,f as Y,g as Q,o as X}from"../chunk-Z2OPSSDM.js";import{b as Z,c as ee}from"../chunk-W4BWZKS2.js";import{c as Oe,e as Ae,f as c}from"../chunk-XPSQDVUG.js";var se=Oe((ft,oe)=>{c();"use strict";oe.exports=t=>{let e=/^\\\\\?\\/.test(t),n=/[^\u0000-\u0080]+/.test(t);return e||n?t:t.replace(/\\/g,"/")}});c();c();c();import ue from"jest-snapshot";c();import De from"chai";import He from"jest-snapshot";c();import Ee from"@jest/test-result";var{makeEmptyAggregatedTestResult:Pe}=Ee,L=t=>{let e=Pe().snapshot;return e.didUpdate=t.updateSnapshot==="all",e},te=t=>{let e={added:0,fileDeleted:!1,matched:0,unchecked:0,uncheckedKeys:[],unmatched:0,updated:0},n=t.getUncheckedCount(),o=t.getUncheckedKeys();n&&t.removeUncheckedKeys();let i=t.save();return e.fileDeleted=i.deleted,e.added=t.added,e.matched=t.matched,e.unmatched=t.unmatched,e.updated=t.updated,e.unchecked=i.deleted?0:n,e.uncheckedKeys=Array.from(o),e},ne=(t,e,n)=>{e.added&&t.filesAdded++,e.fileDeleted&&t.filesRemoved++,e.unmatched&&t.filesUnmatched++,e.updated&&t.filesUpdated++,t.added+=e.added,t.matched+=e.matched,t.unchecked+=e.unchecked,e.uncheckedKeys&&e.uncheckedKeys.length>0&&t.uncheckedKeysByFile.push({filePath:n,keys:e.uncheckedKeys}),t.unmatched+=e.unmatched,t.updated+=e.updated,t.total+=e.added+e.matched+e.unmatched+e.updated};c();var ie=Ae(se());import R,{isAbsolute as Fe}from"path";import{pluralize as y}from"jest-util";import w from"picocolors";var _=(t,e)=>{Fe(e)&&(e=R.relative(t,e));let n=R.dirname(e),o=R.basename(e);return(0,ie.default)(w.dim(n+R.sep)+w.bold(o))},$=" \u203A ",re=" \u21B3 ",B=" \u2022 ",je=t=>w.bold(w.red(t)),ae=t=>w.bold(w.yellow(t)),Le=t=>w.bold(w.green(t)),D=w.dim,le=t=>w.bold(w.green(t)),_e=w.bold,Be=t=>w.bold(w.green(t)),H="re-run mocha with `--update` to update them",ce=(t,e)=>{let n=[];if(n.push(_e("Snapshot Summary")),e.added&&n.push(`${Le(`${$+y("snapshot",e.added)} written `)}from ${y("test suite",e.filesAdded)}.`),e.unmatched&&n.push(`${je(`${$}${y("snapshot",e.unmatched)} failed`)} from ${y("test suite",e.filesUnmatched)}. ${D(`Inspect your code changes or ${H} to update them.`)}`),e.updated&&n.push(`${Be(`${$+y("snapshot",e.updated)} updated `)}from ${y("test suite",e.filesUpdated)}.`),e.filesRemoved&&(e.didUpdate?n.push(`${le(`${$}${y("snapshot file",e.filesRemoved)} removed `)}from ${y("test suite",e.filesRemoved)}.`):n.push(`${ae(`${$}${y("snapshot file",e.filesRemoved)} obsolete `)}from ${y("test suite",e.filesRemoved)}. ${D(`To remove ${e.filesRemoved===1?"it":"them all"}, ${H}.`)}`)),e.filesRemovedList&&e.filesRemovedList.length){let[o,...i]=e.filesRemovedList;n.push(` ${re} ${B}${_(t,o)}`),i.forEach(s=>{n.push(` ${B}${_(t,s)}`)})}return e.unchecked&&(e.didUpdate?n.push(`${le(`${$}${y("snapshot",e.unchecked)} removed `)}from ${y("test suite",e.uncheckedKeysByFile.length)}.`):n.push(`${ae(`${$}${y("snapshot",e.unchecked)} obsolete `)}from ${y("test suite",e.uncheckedKeysByFile.length)}. ${D(`To remove ${e.unchecked===1?"it":"them all"}, ${H}.`)}`),e.uncheckedKeysByFile.forEach(o=>{n.push(` ${re}${_(t,o.filePath)}`),o.keys.forEach(i=>{n.push(` ${B}${i}`)})})),n};var{expect:Ne}=De,{SnapshotState:We}=He,N=class{snapshotState=null;snapshotSummary;snapshotOptions;ctx=null;testFile="";snapshotResolver;rootDir;constructor({rootDir:e,update:n,snapshotResolver:o=null}){this.rootDir=e,this.snapshotResolver=o;let i=process.env,s=!!i.CI,r=n||i.UPDATE_SNAPSHOT;this.snapshotOptions={updateSnapshot:s&&!r?"none":r?"all":"new"},this.snapshotSummary=L(this.snapshotOptions)}onFileChanged(){!this.ctx||(this.snapshotState!==null&&this.saveSnap(),this.testFile=this.ctx.file,this.snapshotState=new We(this.snapshotResolver.resolveSnapshotPath(this.testFile),this.snapshotOptions))}setTask(e){var n;this.setContext({file:((n=e.file)==null?void 0:n.filepath)||e.name,title:e.name,fullTitle:[e.suite.name,e.name].filter(Boolean).join(" > ")})}setContext(e){!e.title||!e.file||(this.ctx=e,this.testFile!==e.file&&this.onFileChanged())}assert(e,n){if(!this.snapshotState||!this.ctx)return;let{actual:o,expected:i,key:s,pass:r}=this.snapshotState.match({testName:this.ctx.fullTitle||this.ctx.title||this.ctx.file,received:e,isInline:!1});r||Ne(o.trim()).equals(i?i.trim():"",n||`Snapshot name: \`${s}\``)}clear(){this.snapshotSummary=L(this.snapshotOptions)}saveSnap(){if(!this.testFile||!this.snapshotState)return;let e=te(this.snapshotState);ne(this.snapshotSummary,e,this.testFile),this.testFile="",this.snapshotState=null}report(){let e=ce(this.rootDir,this.snapshotSummary);if(e.length>1)return e}};var{addSerializer:Ue}=ue,O;function A(){return O}async function de(t){let{root:e}=t;return O=new N({rootDir:e,update:t.update}),O.snapshotResolver=await ue.buildSnapshotResolver({transform:[],rootDir:e}),function(n,o){for(let i of["matchSnapshot","toMatchSnapshot"])o.addMethod(n.Assertion.prototype,i,function(s){let r=o.flag(this,"object");O.assert(r,s)});n.expect.addSnapshotSerializer=Ue}}c();import{slash as Ke}from"@antfu/utils";c();import{basename as Ie}from"path";c();import{toArray as E}from"@antfu/utils";function he(t){let e=[],n=[];for(let o of t.children)e.length===0||o.computeMode===e[0].computeMode?e.push(o):(n.push(e),e=[o]);return e.length>0&&n.push(e),n}function W(t){t.some(e=>e.mode==="only")&&t.forEach(e=>{e.mode==="run"?e.mode="skip":e.mode==="only"&&(e.mode="run")})}function b(t){return E(t).flatMap(e=>e.children.flatMap(n=>n.type==="task"?[n]:b(n)))}function U(t){return E(t).flatMap(e=>e.type==="suite"?[e,...U(e.children)]:[])}function M(t){return E(t).some(e=>e.children.some(n=>n.type==="task"||M(n)))}function fe(t){return E(t).some(e=>e.children.some(n=>{var o;return((o=n.result)==null?void 0:o.state)==="fail"}))}async function P(t){let e={};for(let i of t){let s={name:Ie(i),type:"suite",mode:"run",computeMode:"serial",filepath:i,children:[]};J(s,Q()),X();try{await import(i);for(let r of[Y,...z.children])if(r.type==="task")s.children.push(r);else{let u=await r.collect(s);(u.name||u.children.length)&&s.children.push(u)}}catch(r){s.result={start:performance.now(),state:"fail",error:r},process.exitCode=1}e[i]=s}let o=Object.values(e).reduce((i,s)=>i.concat(s.children),[]);return W(o),o.forEach(i=>{i.type==="suite"&&(i.mode==="skip"?i.children.forEach(s=>s.mode==="run"&&(s.mode="skip")):W(i.children))}),e}async function pe(t){var l;let{reporter:e,snapshotManager:n,filesMap:o}=t;await((l=e.onWatcherStart)==null?void 0:l.call(e,t));let i,s=new Set,r=new Set,{server:u,moduleCache:a}=process.__vitest__;u.watcher.on("change",async f=>{f=Ke(f),me(f,t,s,r),r.forEach(g=>a.delete(g)),r.clear(),s.size!==0&&(clearTimeout(i),i=setTimeout(async()=>{var T,h,S,x;if(s.size===0)return;n.clear();let g=Array.from(s);s.clear(),await((T=e.onWatcherRerun)==null?void 0:T.call(e,g,f,t)),g.forEach(Re=>a.delete(Re));let C=await P(g);Object.assign(o,C);let v=Object.values(o);(h=e.onCollected)==null||h.call(e,v,t),await I(v,t),n.saveSnap(),await((S=e.onFinished)==null?void 0:S.call(e,t,Object.values(C))),await((x=e.onWatcherStart)==null?void 0:x.call(e,t))},100))}),await new Promise(()=>{})}function me(t,e,n=new Set,o=new Set){if(o.has(t)||n.has(t))return n;if(o.add(t),t in e.filesMap)return n.add(t),n;let i=process.__vitest__.server.moduleGraph.getModuleById(t);return i&&i.importers.forEach(s=>{s.id&&me(s.id,e,n,o)}),n}c();import qe from"fast-glob";async function ge(t){var n;let e=await qe(t.includes||Z,{absolute:!0,cwd:t.root,ignore:t.excludes||ee});return((n=t.filters)==null?void 0:n.length)&&(e=e.filter(o=>t.filters.some(i=>o.includes(i)))),e}c();c();import{performance as we}from"perf_hooks";import{relative as rt}from"path";import d from"picocolors";import ke from"listr";c();import{promises as ze,existsSync as Ge}from"fs";import k from"picocolors";import{createPatch as it}from"diff";import{notNullish as Je}from"@antfu/utils";import{SourceMapConsumer as Ve}from"source-map";async function K(t){var r;if(!(t instanceof Error)){console.error(t);return}let{moduleCache:e}=process.__vitest__,n=t,o=!1,s=tt(n.stack||"").find(u=>e.has(u.file));if(s){let u=(r=e.get(s.file))==null?void 0:r.transformResult,a=await Ye(u==null?void 0:u.map,s);if(a&&Ge(s.file)){let l=await ze.readFile(s.file,"utf-8");console.error(`${k.red(`${k.bold(n.name)}: ${n.message}`)}`),console.log(k.gray(`${s.file}:${a.line}:${a.column}`)),console.log(k.yellow(Xe(l,a))),o=!0}}o||console.error(n),n.showDiff&&console.error(k.gray(nt(ye(n.actual),ye(n.expected))))}function Ye(t,{line:e,column:n}){return new Promise(o=>{if(!t)return o(null);Ve.with(t,null,i=>{let s=i.originalPositionFor({line:e,column:n});s.line!=null&&s.column!=null?o(s):o(null)})})}var Se=/\r?\n/;function Qe(t,e){if(typeof e=="number")return e;let n=t.split(Se),{line:o,column:i}=e,s=0;for(let r=0;r<o-1;r++)s+=n[r].length+1;return s+i}function Xe(t,e=0,n,o=2){e=Qe(t,e),n=n||e;let i=t.split(Se),s=0,r=[];for(let u=0;u<i.length;u++)if(s+=i[u].length+1,s>=e){for(let a=u-o;a<=u+o||n>s;a++){if(a<0||a>=i.length)continue;let l=a+1;r.push(`${k.gray(`${l}${" ".repeat(Math.max(3-String(l).length,0))}|`)} ${i[a]}`);let f=i[a].length;if(a===u){let g=e-(s-f)+1,C=Math.max(1,n>s?f-g:n-e);r.push(`${k.gray(" |")} ${" ".repeat(g)}${"^".repeat(C)}`)}else if(a>u){if(n>s){let g=Math.max(Math.min(n-s,f),1);r.push(`${k.gray(" |")} ${"^".repeat(g)}`)}s+=f+1}}break}return r.join(`
2
- `)}function ye(t){return String(t)}var Ze=/at (.*) \((.+):(\d+):(\d+)\)$/,et=/at ()(.+):(\d+):(\d+)$/;function tt(t){return t.split(`
3
- `).map(o=>{let i=o.trim(),s=i.match(Ze)||i.match(et);if(!s)return null;let r=s[2];return r.startsWith("file://")&&(r=r.slice(7)),{method:s[1],file:s[2],line:parseInt(s[3]),column:parseInt(s[4])}}).filter(Je)}function nt(t,e){let n=2048;return t.length>n&&(t=`${t.substring(0,n)} ... Lines skipped`),e.length>n&&(e=`${e.substring(0,n)} ... Lines skipped`),ot(t,e)}function ot(t,e){let n=" ";function o(r){return r[0]==="+"?n+k.green(`${r[0]} ${r.slice(1)}`):r[0]==="-"?n+k.red(`${r[0]} ${r.slice(1)}`):r.match(/@@/)?"--":r.match(/\\ No newline/)?null:n+r}let s=it("string",t,e).split(`
1
+ import{clearContext,context,createSuiteHooks,defaultSuite,getFn,getHooks,setHooks}from"../chunk-AQN47UC5.js";import{defaultExcludes,defaultIncludes}from"../chunk-HKVZR3WA.js";import{__commonJS,__toModule,init_esm_shims}from"../chunk-6IXNQZKF.js";var require_slash=__commonJS({"node_modules/.pnpm/slash@3.0.0/node_modules/slash/index.js"(exports,module){init_esm_shims();"use strict";module.exports=path2=>{let isExtendedLengthPath=/^\\\\\?\\/.test(path2),hasNonAscii=/[^\u0000-\u0080]+/.test(path2);return isExtendedLengthPath||hasNonAscii?path2:path2.replace(/\\/g,"/")}}});init_esm_shims();init_esm_shims();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";init_esm_shims();import{toArray}from"@antfu/utils";function partitionSuiteChildren(suite){let tasksGroup=[],tasksGroups=[];for(let c4 of suite.tasks)tasksGroup.length===0||c4.computeMode===tasksGroup[0].computeMode?tasksGroup.push(c4):(tasksGroups.push(tasksGroup),tasksGroup=[c4]);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(c4=>c4.type==="test"?[c4]:getTests(c4)))}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(c4=>c4.type==="test"||hasTests(c4)))}function hasFailed(suite){return toArray(suite).some(s=>s.tasks.some(c4=>{var _a;return((_a=c4.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:[]};setHooks(file,createSuiteHooks()),clearContext();try{await import(filepath);for(let c4 of[defaultSuite,...context.tasks])if(c4.type==="test")file.tasks.push(c4);else{let suite=await c4.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(c4=>c4.mode==="run"&&(c4.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 c3 from"picocolors";import Listr from"listr";init_esm_shims();import{promises as fs,existsSync}from"fs";import c2 from"picocolors";import{createPatch}from"diff";import{notNullish}from"@antfu/utils";import{SourceMapConsumer}from"source-map";async function printError(error){var _a;if(!(error instanceof Error)){console.error(error);return}let{moduleCache}=process.__vitest__,e=error,codeFramePrinted=!1,nearest=parseStack(e.stack||"").find(stack=>moduleCache.has(stack.file));if(nearest){let transformResult=(_a=moduleCache.get(nearest.file))==null?void 0:_a.transformResult,pos=await getOriginalPos(transformResult==null?void 0:transformResult.map,nearest);if(pos&&existsSync(nearest.file)){let sourceCode=await fs.readFile(nearest.file,"utf-8");console.error(`${c2.red(`${c2.bold(e.name)}: ${e.message}`)}`),console.log(c2.gray(`${nearest.file}:${pos.line}:${pos.column}`)),console.log(c2.yellow(generateCodeFrame(sourceCode,pos))),codeFramePrinted=!0}}codeFramePrinted||console.error(e),e.showDiff&&console.error(c2.gray(generateDiff(stringify(e.actual),stringify(e.expected))))}function getOriginalPos(map,{line,column}){return new Promise(resolve=>{if(!map)return resolve(null);SourceMapConsumer.with(map,null,consumer=>{let pos=consumer.originalPositionFor({line,column});pos.line!=null&&pos.column!=null?resolve(pos):resolve(null)})})}var splitRE=/\r?\n/;function posToNumber(source,pos){if(typeof pos=="number")return pos;let lines=source.split(splitRE),{line,column}=pos,start=0;for(let i=0;i<line-1;i++)start+=lines[i].length+1;return start+column}function generateCodeFrame(source,start=0,end,range=2){start=posToNumber(source,start),end=end||start;let lines=source.split(splitRE),count=0,res=[];for(let i=0;i<lines.length;i++)if(count+=lines[i].length+1,count>=start){for(let j=i-range;j<=i+range||end>count;j++){if(j<0||j>=lines.length)continue;let line=j+1;res.push(`${c2.gray(`${line}${" ".repeat(Math.max(3-String(line).length,0))}|`)} ${lines[j]}`);let lineLength=lines[j].length;if(lineLength>200)return"";if(j===i){let pad=start-(count-lineLength)+1,length=Math.max(1,end>count?lineLength-pad:end-start);res.push(`${c2.gray(" |")} ${" ".repeat(pad)}${"^".repeat(length)}`)}else if(j>i){if(end>count){let length=Math.max(Math.min(end-count,lineLength),1);res.push(`${c2.gray(" |")} ${"^".repeat(length)}`)}count+=lineLength+1}}break}return res.join(`
2
+ `)}function stringify(obj){return String(obj)}var stackFnCallRE=/at (.*) \((.+):(\d+):(\d+)\)$/,stackBarePathRE=/at ()(.+):(\d+):(\d+)$/;function parseStack(stack){return stack.split(`
3
+ `).map(raw=>{let line=raw.trim(),match=line.match(stackFnCallRE)||line.match(stackBarePathRE);if(!match)return null;let file=match[2];return file.startsWith("file://")&&(file=file.slice(7)),{method:match[1],file:match[2],line:parseInt(match[3]),column:parseInt(match[4])}}).filter(notNullish)}function generateDiff(actual,expected){let diffSize=2048;return actual.length>diffSize&&(actual=`${actual.substring(0,diffSize)} ... Lines skipped`),expected.length>diffSize&&(expected=`${expected.substring(0,diffSize)} ... Lines skipped`),unifiedDiff(actual,expected)}function unifiedDiff(actual,expected){let indent=" ";function cleanUp(line){return line[0]==="+"?indent+c2.green(`${line[0]} ${line.slice(1)}`):line[0]==="-"?indent+c2.red(`${line[0]} ${line.slice(1)}`):line.match(/@@/)?"--":line.match(/\\ No newline/)?null:indent+line}let lines=createPatch("string",actual,expected).split(`
4
4
  `).splice(5);return`
5
- ${n}${k.red("- actual")}
6
- ${n}${k.green("+ expected")}
5
+ ${indent}${c2.red("- actual")}
6
+ ${indent}${c2.green("+ expected")}
7
7
 
8
- ${s.map(o).filter(st).join(`
9
- `)}`}function st(t){return typeof t!="undefined"&&t!==null}var q=class{start=0;end=0;listr=null;listrPromise=null;taskMap=new Map;cwd=process.cwd();relative(e){return rt(this.cwd,e)}onStart(e){this.cwd=e.root,console.log(d.green(`Running tests under ${d.gray(this.cwd)}
10
- `))}onCollected(e){this.start=we.now(),this.taskMap=new Map,e.reduce((a,l)=>a.concat(b(l)),[]).forEach(a=>{let l={};l.promise=new Promise((f,g)=>{l.resolve=f,l.reject=g}),this.taskMap.set(a,l)});let o={exitOnError:!1},i=a=>({title:a.name,skip:()=>a.mode==="skip"||a.mode==="todo",task:async()=>{var l;return await((l=this.taskMap.get(a))==null?void 0:l.promise)}});function s(a){return a.children.map(l=>l.type==="task"?i(l):u(l))}function r(a){var l;if((l=a.result)==null?void 0:l.error)throw a.result.error;if(!M(a))throw new Error("No tasks found");return new ke(s(a),o)}function u(a){return{title:a.name,skip:()=>a.mode!=="run",task:()=>r(a)}}this.listr=new ke(e.map(a=>({title:this.relative(a.filepath),task:()=>{var l,f;if((l=a.result)==null?void 0:l.error)throw(f=a.result)==null?void 0:f.error;return r(a)}})),o),this.listrPromise=this.listr.run().catch(()=>{})}onTaskEnd(e){var n,o,i,s;((n=e.result)==null?void 0:n.state)==="fail"?(i=this.taskMap.get(e))==null||i.reject((o=e.result)==null?void 0:o.error):(s=this.taskMap.get(e))==null||s.resolve()}async onFinished(e,n=e.files){var C,v,T;await this.listrPromise,this.end=we.now(),console.log();let o=e.snapshotManager.report();o&&console.log(o.join(`
11
- `));let i=U(n),s=b(n),r=i.filter(h=>{var S;return(S=h.result)==null?void 0:S.error}),u=s.filter(h=>{var S,x;return((S=h.result)==null?void 0:S.state)==="pass"||((x=h.result)==null?void 0:x.state)==="fail"}),a=s.filter(h=>{var S;return((S=h.result)==null?void 0:S.state)==="pass"}),l=s.filter(h=>{var S;return((S=h.result)==null?void 0:S.state)==="fail"}),f=s.filter(h=>h.mode==="skip"),g=s.filter(h=>h.mode==="todo");if(r.length){console.error(d.bold(d.red(`
12
- Failed to run ${r.length} suites:`)));for(let h of r)console.error(d.red(`
13
- - ${(C=h.file)==null?void 0:C.filepath} > ${h.name}`)),await K((v=h.result)==null?void 0:v.error),console.log()}if(l.length){console.error(d.bold(d.red(`
14
- Failed Tests (${l.length})`)));for(let h of l)console.error(`${d.red(`
15
- ${d.inverse(" FAIL ")}`)} ${[h.suite.name,h.name].filter(Boolean).join(" > ")}`),await K((T=h.result)==null?void 0:T.error),console.log()}console.log(d.bold(d.green(`Passed ${a.length} / ${u.length}`))),l.length&&console.log(d.bold(d.red(`Failed ${l.length} / ${u.length}`))),f.length&&console.log(d.yellow(`Skipped ${f.length}`)),g.length&&console.log(d.dim(`Todo ${g.length}`)),console.log(`Time ${(this.end-this.start).toFixed(2)}ms`)}async onWatcherStart(e){await this.listrPromise;let n=e.tasks.filter(o=>{var i;return((i=o.result)==null?void 0:i.state)==="fail"});n.length?console.log(`
16
- ${d.bold(d.inverse(d.red(" FAIL ")))}${d.red(` ${n.length} tests failed. Watching for file changes...`)}`):console.log(`
17
- ${d.bold(d.inverse(d.green(" PASS ")))}${d.green(" Watching for file changes...")}`)}async onWatcherRerun(e,n){await this.listrPromise,console.clear(),console.log(d.blue("Re-running tests...")+d.dim(` [ ${this.relative(n)} ]
18
- `))}};c();c();import F from"chai";import at from"sinon-chai";import lt from"chai-subset";c();function Ce(){return(t,e)=>{let n=t.Assertion.prototype;e.addMethod(n,"toEqual",function(o){return this.eql(o)}),e.addMethod(n,"toStrictEqual",function(o){return this.equal(o)}),e.addMethod(n,"toBe",function(o){return this.equal(o)}),e.addMethod(n,"toMatchObject",function(o){return this.containSubset(o)}),e.addMethod(n,"toMatch",function(o){return typeof o=="string"?this.include(o):this.match(o)}),e.addMethod(n,"toContain",function(o){return this.contain(o)}),e.addMethod(n,"toBeTruthy",function(){let o=e.flag(this,"object");this.assert(Boolean(o),"expected #{this} to be truthy","expected #{this} to not be truthy",o)}),e.addMethod(n,"toBeFalsy",function(){let o=e.flag(this,"object");this.assert(!o,"expected #{this} to be falsy","expected #{this} to not be falsy",o)}),e.addMethod(n,"toBeNaN",function(){return this.be.NaN}),e.addMethod(n,"toBeUndefined",function(){return this.be.undefined}),e.addMethod(n,"toBeNull",function(){return this.be.null}),e.addMethod(n,"toBeDefined",function(){return this.not.be.undefined}),e.addMethod(n,"toBeInstanceOf",function(o){return this.instanceOf(o)}),e.addMethod(n,"toHaveBeenCalledTimes",function(o){return this.callCount(o)}),e.addMethod(n,"toHaveBeenCalledOnce",function(){return this.callCount(1)}),e.addMethod(n,"toHaveBeenCalled",function(){return this.called}),e.addMethod(n,"toHaveBeenCalled",function(){return this.called}),e.addMethod(n,"toHaveBeenCalledWith",function(...o){return this.calledWith(...o)})}}async function $e(t){F.use(at),F.use(Ce()),F.use(lt),F.use(await de(t))}async function be(t){await $e(t),t.global&&(await import("../global-OOVANJ2U.js")).registerApiGlobally(),t.dom==="happy-dom"?(await import("../happy-dom-RNJZR3YC.js")).setupHappyDOM(globalThis):t.dom&&(await import("../jsdom-6QAZGE6T.js")).setupJSDOM(globalThis)}async function ve(t){return await be(t),{filesMap:{},get files(){return Object.values(this.filesMap)},get tasks(){return b(Object.values(this.filesMap))},config:t,reporter:t.reporter||new q,snapshotManager:A()}}async function j(t,e,n){await Promise.all(V(t)[e].map(o=>o(...n)))}async function ct(t,e){var o,i,s;if(t.mode!=="run")return;let{reporter:n}=e;(o=A())==null||o.setTask(t),await((i=n.onTaskBegin)==null?void 0:i.call(n,t,e)),t.result={start:performance.now(),state:"run"};try{await j(t.suite,"beforeEach",[t,t.suite]),await G(t)(),t.result.state="pass"}catch(r){t.result.state="fail",t.result.error=r,process.exitCode=1}try{await j(t.suite,"afterEach",[t,t.suite])}catch(r){t.result.state="fail",t.result.error=r,process.exitCode=1}t.result.end=performance.now(),await((s=n.onTaskEnd)==null?void 0:s.call(n,t,e))}async function Te(t,e){var o,i;let{reporter:n}=e;if(await((o=n.onSuiteBegin)==null?void 0:o.call(n,t,e)),t.result={start:performance.now(),state:"run"},t.mode==="skip")t.result.state="skip";else if(t.mode==="todo")t.result.state="todo";else try{await j(t,"beforeAll",[t]);for(let s of he(t)){let r=s[0].computeMode;if(r==="serial")for(let u of s)await xe(u,e);else r==="concurrent"&&await Promise.all(s.map(u=>xe(u,e)))}await j(t,"afterAll",[t])}catch(s){t.result.state="fail",t.result.error=s,process.exitCode=1}t.result.end=performance.now(),t.mode==="run"&&(M(t)?fe(t)&&(t.result.state="fail"):(t.result.state="fail",t.result.error=new Error(`No tests found in suite ${t.name}`),process.exitCode=1)),await((i=n.onSuiteEnd)==null?void 0:i.call(n,t,e))}async function xe(t,e){return t.type==="task"?ct(t,e):Te(t,e)}async function I(t,e){for(let n of t)await Te(n,e)}async function Me(t){var a,l,f;let e=await ge(t);if(!e.length){console.error("No test files found"),process.exitCode=1;return}let n=await ve(t),{filesMap:o,snapshotManager:i,reporter:s}=n;await((a=s.onStart)==null?void 0:a.call(s,t));let r=await P(e);Object.assign(o,r);let u=Object.values(o);await((l=s.onCollected)==null?void 0:l.call(s,u,n)),await I(u,n),i.saveSnap(),await((f=s.onFinished)==null?void 0:f.call(s,n)),t.watch&&await pe(n)}if(!process.__vitest__)throw new Error("Vitest can only run in vite-node environment, please use the CLI to start the process");await Me(process.__vitest__.config);var ut=setTimeout(()=>{process.exit()},500);ut.unref();
8
+ ${lines.map(cleanUp).filter(notBlank).join(`
9
+ `)}`}function notBlank(line){return typeof line!="undefined"&&line!==null}var DefaultReporter=class{start=0;end=0;listr=null;listrPromise=null;testMap=new Map;cwd=process.cwd();relative(path2){return relative(this.cwd,path2)}onStart(config){this.cwd=config.root,console.log(c3.green(`Running tests under ${c3.gray(this.cwd)}
10
+ `))}onCollected(files){this.start=performance2.now(),this.testMap=new Map,files.reduce((acc,file)=>acc.concat(getTests(file)),[]).forEach(t=>{let obj={};obj.promise=new Promise((resolve,reject)=>{obj.resolve=resolve,obj.reject=reject}),this.testMap.set(t,obj)});let listrOptions={exitOnError:!1},createListrTestTask=test=>({title:test.name,skip:()=>test.mode==="skip"||test.mode==="todo",task:async()=>{var _a;return await((_a=this.testMap.get(test))==null?void 0:_a.promise)}});function createListrSuiteTask(suite){return{title:suite.name,skip:()=>suite.mode!=="run",task:()=>createSuiteListr(suite)}}function createListrSuiteChildren(suite){return suite.tasks.map(c4=>c4.type==="test"?createListrTestTask(c4):createListrSuiteTask(c4))}function createSuiteListr(suite){var _a;if((_a=suite.result)==null?void 0:_a.error)throw suite.result.error;if(!hasTests(suite))throw new Error("No tests found");return new Listr(createListrSuiteChildren(suite),listrOptions)}this.listr=new Listr(files.map(file=>({title:this.relative(file.filepath),task:()=>{var _a,_b;if((_a=file.result)==null?void 0:_a.error)throw(_b=file.result)==null?void 0:_b.error;return createSuiteListr(file)}})),listrOptions),this.listrPromise=this.listr.run().catch(()=>{})}onTestEnd(test){var _a,_b,_c,_d;((_a=test.result)==null?void 0:_a.state)==="fail"?(_c=this.testMap.get(test))==null||_c.reject((_b=test.result)==null?void 0:_b.error):(_d=this.testMap.get(test))==null||_d.resolve()}async onFinished(ctx,files=ctx.files){var _a,_b,_c;await this.listrPromise,this.end=performance2.now(),console.log();let snapshot=ctx.snapshotManager.report();snapshot&&console.log(snapshot.join(`
11
+ `));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"}),skipped=tests.filter(i=>i.mode==="skip"),todo=tests.filter(i=>i.mode==="todo");if(failedSuites.length){console.error(c3.bold(c3.red(`
12
+ Failed to run ${failedSuites.length} suites:`)));for(let suite of failedSuites)console.error(c3.red(`
13
+ - ${(_a=suite.file)==null?void 0:_a.filepath} > ${suite.name}`)),await printError((_b=suite.result)==null?void 0:_b.error),console.log()}if(failed.length){console.error(c3.bold(c3.red(`
14
+ Failed Tests (${failed.length})`)));for(let test of failed)console.error(`${c3.red(`
15
+ ${c3.inverse(" FAIL ")}`)} ${[test.suite.name,test.name].filter(Boolean).join(" > ")}`),await printError((_c=test.result)==null?void 0:_c.error),console.log()}console.log(c3.bold(c3.green(`Passed ${passed.length} / ${runnable.length}`))),failed.length&&console.log(c3.bold(c3.red(`Failed ${failed.length} / ${runnable.length}`))),skipped.length&&console.log(c3.yellow(`Skipped ${skipped.length}`)),todo.length&&console.log(c3.dim(`Todo ${todo.length}`)),console.log(`Time ${(this.end-this.start).toFixed(2)}ms`)}async onWatcherStart(ctx){await this.listrPromise;let failed=ctx.tests.filter(i=>{var _a;return((_a=i.result)==null?void 0:_a.state)==="fail"});failed.length?console.log(`
16
+ ${c3.bold(c3.inverse(c3.red(" FAIL ")))}${c3.red(` ${failed.length} tests failed. Watching for file changes...`)}`):console.log(`
17
+ ${c3.bold(c3.inverse(c3.green(" PASS ")))}${c3.green(" Watching for file changes...")}`)}async onWatcherRerun(files,trigger){await this.listrPromise,console.clear(),console.log(c3.blue("Re-running tests...")+c3.dim(` [ ${this.relative(trigger)} ]
18
+ `))}};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-EYQRAQJ6.js")).registerApiGlobally(),config.dom==="happy-dom"?(await import("../happy-dom-57PK5RJB.js")).setupHappyDOM(globalThis):config.dom&&(await import("../jsdom-3T4EXDYB.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,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:performance.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=performance.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:performance.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 c4 of tasksGroup)await runSuiteChild(c4,ctx);else computeMode==="concurrent"&&await Promise.all(tasksGroup.map(c4=>runSuiteChild(c4,ctx)))}await callHook(suite,"afterAll",[suite])}catch(e){suite.result.state="fail",suite.result.error=e,process.exitCode=1}suite.result.end=performance.now(),suite.mode==="run"&&(hasTests(suite)?hasFailed(suite)&&(suite.result.state="fail"):(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(c4,ctx){return c4.type==="test"?runTest(c4,ctx):runSuite(c4,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();
@@ -42,7 +42,7 @@ declare class SnapshotManager {
42
42
  snapshotResolver?: SnapshotResolver | null;
43
43
  });
44
44
  onFileChanged(): void;
45
- setTask(task: Task): void;
45
+ setTest(test: Test): void;
46
46
  setContext(context: Context): void;
47
47
  assert(received: unknown, message: string): void;
48
48
  clear(): void;
@@ -111,25 +111,25 @@ interface ResolvedConfig extends Omit<Required<UserOptions>, 'config' | 'filters
111
111
  depsExternal: (string | RegExp)[];
112
112
  }
113
113
  declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
114
- declare type TaskState = RunMode | 'pass' | 'fail';
114
+ declare type TestState = RunMode | 'pass' | 'fail';
115
115
  declare type SuiteState = RunMode | 'pass' | 'fail';
116
116
  declare type ComputeMode = 'serial' | 'concurrent';
117
- interface Task {
118
- type: 'task';
117
+ interface Test {
118
+ type: 'test';
119
119
  name: string;
120
120
  mode: RunMode;
121
121
  computeMode: ComputeMode;
122
122
  suite: Suite;
123
123
  file?: File;
124
- result?: TaskResult;
124
+ result?: TestResult;
125
125
  }
126
- interface TaskResult {
127
- state: TaskState;
126
+ interface TestResult {
127
+ state: TestState;
128
128
  start: number;
129
129
  end?: number;
130
130
  error?: unknown;
131
131
  }
132
- declare type TaskOrSuite = Task | Suite;
132
+ declare type Task = Test | Suite;
133
133
  declare type TestFunction = () => Awaitable<void>;
134
134
  interface ConcurrentCollector {
135
135
  (name: string, fn: TestFunction): void;
@@ -160,24 +160,24 @@ declare type HookListener<T extends any[]> = (...args: T) => Awaitable<void>;
160
160
  interface SuiteHooks {
161
161
  beforeAll: HookListener<[Suite]>[];
162
162
  afterAll: HookListener<[Suite]>[];
163
- beforeEach: HookListener<[Task, Suite]>[];
164
- afterEach: HookListener<[Task, Suite]>[];
163
+ beforeEach: HookListener<[Test, Suite]>[];
164
+ afterEach: HookListener<[Test, Suite]>[];
165
165
  }
166
166
  interface Suite {
167
167
  type: 'suite';
168
168
  name: string;
169
169
  mode: RunMode;
170
170
  computeMode: ComputeMode;
171
- children: TaskOrSuite[];
171
+ tasks: Task[];
172
172
  file?: File;
173
- result?: TaskResult;
173
+ result?: TestResult;
174
174
  }
175
175
  interface SuiteCollector {
176
176
  readonly name: string;
177
177
  readonly mode: RunMode;
178
178
  type: 'collector';
179
179
  test: TestCollector;
180
- children: (Suite | Task | SuiteCollector)[];
180
+ tasks: (Suite | Test | SuiteCollector)[];
181
181
  collect: (file?: File) => Promise<Suite>;
182
182
  clear: () => void;
183
183
  on: <T extends keyof SuiteHooks>(name: T, ...fn: SuiteHooks[T]) => void;
@@ -189,25 +189,25 @@ interface File extends Suite {
189
189
  interface RunnerContext {
190
190
  filesMap: Record<string, File>;
191
191
  files: File[];
192
- tasks: Task[];
192
+ tests: Test[];
193
193
  config: ResolvedConfig;
194
194
  reporter: Reporter;
195
195
  snapshotManager: SnapshotManager;
196
196
  }
197
197
  interface GlobalContext {
198
- children: (SuiteCollector | Task)[];
198
+ tasks: (SuiteCollector | Test)[];
199
199
  currentSuite: SuiteCollector | null;
200
200
  }
201
201
  interface Reporter {
202
202
  onStart?: (config: ResolvedConfig) => Awaitable<void>;
203
203
  onCollected?: (files: File[], ctx: RunnerContext) => Awaitable<void>;
204
204
  onFinished?: (ctx: RunnerContext, files?: File[]) => Awaitable<void>;
205
- onTaskBegin?: (task: Task, ctx: RunnerContext) => Awaitable<void>;
206
- onTaskEnd?: (task: Task, ctx: RunnerContext) => Awaitable<void>;
205
+ onTestBegin?: (test: Test, ctx: RunnerContext) => Awaitable<void>;
206
+ onTestEnd?: (test: Test, ctx: RunnerContext) => Awaitable<void>;
207
207
  onSuiteBegin?: (suite: Suite, ctx: RunnerContext) => Awaitable<void>;
208
208
  onSuiteEnd?: (suite: Suite, ctx: RunnerContext) => Awaitable<void>;
209
209
  onWatcherStart?: (ctx: RunnerContext) => Awaitable<void>;
210
210
  onWatcherRerun?: (files: string[], trigger: string, ctx: RunnerContext) => Awaitable<void>;
211
211
  }
212
212
 
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, TaskState as d, SuiteState as e, Task as f, TaskResult as g, TaskOrSuite as h, TestCollector as i, Suite as j, RunnerContext as k, Reporter as l };
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, Test as f, TestResult as g, Task as h, TestCollector as i, Suite 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.40",
3
+ "version": "0.0.44",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "keywords": [
6
6
  "vite",
@@ -43,7 +43,7 @@
43
43
  ],
44
44
  "scripts": {
45
45
  "prepare": "esmo scripts/generate-types.ts",
46
- "build": "tsup --dts --minify",
46
+ "build": "tsup --dts --minify-whitespace --minify-syntax",
47
47
  "dev": "tsup --watch src",
48
48
  "lint": "eslint \"{src,test}/**/*.ts\"",
49
49
  "prepublishOnly": "nr build",
@@ -61,6 +61,7 @@
61
61
  "chai": "^4.3.4",
62
62
  "chai-subset": "^1.6.0",
63
63
  "diff": "^5.0.0",
64
+ "externality": "^0.1.5",
64
65
  "fast-glob": "^3.2.7",
65
66
  "find-up": "^6.2.0",
66
67
  "happy-dom": "^2.24.4",
@@ -72,7 +73,8 @@
72
73
  "sade": "^1.7.4",
73
74
  "sinon": "^12.0.1",
74
75
  "sinon-chai": "^3.7.0",
75
- "source-map": "^0.7.3"
76
+ "source-map": "^0.7.3",
77
+ "source-map-support": "^0.5.21"
76
78
  },
77
79
  "peerDependencies": {
78
80
  "vite": "^2.7.1"
@@ -1 +0,0 @@
1
- import{f as e}from"./chunk-XPSQDVUG.js";e();var t=["DOMException","URL","URLSearchParams","EventTarget","NamedNodeMap","Node","Attr","Element","DocumentFragment","DOMImplementation","Document","XMLDocument","CharacterData","Text","CDATASection","ProcessingInstruction","Comment","DocumentType","NodeList","HTMLCollection","HTMLOptionsCollection","DOMStringMap","DOMTokenList","StyleSheetList","HTMLElement","HTMLHeadElement","HTMLTitleElement","HTMLBaseElement","HTMLLinkElement","HTMLMetaElement","HTMLStyleElement","HTMLBodyElement","HTMLHeadingElement","HTMLParagraphElement","HTMLHRElement","HTMLPreElement","HTMLUListElement","HTMLOListElement","HTMLLIElement","HTMLMenuElement","HTMLDListElement","HTMLDivElement","HTMLAnchorElement","HTMLAreaElement","HTMLBRElement","HTMLButtonElement","HTMLCanvasElement","HTMLDataElement","HTMLDataListElement","HTMLDetailsElement","HTMLDialogElement","HTMLDirectoryElement","HTMLFieldSetElement","HTMLFontElement","HTMLFormElement","HTMLHtmlElement","HTMLImageElement","HTMLInputElement","HTMLLabelElement","HTMLLegendElement","HTMLMapElement","HTMLMarqueeElement","HTMLMediaElement","HTMLMeterElement","HTMLModElement","HTMLOptGroupElement","HTMLOptionElement","HTMLOutputElement","HTMLPictureElement","HTMLProgressElement","HTMLQuoteElement","HTMLScriptElement","HTMLSelectElement","HTMLSlotElement","HTMLSourceElement","HTMLSpanElement","HTMLTableCaptionElement","HTMLTableCellElement","HTMLTableColElement","HTMLTableElement","HTMLTimeElement","HTMLTableRowElement","HTMLTableSectionElement","HTMLTemplateElement","HTMLTextAreaElement","HTMLUnknownElement","HTMLFrameElement","HTMLFrameSetElement","HTMLIFrameElement","HTMLEmbedElement","HTMLObjectElement","HTMLParamElement","HTMLVideoElement","HTMLAudioElement","HTMLTrackElement","SVGElement","SVGGraphicsElement","SVGSVGElement","SVGTitleElement","SVGAnimatedString","SVGNumber","SVGStringList","Event","CloseEvent","CustomEvent","MessageEvent","ErrorEvent","HashChangeEvent","PopStateEvent","StorageEvent","ProgressEvent","PageTransitionEvent","UIEvent","FocusEvent","InputEvent","MouseEvent","KeyboardEvent","TouchEvent","CompositionEvent","WheelEvent","BarProp","External","Location","History","Screen","Performance","Navigator","PluginArray","MimeTypeArray","Plugin","MimeType","FileReader","Blob","File","FileList","ValidityState","DOMParser","XMLSerializer","FormData","XMLHttpRequestEventTarget","XMLHttpRequestUpload","XMLHttpRequest","WebSocket","NodeFilter","NodeIterator","TreeWalker","AbstractRange","Range","StaticRange","Selection","Storage","CustomElementRegistry","ShadowRoot","MutationObserver","MutationRecord","Headers","AbortController","AbortSignal"],n=["addEventListener","alert","atob","blur","btoa","close","confirm","createPopup","dispatchEvent","document","focus","frames","getComputedStyle","history","innerHeight","innerWidth","length","location","moveBy","moveTo","name","navigator","open","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","postMessage","print","prompt","removeEventListener","resizeBy","resizeTo","screen","screenLeft","screenTop","screenX","screenY","scroll","scrollBy","scrollLeft","scrollTo","scrollTop","scrollX","scrollY","self","stop","top","window"],m=t.concat(n);export{m as a};
@@ -1 +0,0 @@
1
- import{e as r,f as a,g as s,h as l,i as c,j as d,k as p,l as u,m as f,n as g,o as x}from"./chunk-Z2OPSSDM.js";import{d as i,f as e}from"./chunk-XPSQDVUG.js";var R={};i(R,{afterAll:()=>u,afterEach:()=>g,assert:()=>v,beforeAll:()=>p,beforeEach:()=>f,chai:()=>m,clearContext:()=>x,createSuiteHooks:()=>s,defaultSuite:()=>a,describe:()=>c,expect:()=>S,it:()=>d,mock:()=>T,should:()=>C,sinon:()=>t,spy:()=>k,stub:()=>y,suite:()=>r,test:()=>l});e();e();e();import m from"chai";import{assert as v,should as C,expect as S}from"chai";e();import t from"sinon";var{mock:T,spy:k,stub:y}=t;t.fn=t.spy;export{m as a,v as b,C as c,S as d,t as e,T as f,k as g,y as h,R as i};
@@ -1 +0,0 @@
1
- import{f as t}from"./chunk-XPSQDVUG.js";t();import{resolve as s}from"path";import{fileURLToPath as e}from"url";var i=s(e(import.meta.url),"../../dist"),a=["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],p=["**/node_modules/**","**/dist/**"],d=["suite","test","describe","it","chai","expect","assert","sinon","spy","mock","stub","beforeAll","afterAll","beforeEach","afterEach"];export{i as a,a as b,p as c,d};
@@ -1 +0,0 @@
1
- var f=Object.create;var a=Object.defineProperty,l=Object.defineProperties,_=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertyNames,e=Object.getOwnPropertySymbols,d=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;var p=(r,t,m)=>t in r?a(r,t,{enumerable:!0,configurable:!0,writable:!0,value:m}):r[t]=m,U=(r,t)=>{for(var m in t||(t={}))i.call(t,m)&&p(r,m,t[m]);if(e)for(var m of e(t))s.call(t,m)&&p(r,m,t[m]);return r},b=(r,t)=>l(r,h(t)),n=r=>a(r,"__esModule",{value:!0});var u=(r,t)=>()=>(r&&(t=r(r=0)),t);var g=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),j=(r,t)=>{n(r);for(var m in t)a(r,m,{get:t[m],enumerable:!0})},x=(r,t,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of c(t))!i.call(r,o)&&o!=="default"&&a(r,o,{get:()=>t[o],enumerable:!(m=_(t,o))||m.enumerable});return r},k=r=>x(n(a(r!=null?f(d(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);import{fileURLToPath as L}from"url";import P from"path";var R,y,T=u(()=>{R=L(import.meta.url),y=P.dirname(R)});export{U as a,b,g as c,j as d,k as e,T as f};
@@ -1 +0,0 @@
1
- import{f as k}from"./chunk-XPSQDVUG.js";k();k();var a={children:[],currentSuite:null};k();var x=new WeakMap,C=new WeakMap;function H(o,e){x.set(o,e)}function q(o){return x.get(o)}function M(o,e){C.set(o,e)}function b(o){return C.get(o)}var A=Q(),y=A("");function c(){return a.currentSuite||y}function G(){return{beforeAll:[],afterAll:[],beforeEach:[],afterEach:[]}}function f(o,e=()=>{},r,l){var T;let u=[],n=[],t;S();let i=W((p,d,s,R)=>{let F={type:"task",name:p,mode:s,computeMode:R??l??"serial",suite:{}};H(F,d),u.push(F)}),g={type:"collector",name:o,mode:r,test:i,children:u,collect:v,clear:w,on:E};function E(p,...d){b(t)[p].push(...d)}function S(){t={type:"suite",computeMode:"serial",name:o,mode:r,children:[]},M(t,G())}function w(){u.length=0,n.length=0,S()}async function v(p){if(n.length=0,e){let s=a.currentSuite;a.currentSuite=g,await e(i),a.currentSuite=s}let d=await Promise.all([...n,...u].map(s=>s.type==="collector"?s.collect(p):s));return t.file=p,t.children=d,d.forEach(s=>{s.type==="task"&&(s.suite=t,p&&(s.file=p))}),t}return(T=a.currentSuite)==null||T.children.push(g),g}function W(o){function e(t,i){o(t,i,"run")}e.concurrent=r,e.skip=l,e.only=u,e.todo=n;function r(t,i){o(t,i,"run","concurrent")}r.skip=(t,i)=>o(t,i,"skip","concurrent"),r.only=(t,i)=>o(t,i,"only","concurrent"),r.todo=n;function l(t,i){o(t,i,"skip")}l.concurrent=r.skip;function u(t,i){o(t,i,"only")}u.concurrent=r.only;function n(t){o(t,()=>{},"todo")}return n.concurrent=n,e}var P=function(){function o(n,t){return c().test(n,t)}function e(n,t){return c().test.concurrent(n,t)}e.skip=(n,t)=>c().test.concurrent.skip(n,t),e.only=(n,t)=>c().test.concurrent.only(n,t),e.todo=n=>c().test.concurrent.todo(n);function r(n,t){return c().test.skip(n,t)}r.concurrent=(n,t)=>c().test.skip.concurrent(n,t);function l(n,t){return c().test.only(n,t)}l.concurrent=(n,t)=>c().test.only.concurrent(n,t);function u(n){return c().test.todo(n)}return u.concurrent=n=>c().test.todo.concurrent(n),o.concurrent=e,o.skip=r,o.only=l,o.todo=u,o}();function Q(){function o(n,t){return f(n,t,"run")}function e(n,t){return f(n,t,"run","concurrent")}e.skip=(n,t)=>f(n,t,"skip","concurrent"),e.only=(n,t)=>f(n,t,"only","concurrent"),e.todo=n=>f(n,void 0,"todo");function r(n,t){return f(n,t,"skip")}r.concurrent=e.skip;function l(n,t){return f(n,t,"only")}l.concurrent=e.only;function u(n){return f(n,void 0,"todo")}return u.concurrent=e.todo,o.concurrent=e,o.skip=r,o.only=l,o.todo=u,o}var I=A,J=P,K=o=>c().on("beforeAll",o),L=o=>c().on("afterAll",o),N=o=>c().on("beforeEach",o),O=o=>c().on("afterEach",o);function U(){a.children.length=0,y.clear(),a.currentSuite=y}export{a,q as b,M as c,b as d,A as e,y as f,G as g,P as h,I as i,J as j,K as k,L as l,N as m,O as n,U as o};
@@ -1 +0,0 @@
1
- import{i as r}from"./chunk-LUQHGOPU.js";import"./chunk-Z2OPSSDM.js";import{d as l}from"./chunk-W4BWZKS2.js";import{f as i}from"./chunk-XPSQDVUG.js";i();function a(){l.forEach(o=>{globalThis[o]=r[o]})}export{a as registerApiGlobally};
@@ -1 +0,0 @@
1
- import{a as c}from"./chunk-F27UALKJ.js";import{f as n}from"./chunk-XPSQDVUG.js";n();import{Window as p}from"happy-dom";function a(o){let e=new p,r=c.concat(Object.getOwnPropertyNames(e)).filter(t=>!t.startsWith("_")).filter(t=>!(t in o));for(let t of r)o[t]=e[t];return{dom:e,restore(){e.happyDOM.cancelAsync(),r.forEach(t=>delete o[t])}}}export{a as setupHappyDOM};
@@ -1 +0,0 @@
1
- import{a as s}from"./chunk-F27UALKJ.js";import{f as n}from"./chunk-XPSQDVUG.js";n();import{JSDOM as i}from"jsdom";function u(e){let r=new i("<!DOCTYPE html>",{pretendToBeVisual:!0,runScripts:"dangerously",url:"http://localhost:3000"}),o=s.concat(Object.getOwnPropertyNames(r.window)).filter(t=>!t.startsWith("_")).filter(t=>!(t in e));for(let t of o)e[t]=r.window[t];return{dom:r,restore(){o.forEach(t=>delete e[t])}}}export{u as setupJSDOM};