vitest 0.0.62 → 0.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,9 @@
1
- import '../index';
2
- import { R as ResolvedConfig, w as RpcCall, x as RpcSend, W as WorkerContext } from '../types-c0d293d3';
3
- import 'chai';
4
- import 'sinon';
1
+ import { RpcCall, RpcSend, WorkerContext } from '../index';
2
+ import { R as ResolvedConfig } from '../options-63a726fa';
5
3
  import 'worker_threads';
6
- import '@antfu/utils';
7
4
  import 'vite';
5
+ import 'chai';
6
+ import 'sinon';
8
7
  import 'pretty-format';
9
8
 
10
9
  declare function init(ctx: WorkerContext): Promise<(files: string[], config: ResolvedConfig) => Promise<void>>;
@@ -0,0 +1,263 @@
1
+ import {
2
+ slash
3
+ } from "../chunk-5TNYWP3O.js";
4
+ import {
5
+ distDir
6
+ } from "../chunk-XUIDSY4V.js";
7
+ import {
8
+ nanoid
9
+ } from "../chunk-APGELTDH.js";
10
+ import {
11
+ init_esm_shims
12
+ } from "../chunk-R2SMNEBL.js";
13
+
14
+ // src/runtime/worker.ts
15
+ init_esm_shims();
16
+ import { resolve as resolve2 } from "path";
17
+
18
+ // src/node/execute.ts
19
+ init_esm_shims();
20
+ import { builtinModules, createRequire } from "module";
21
+ import { fileURLToPath, pathToFileURL } from "url";
22
+ import { dirname, resolve } from "path";
23
+ import vm from "vm";
24
+ var defaultInline = [
25
+ "@vue",
26
+ "@vueuse",
27
+ "vue-demi",
28
+ "vue",
29
+ /virtual:/,
30
+ /\.ts$/,
31
+ /\/esm\/.*\.js$/,
32
+ /\.(es|esm|esm-browser|esm-bundler|es6).js$/
33
+ ];
34
+ var depsExternal = [
35
+ /\.cjs.js$/
36
+ ];
37
+ var isWindows = process.platform === "win32";
38
+ var stubRequests = {
39
+ "/@vite/client": {
40
+ injectQuery: (id) => id,
41
+ createHotContext() {
42
+ return {
43
+ accept: () => {
44
+ },
45
+ prune: () => {
46
+ }
47
+ };
48
+ },
49
+ updateStyle() {
50
+ }
51
+ }
52
+ };
53
+ async function interpretedImport(path, interpretDefault) {
54
+ const mod = await import(path);
55
+ if (interpretDefault && "__esModule" in mod && "default" in mod) {
56
+ const defaultExport = mod.default;
57
+ if (!("default" in defaultExport)) {
58
+ Object.defineProperty(defaultExport, "default", {
59
+ enumerable: true,
60
+ configurable: true,
61
+ get() {
62
+ return defaultExport;
63
+ }
64
+ });
65
+ }
66
+ return defaultExport;
67
+ }
68
+ return mod;
69
+ }
70
+ async function executeInViteNode(options) {
71
+ const { moduleCache: moduleCache2, root, files, fetch } = options;
72
+ const externaled = new Set(builtinModules);
73
+ const result = [];
74
+ for (const file of files)
75
+ result.push(await cachedRequest(`/@fs/${slash(resolve(file))}`, []));
76
+ return result;
77
+ async function directRequest(id, fsPath, callstack) {
78
+ callstack = [...callstack, id];
79
+ const request = async (dep) => {
80
+ var _a;
81
+ if (callstack.includes(dep)) {
82
+ const cacheKey = toFilePath(dep, root);
83
+ if (!((_a = moduleCache2.get(cacheKey)) == null ? void 0 : _a.exports))
84
+ throw new Error(`Circular dependency detected
85
+ Stack:
86
+ ${[...callstack, dep].reverse().map((p) => `- ${p}`).join("\n")}`);
87
+ return moduleCache2.get(cacheKey).exports;
88
+ }
89
+ return cachedRequest(dep, callstack);
90
+ };
91
+ if (id in stubRequests)
92
+ return stubRequests[id];
93
+ const result2 = await fetch(id);
94
+ if (!result2)
95
+ throw new Error(`failed to load ${id}`);
96
+ const url = pathToFileURL(fsPath).href;
97
+ const exports = {};
98
+ setCache(fsPath, { transformResult: result2, exports });
99
+ const __filename2 = fileURLToPath(url);
100
+ const context = {
101
+ require: createRequire(url),
102
+ __filename: __filename2,
103
+ __dirname: dirname(__filename2),
104
+ __vite_ssr_import__: request,
105
+ __vite_ssr_dynamic_import__: request,
106
+ __vite_ssr_exports__: exports,
107
+ __vite_ssr_exportAll__: (obj) => exportAll(exports, obj),
108
+ __vite_ssr_import_meta__: { url }
109
+ };
110
+ const fn = vm.runInThisContext(`async (${Object.keys(context).join(",")})=>{${result2.code}
111
+ }`, {
112
+ filename: fsPath,
113
+ lineOffset: 0
114
+ });
115
+ await fn(...Object.values(context));
116
+ return exports;
117
+ }
118
+ function setCache(id, mod) {
119
+ if (!moduleCache2.has(id))
120
+ moduleCache2.set(id, mod);
121
+ else
122
+ Object.assign(moduleCache2.get(id), mod);
123
+ }
124
+ async function cachedRequest(rawId, callstack) {
125
+ var _a, _b;
126
+ const id = normalizeId(rawId);
127
+ if (externaled.has(id))
128
+ return interpretedImport(id, options.interpretDefault);
129
+ const fsPath = toFilePath(id, root);
130
+ const importPath = patchWindowsImportPath(fsPath);
131
+ if (externaled.has(importPath) || await shouldExternalize(importPath, options)) {
132
+ externaled.add(importPath);
133
+ return interpretedImport(importPath, options.interpretDefault);
134
+ }
135
+ if ((_a = moduleCache2.get(fsPath)) == null ? void 0 : _a.promise)
136
+ return (_b = moduleCache2.get(fsPath)) == null ? void 0 : _b.promise;
137
+ const promise = directRequest(id, fsPath, callstack);
138
+ setCache(fsPath, { promise });
139
+ return await promise;
140
+ }
141
+ function exportAll(exports, sourceModule) {
142
+ for (const key in sourceModule) {
143
+ if (key !== "default") {
144
+ try {
145
+ Object.defineProperty(exports, key, {
146
+ enumerable: true,
147
+ configurable: true,
148
+ get() {
149
+ return sourceModule[key];
150
+ }
151
+ });
152
+ } catch (_err) {
153
+ }
154
+ }
155
+ }
156
+ }
157
+ }
158
+ function normalizeId(id) {
159
+ if (id && id.startsWith("/@id/__x00__"))
160
+ id = `\0${id.slice("/@id/__x00__".length)}`;
161
+ if (id && id.startsWith("/@id/"))
162
+ id = id.slice("/@id/".length);
163
+ if (id.startsWith("__vite-browser-external:"))
164
+ id = id.slice("__vite-browser-external:".length);
165
+ if (id.startsWith("node:"))
166
+ id = id.slice("node:".length);
167
+ return id;
168
+ }
169
+ async function shouldExternalize(id, config) {
170
+ if (matchExternalizePattern(id, config.inline))
171
+ return false;
172
+ if (matchExternalizePattern(id, config.external))
173
+ return true;
174
+ if (matchExternalizePattern(id, depsExternal))
175
+ return true;
176
+ if (matchExternalizePattern(id, defaultInline))
177
+ return false;
178
+ return id.includes("/node_modules/");
179
+ }
180
+ function toFilePath(id, root) {
181
+ id = slash(id);
182
+ let absolute = id.startsWith("/@fs/") ? id.slice(4) : id.startsWith(dirname(root)) ? id : id.startsWith("/") ? slash(resolve(root, id.slice(1))) : id;
183
+ if (absolute.startsWith("//"))
184
+ absolute = absolute.slice(1);
185
+ return isWindows && absolute.startsWith("/") ? pathToFileURL(absolute.slice(1)).href : absolute;
186
+ }
187
+ function matchExternalizePattern(id, patterns) {
188
+ for (const ex of patterns) {
189
+ if (typeof ex === "string") {
190
+ if (id.includes(`/node_modules/${ex}/`))
191
+ return true;
192
+ } else {
193
+ if (ex.test(id))
194
+ return true;
195
+ }
196
+ }
197
+ return false;
198
+ }
199
+ function patchWindowsImportPath(path) {
200
+ if (path.match(/^\w:\//))
201
+ return `/${path}`;
202
+ else
203
+ return path;
204
+ }
205
+
206
+ // src/runtime/worker.ts
207
+ var _run;
208
+ var moduleCache = /* @__PURE__ */ new Map();
209
+ async function init(ctx) {
210
+ if (_run)
211
+ return _run;
212
+ const { config } = ctx;
213
+ _run = (await executeInViteNode({
214
+ root: config.root,
215
+ files: [
216
+ resolve2(distDir, "runtime/entry.js")
217
+ ],
218
+ fetch(id) {
219
+ return process.__vitest_worker__.rpc("fetch", id);
220
+ },
221
+ inline: config.depsInline,
222
+ external: config.depsExternal,
223
+ interpretDefault: config.interpretDefault,
224
+ moduleCache
225
+ }))[0].run;
226
+ return _run;
227
+ }
228
+ async function run(ctx) {
229
+ process.stdout.write("\0");
230
+ const { config, port } = ctx;
231
+ const rpcPromiseMap = /* @__PURE__ */ new Map();
232
+ process.__vitest_worker__ = {
233
+ config,
234
+ rpc: (method, ...args) => {
235
+ return new Promise((resolve3, reject) => {
236
+ const id = nanoid();
237
+ rpcPromiseMap.set(id, { resolve: resolve3, reject });
238
+ port.postMessage({ method, args, id });
239
+ });
240
+ },
241
+ send(method, ...args) {
242
+ port.postMessage({ method, args });
243
+ }
244
+ };
245
+ port.addListener("message", async (data) => {
246
+ const api = rpcPromiseMap.get(data.id);
247
+ if (api) {
248
+ if (data.error)
249
+ api.reject(data.error);
250
+ else
251
+ api.resolve(data.result);
252
+ }
253
+ });
254
+ const run2 = await init(ctx);
255
+ if (ctx.invalidates)
256
+ ctx.invalidates.forEach((i) => moduleCache.delete(i));
257
+ ctx.files.forEach((i) => moduleCache.delete(i));
258
+ return run2(ctx.files, ctx.config);
259
+ }
260
+ export {
261
+ run as default,
262
+ init
263
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.62",
3
+ "version": "0.0.66",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "keywords": [
6
6
  "vite",
@@ -39,70 +39,83 @@
39
39
  "*.d.ts"
40
40
  ],
41
41
  "scripts": {
42
- "build": "tsup --dts --minify-whitespace --minify-syntax",
42
+ "build": "tsup --dts",
43
43
  "coverage": "node bin/vitest.mjs -r test/core --coverage",
44
44
  "dev": "tsup --watch src",
45
- "typecheck": "tsc --noEmit",
45
+ "docs": "npm -C docs run dev",
46
+ "docs:build": "npm -C docs run build",
47
+ "docs:serve": "npm -C docs run serve",
46
48
  "lint": "eslint \"{src,test}/**/*.ts\"",
47
49
  "prepare": "esmo scripts/generate-types.ts",
48
50
  "prepublishOnly": "nr build",
49
51
  "release": "bumpp --commit --push --tag && esmo scripts/publish.ts",
50
52
  "test": "node bin/vitest.mjs -r test/core",
51
53
  "test:all": "pnpm -r --stream --filter !vitest run test --",
52
- "test:ci": "pnpm -r --stream --filter !vitest --filter !@vitest/test-fails run test --"
54
+ "test:ci": "pnpm -r --stream --filter !vitest --filter !@vitest/test-fails run test --",
55
+ "typecheck": "tsc --noEmit && nr lint"
53
56
  },
54
57
  "dependencies": {
55
- "@antfu/utils": "^0.3.0",
56
58
  "@types/chai": "^4.3.0",
57
59
  "@types/sinon-chai": "^3.2.6",
58
- "c8": "^7.10.0",
59
60
  "chai": "^4.3.4",
60
61
  "chai-subset": "^1.6.0",
61
- "cli-truncate": "^3.1.0",
62
- "diff": "^5.0.0",
63
- "elegant-spinner": "^3.0.0",
64
62
  "fast-glob": "^3.2.7",
65
- "figures": "^4.0.0",
66
- "find-up": "^6.2.0",
67
- "happy-dom": "^2.24.5",
68
- "jsdom": "^19.0.0",
69
- "log-symbols": "^4.1.0",
70
63
  "log-update": "^5.0.0",
71
- "mlly": "^0.3.15",
72
- "nanoid": "^3.1.30",
64
+ "micromatch": "^4.0.4",
73
65
  "picocolors": "^1.0.0",
74
- "piscina": "^3.1.0",
75
- "pretty-format": "^27.4.2",
76
- "sade": "^1.7.4",
66
+ "piscina": "^3.2.0",
77
67
  "sinon": "^12.0.1",
78
68
  "sinon-chai": "^3.7.0",
79
- "source-map": "^0.7.3",
80
- "source-map-support": "^0.5.21",
81
- "strip-ansi": "^7.0.1"
69
+ "source-map": "^0.7.3"
82
70
  },
83
71
  "devDependencies": {
84
- "@antfu/eslint-config": "^0.12.2",
85
- "@antfu/ni": "^0.11.1",
72
+ "@antfu/eslint-config": "^0.13.1",
73
+ "@antfu/ni": "^0.12.0",
86
74
  "@types/chai-subset": "^1.3.3",
87
75
  "@types/diff": "^5.0.1",
88
76
  "@types/jsdom": "^16.2.13",
77
+ "@types/micromatch": "^4.0.2",
89
78
  "@types/natural-compare": "^1.4.1",
90
79
  "@types/node": "^16.11.12",
91
80
  "@types/sade": "^1.7.3",
92
81
  "@types/sinon": "^10.0.6",
93
- "@types/source-map-support": "^0.5.4",
94
82
  "bumpp": "^7.1.1",
83
+ "c8": "^7.10.0",
84
+ "cac": "^6.7.12",
85
+ "cli-truncate": "^3.1.0",
86
+ "diff": "^5.0.0",
95
87
  "eslint": "^8.4.1",
96
88
  "esno": "^0.12.1",
89
+ "find-up": "^6.2.0",
90
+ "happy-dom": "^2.24.5",
91
+ "jsdom": "^19.0.0",
92
+ "nanoid": "^3.1.30",
93
+ "natural-compare": "^1.4.0",
97
94
  "npm-run-all": "^4.1.5",
95
+ "pretty-format": "^27.4.2",
98
96
  "rimraf": "^3.0.2",
99
- "tsup": "^5.10.3",
100
- "typescript": "^4.5.2",
97
+ "strip-ansi": "^7.0.1",
98
+ "tsup": "^5.11.1",
99
+ "typescript": "^4.5.3",
101
100
  "vite": "^2.7.1"
102
101
  },
103
102
  "peerDependencies": {
103
+ "c8": "*",
104
+ "happy-dom": "*",
105
+ "jsdom": "*",
104
106
  "vite": "^2.7.1"
105
107
  },
108
+ "peerDependenciesMeta": {
109
+ "c8": {
110
+ "optional": true
111
+ },
112
+ "happy-dom": {
113
+ "optional": true
114
+ },
115
+ "jsdom": {
116
+ "optional": true
117
+ }
118
+ },
106
119
  "engines": {
107
120
  "node": ">=16.0.0"
108
121
  }
@@ -1 +0,0 @@
1
- import{defaultHookTimeout,defaultTestTimeout,init_esm_shims}from"./chunk-NTRHKVSE.js";init_esm_shims();import{nanoid}from"nanoid";init_esm_shims();var context={tasks:[],currentSuite:null};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={id:nanoid(),type:"test",name:name2,mode:mode2,computeMode:computeMode??suiteComputeMode??"serial",suite:void 0};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={id:nanoid(),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.suite=suite2,file&&(task.file=file)}),suite2}return(_a=context.currentSuite)==null||_a.tasks.push(collector),collector}function createTestCollector(collectTest){function test2(name,fn,timeout){collectTest(name,withTimeout(fn,timeout),"run")}test2.concurrent=concurrent,test2.skip=skip,test2.only=only,test2.todo=todo;function concurrent(name,fn,timeout){collectTest(name,withTimeout(fn,timeout),"run","concurrent")}concurrent.skip=(name,fn,timeout)=>collectTest(name,withTimeout(fn,timeout),"skip","concurrent"),concurrent.only=(name,fn,timeout)=>collectTest(name,withTimeout(fn,timeout),"only","concurrent"),concurrent.todo=todo;function skip(name,fn,timeout){collectTest(name,withTimeout(fn,timeout),"skip")}skip.concurrent=concurrent.skip;function only(name,fn,timeout){collectTest(name,withTimeout(fn,timeout),"only")}only.concurrent=concurrent.only;function todo(name){collectTest(name,()=>{},"todo")}return todo.concurrent=todo,test2}var test=function(){function test2(name,fn,timeout){return getCurrentSuite().test(name,fn,timeout)}function concurrent(name,fn,timeout){return getCurrentSuite().test.concurrent(name,fn,timeout)}concurrent.skip=(name,fn,timeout)=>getCurrentSuite().test.concurrent.skip(name,fn,timeout),concurrent.only=(name,fn,timeout)=>getCurrentSuite().test.concurrent.only(name,fn,timeout),concurrent.todo=name=>getCurrentSuite().test.concurrent.todo(name);function skip(name,fn,timeout){return getCurrentSuite().test.skip(name,fn,timeout)}skip.concurrent=(name,fn,timeout)=>getCurrentSuite().test.skip.concurrent(name,fn,timeout);function only(name,fn,timeout){return getCurrentSuite().test.only(name,fn,timeout)}only.concurrent=(name,fn,timeout)=>getCurrentSuite().test.only.concurrent(name,fn,timeout);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,timeout=defaultHookTimeout)=>getCurrentSuite().on("beforeAll",withTimeout(fn,timeout)),afterAll=(fn,timeout=defaultHookTimeout)=>getCurrentSuite().on("afterAll",withTimeout(fn,timeout)),beforeEach=(fn,timeout=defaultHookTimeout)=>getCurrentSuite().on("beforeEach",withTimeout(fn,timeout)),afterEach=(fn,timeout=defaultHookTimeout)=>getCurrentSuite().on("afterEach",withTimeout(fn,timeout));function clearContext(){context.tasks.length=0,defaultSuite.clear(),context.currentSuite=defaultSuite}function withTimeout(fn,timeout=defaultTestTimeout){return timeout<=0||timeout===1/0?fn:(...args)=>Promise.race([fn(...args),new Promise((resolve,reject)=>{let timer=setTimeout(()=>{clearTimeout(timer),reject(new Error(`Test timed out in ${timeout}ms.`))},timeout);timer.unref()})])}export{context,getFn,setHooks,getHooks,suite,defaultSuite,createSuiteHooks,test,describe,it,beforeAll,afterAll,beforeEach,afterEach,clearContext};
@@ -1 +0,0 @@
1
- import{afterAll,afterEach,beforeAll,beforeEach,clearContext,createSuiteHooks,defaultSuite,describe,it,suite,test}from"./chunk-4HLM7BTV.js";import{__export,init_esm_shims}from"./chunk-NTRHKVSE.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};
@@ -1 +0,0 @@
1
- import{init_esm_shims}from"./chunk-NTRHKVSE.js";init_esm_shims();import{toArray}from"@antfu/utils";function partitionSuiteChildren(suite){let tasksGroup=[],tasksGroups=[];for(let c of suite.tasks)tasksGroup.length===0||c.computeMode===tasksGroup[0].computeMode?tasksGroup.push(c):(tasksGroups.push(tasksGroup),tasksGroup=[c]);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(c=>c.type==="test"?[c]:getTests(c)))}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(c=>c.type==="test"||hasTests(c)))}function hasFailed(suite){return toArray(suite).some(s=>{var _a;return((_a=s.result)==null?void 0:_a.state)==="fail"||s.type==="suite"&&hasFailed(s.tasks)})}function getNames(task){let names=[task.name],current=task;for(;(current==null?void 0:current.suite)||(current==null?void 0:current.file);)current=current.suite||current.file,(current==null?void 0:current.name)&&names.unshift(current.name);return names}init_esm_shims();var emptySummary=options=>({added:0,failure:!1,filesAdded:0,filesRemoved:0,filesRemovedList:[],filesUnmatched:0,filesUpdated:0,matched:0,total:0,unchecked:0,uncheckedKeysByFile:[],unmatched:0,updated:0,didUpdate:options.updateSnapshot==="all"}),packSnapshotState=(filepath,state)=>{let snapshot={filepath,added:0,fileDeleted:!1,matched:0,unchecked:0,uncheckedKeys:[],unmatched:0,updated:0},uncheckedCount=state.getUncheckedCount(),uncheckedKeys=state.getUncheckedKeys();uncheckedCount&&state.removeUncheckedKeys();let status=state.save();return snapshot.fileDeleted=status.deleted,snapshot.added=state.added,snapshot.matched=state.matched,snapshot.unmatched=state.unmatched,snapshot.updated=state.updated,snapshot.unchecked=status.deleted?0:uncheckedCount,snapshot.uncheckedKeys=Array.from(uncheckedKeys),snapshot},addSnapshotResult=(summary,result)=>{result.added&&summary.filesAdded++,result.fileDeleted&&summary.filesRemoved++,result.unmatched&&summary.filesUnmatched++,result.updated&&summary.filesUpdated++,summary.added+=result.added,summary.matched+=result.matched,summary.unchecked+=result.unchecked,result.uncheckedKeys&&result.uncheckedKeys.length>0&&summary.uncheckedKeysByFile.push({filePath:result.filepath,keys:result.uncheckedKeys}),summary.unmatched+=result.unmatched,summary.updated+=result.updated,summary.total+=result.added+result.matched+result.unmatched+result.updated};export{partitionSuiteChildren,interpretOnlyMode,getTests,getSuites,hasTests,hasFailed,getNames,emptySummary,packSnapshotState,addSnapshotResult};
@@ -1 +0,0 @@
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)}});init_esm_shims();import{resolve}from"path";import{fileURLToPath as fileURLToPath2}from"url";var distDir=resolve(fileURLToPath2(import.meta.url),"../../dist"),defaultTestTimeout=5e3,defaultHookTimeout=5e3,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{__spreadValues,__spreadProps,__commonJS,__export,__toModule,init_esm_shims,distDir,defaultTestTimeout,defaultHookTimeout,defaultIncludes,defaultExcludes,globalApis};
@@ -1 +0,0 @@
1
- import{src_exports}from"./chunk-JKSYS65D.js";import"./chunk-4HLM7BTV.js";import{globalApis,init_esm_shims}from"./chunk-NTRHKVSE.js";init_esm_shims();function registerApiGlobally(){globalApis.forEach(api=>{globalThis[api]=src_exports[api]})}export{registerApiGlobally};
@@ -1,4 +0,0 @@
1
- import{distDir,init_esm_shims}from"../chunk-NTRHKVSE.js";init_esm_shims();import{resolve as resolve2}from"path";import{nanoid}from"nanoid";init_esm_shims();import{builtinModules,createRequire}from"module";import{fileURLToPath,pathToFileURL}from"url";import{dirname,resolve}from"path";import vm from"vm";import{slash}from"@antfu/utils";var defaultInline=["vitest/dist","vitest/src","@vue","@vueuse","vue-demi","vue",/virtual:/,/\.ts$/,/\/esm\/.*\.js$/,/\.(es|esm|esm-browser|esm-bundler|es6).js$/],depsExternal=[/\.cjs.js$/],isWindows=process.platform==="win32",stubRequests={"/@vite/client":{injectQuery:id=>id,createHotContext(){return{accept:()=>{},prune:()=>{}}},updateStyle(){}}};async function interpretedImport(path,interpretDefault){let mod=await import(path);if(interpretDefault&&"__esModule"in mod&&"default"in mod){let defaultExport=mod.default;return"default"in defaultExport||Object.defineProperty(defaultExport,"default",{enumerable:!0,configurable:!0,get(){return defaultExport}}),defaultExport}return mod}async function executeInViteNode(options){let{moduleCache:moduleCache2,root,files,fetch}=options,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=moduleCache2.get(cacheKey))==null?void 0:_a.exports))throw new Error(`Circular dependency detected
2
- Stack:
3
- ${[...callstack,dep].reverse().map(p=>`- ${p}`).join(`
4
- `)}`);return moduleCache2.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){moduleCache2.has(id)?Object.assign(moduleCache2.get(id),mod):moduleCache2.set(id,mod)}async function cachedRequest(rawId,callstack){var _a,_b;let id=normalizeId(rawId);if(externaled.has(id))return interpretedImport(id,options.interpretDefault);let fsPath=toFilePath(id,root),importPath=patchWindowsImportPath(fsPath);if(externaled.has(importPath)||await shouldExternalize(importPath,options))return externaled.add(importPath),interpretedImport(importPath,options.interpretDefault);if((_a=moduleCache2.get(fsPath))==null?void 0:_a.promise)return(_b=moduleCache2.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}async function shouldExternalize(id,config){return matchExternalizePattern(id,config.inline)?!1:matchExternalizePattern(id,config.external)||matchExternalizePattern(id,depsExternal)?!0:matchExternalizePattern(id,defaultInline)?!1:id.includes("/node_modules/")}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 matchExternalizePattern(id,patterns){for(let ex of patterns)if(typeof ex=="string"){if(id.includes(`/node_modules/${ex}/`))return!0}else if(ex.test(id))return!0;return!1}function patchWindowsImportPath(path){return path.match(/^\w:\//)?`/${path}`:path}var _run,moduleCache=new Map;async function init(ctx){if(_run)return _run;let{config}=ctx;return _run=(await executeInViteNode({root:config.root,files:[resolve2(distDir,"runtime/entry.js")],fetch(id){return process.__vitest_worker__.rpc("fetch",id)},inline:config.depsInline,external:config.depsExternal,interpretDefault:config.interpretDefault,moduleCache}))[0].run,_run}async function run(ctx){process.stdout.write("\0");let{config,port}=ctx,rpcPromiseMap=new Map;process.__vitest_worker__={config,rpc:(method,...args)=>new Promise((resolve3,reject)=>{let id=nanoid();rpcPromiseMap.set(id,{resolve:resolve3,reject}),port.postMessage({method,args,id})}),send(method,...args){port.postMessage({method,args})}},port.addListener("message",async data=>{let api=rpcPromiseMap.get(data.id);api&&(data.error?api.reject(data.error):api.resolve(data.result))});let run2=await init(ctx);return ctx.invalidates&&ctx.invalidates.forEach(i=>moduleCache.delete(i)),ctx.files.forEach(i=>moduleCache.delete(i)),run2(ctx.files,ctx.config)}export{run as default,init};