vitest 0.0.64 → 0.0.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-5TNYWP3O.js +81 -0
- package/dist/chunk-ANPMHBIF.js +253 -0
- package/dist/chunk-APGELTDH.js +19 -0
- package/dist/chunk-R2SMNEBL.js +95 -0
- package/dist/chunk-VLGIKNLC.js +78 -0
- package/dist/chunk-XUIDSY4V.js +35 -0
- package/dist/chunk-YPKHVZRP.js +86 -0
- package/dist/global-PRFYLY7P.js +22 -0
- package/dist/index.d.ts +6 -8
- package/dist/index.js +46 -1
- package/dist/node/cli.d.ts +0 -12
- package/dist/node/cli.js +2609 -19
- package/dist/{options-654578ef.d.ts → options-63a726fa.d.ts} +46 -2
- package/dist/runtime/entry.d.ts +2 -2
- package/dist/runtime/entry.js +2535 -9
- package/dist/runtime/worker.d.ts +1 -3
- package/dist/runtime/worker.js +263 -4
- package/package.json +21 -22
- package/dist/chunk-3P4SNPBT.js +0 -1
- package/dist/chunk-3VLG4URE.js +0 -1
- package/dist/chunk-CNY47EZT.js +0 -1
- package/dist/chunk-H3VLV7UP.js +0 -1
- package/dist/general-39d52683.d.ts +0 -43
- package/dist/global-E2TE3466.js +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-R2SMNEBL.js";
|
|
4
|
+
|
|
5
|
+
// src/utils.ts
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
function toArray(array) {
|
|
8
|
+
array = array || [];
|
|
9
|
+
if (Array.isArray(array))
|
|
10
|
+
return array;
|
|
11
|
+
return [array];
|
|
12
|
+
}
|
|
13
|
+
function notNullish(v) {
|
|
14
|
+
return v != null;
|
|
15
|
+
}
|
|
16
|
+
function slash(str) {
|
|
17
|
+
return str.replace(/\\/g, "/");
|
|
18
|
+
}
|
|
19
|
+
function partitionSuiteChildren(suite) {
|
|
20
|
+
let tasksGroup = [];
|
|
21
|
+
const tasksGroups = [];
|
|
22
|
+
for (const c of suite.tasks) {
|
|
23
|
+
if (tasksGroup.length === 0 || c.computeMode === tasksGroup[0].computeMode) {
|
|
24
|
+
tasksGroup.push(c);
|
|
25
|
+
} else {
|
|
26
|
+
tasksGroups.push(tasksGroup);
|
|
27
|
+
tasksGroup = [c];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (tasksGroup.length > 0)
|
|
31
|
+
tasksGroups.push(tasksGroup);
|
|
32
|
+
return tasksGroups;
|
|
33
|
+
}
|
|
34
|
+
function interpretOnlyMode(items) {
|
|
35
|
+
if (items.some((i) => i.mode === "only")) {
|
|
36
|
+
items.forEach((i) => {
|
|
37
|
+
if (i.mode === "run")
|
|
38
|
+
i.mode = "skip";
|
|
39
|
+
else if (i.mode === "only")
|
|
40
|
+
i.mode = "run";
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function getTests(suite) {
|
|
45
|
+
return toArray(suite).flatMap((s) => s.tasks.flatMap((c) => c.type === "test" ? [c] : getTests(c)));
|
|
46
|
+
}
|
|
47
|
+
function getSuites(suite) {
|
|
48
|
+
return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []);
|
|
49
|
+
}
|
|
50
|
+
function hasTests(suite) {
|
|
51
|
+
return toArray(suite).some((s) => s.tasks.some((c) => c.type === "test" || hasTests(c)));
|
|
52
|
+
}
|
|
53
|
+
function hasFailed(suite) {
|
|
54
|
+
return toArray(suite).some((s) => {
|
|
55
|
+
var _a;
|
|
56
|
+
return ((_a = s.result) == null ? void 0 : _a.state) === "fail" || s.type === "suite" && hasFailed(s.tasks);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function getNames(task) {
|
|
60
|
+
const names = [task.name];
|
|
61
|
+
let current = task;
|
|
62
|
+
while ((current == null ? void 0 : current.suite) || (current == null ? void 0 : current.file)) {
|
|
63
|
+
current = current.suite || current.file;
|
|
64
|
+
if (current == null ? void 0 : current.name)
|
|
65
|
+
names.unshift(current.name);
|
|
66
|
+
}
|
|
67
|
+
return names;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
toArray,
|
|
72
|
+
notNullish,
|
|
73
|
+
slash,
|
|
74
|
+
partitionSuiteChildren,
|
|
75
|
+
interpretOnlyMode,
|
|
76
|
+
getTests,
|
|
77
|
+
getSuites,
|
|
78
|
+
hasTests,
|
|
79
|
+
hasFailed,
|
|
80
|
+
getNames
|
|
81
|
+
};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import {
|
|
2
|
+
nanoid
|
|
3
|
+
} from "./chunk-APGELTDH.js";
|
|
4
|
+
import {
|
|
5
|
+
init_esm_shims
|
|
6
|
+
} from "./chunk-R2SMNEBL.js";
|
|
7
|
+
|
|
8
|
+
// src/runtime/suite.ts
|
|
9
|
+
init_esm_shims();
|
|
10
|
+
|
|
11
|
+
// src/runtime/context.ts
|
|
12
|
+
init_esm_shims();
|
|
13
|
+
var context = {
|
|
14
|
+
tasks: [],
|
|
15
|
+
currentSuite: null
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// src/runtime/map.ts
|
|
19
|
+
init_esm_shims();
|
|
20
|
+
var fnMap = new WeakMap();
|
|
21
|
+
var hooksMap = new WeakMap();
|
|
22
|
+
function setFn(key, fn) {
|
|
23
|
+
fnMap.set(key, fn);
|
|
24
|
+
}
|
|
25
|
+
function getFn(key) {
|
|
26
|
+
return fnMap.get(key);
|
|
27
|
+
}
|
|
28
|
+
function setHooks(key, hooks) {
|
|
29
|
+
hooksMap.set(key, hooks);
|
|
30
|
+
}
|
|
31
|
+
function getHooks(key) {
|
|
32
|
+
return hooksMap.get(key);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/runtime/suite.ts
|
|
36
|
+
var suite = createSuite();
|
|
37
|
+
var defaultSuite = suite("");
|
|
38
|
+
function getCurrentSuite() {
|
|
39
|
+
return context.currentSuite || defaultSuite;
|
|
40
|
+
}
|
|
41
|
+
var getDefaultTestTimeout = () => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return ((_b = (_a = process.__vitest_worker__) == null ? void 0 : _a.config) == null ? void 0 : _b.testTimeout) ?? 5e3;
|
|
44
|
+
};
|
|
45
|
+
var getDefaultHookTimeout = () => {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
return ((_b = (_a = process.__vitest_worker__) == null ? void 0 : _a.config) == null ? void 0 : _b.hookTimeout) ?? 5e3;
|
|
48
|
+
};
|
|
49
|
+
function createSuiteHooks() {
|
|
50
|
+
return {
|
|
51
|
+
beforeAll: [],
|
|
52
|
+
afterAll: [],
|
|
53
|
+
beforeEach: [],
|
|
54
|
+
afterEach: []
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function createSuiteCollector(name, factory = () => {
|
|
58
|
+
}, mode, suiteComputeMode) {
|
|
59
|
+
var _a;
|
|
60
|
+
const tasks = [];
|
|
61
|
+
const factoryQueue = [];
|
|
62
|
+
let suite2;
|
|
63
|
+
initSuite();
|
|
64
|
+
const test2 = createTestCollector((name2, fn, mode2, computeMode) => {
|
|
65
|
+
const test3 = {
|
|
66
|
+
id: nanoid(),
|
|
67
|
+
type: "test",
|
|
68
|
+
name: name2,
|
|
69
|
+
mode: mode2,
|
|
70
|
+
computeMode: computeMode ?? (suiteComputeMode ?? "serial"),
|
|
71
|
+
suite: void 0
|
|
72
|
+
};
|
|
73
|
+
setFn(test3, fn);
|
|
74
|
+
tasks.push(test3);
|
|
75
|
+
});
|
|
76
|
+
const collector = {
|
|
77
|
+
type: "collector",
|
|
78
|
+
name,
|
|
79
|
+
mode,
|
|
80
|
+
test: test2,
|
|
81
|
+
tasks,
|
|
82
|
+
collect,
|
|
83
|
+
clear,
|
|
84
|
+
on: addHook
|
|
85
|
+
};
|
|
86
|
+
function addHook(name2, ...fn) {
|
|
87
|
+
getHooks(suite2)[name2].push(...fn);
|
|
88
|
+
}
|
|
89
|
+
function initSuite() {
|
|
90
|
+
suite2 = {
|
|
91
|
+
id: nanoid(),
|
|
92
|
+
type: "suite",
|
|
93
|
+
computeMode: "serial",
|
|
94
|
+
name,
|
|
95
|
+
mode,
|
|
96
|
+
tasks: []
|
|
97
|
+
};
|
|
98
|
+
setHooks(suite2, createSuiteHooks());
|
|
99
|
+
}
|
|
100
|
+
function clear() {
|
|
101
|
+
tasks.length = 0;
|
|
102
|
+
factoryQueue.length = 0;
|
|
103
|
+
initSuite();
|
|
104
|
+
}
|
|
105
|
+
async function collect(file) {
|
|
106
|
+
factoryQueue.length = 0;
|
|
107
|
+
if (factory) {
|
|
108
|
+
const prev = context.currentSuite;
|
|
109
|
+
context.currentSuite = collector;
|
|
110
|
+
await factory(test2);
|
|
111
|
+
context.currentSuite = prev;
|
|
112
|
+
}
|
|
113
|
+
const allChildren = await Promise.all([...factoryQueue, ...tasks].map((i) => i.type === "collector" ? i.collect(file) : i));
|
|
114
|
+
suite2.file = file;
|
|
115
|
+
suite2.tasks = allChildren;
|
|
116
|
+
allChildren.forEach((task) => {
|
|
117
|
+
task.suite = suite2;
|
|
118
|
+
if (file)
|
|
119
|
+
task.file = file;
|
|
120
|
+
});
|
|
121
|
+
return suite2;
|
|
122
|
+
}
|
|
123
|
+
(_a = context.currentSuite) == null ? void 0 : _a.tasks.push(collector);
|
|
124
|
+
return collector;
|
|
125
|
+
}
|
|
126
|
+
function createTestCollector(collectTest) {
|
|
127
|
+
function test2(name, fn, timeout) {
|
|
128
|
+
collectTest(name, withTimeout(fn, timeout), "run");
|
|
129
|
+
}
|
|
130
|
+
test2.concurrent = concurrent;
|
|
131
|
+
test2.skip = skip;
|
|
132
|
+
test2.only = only;
|
|
133
|
+
test2.todo = todo;
|
|
134
|
+
function concurrent(name, fn, timeout) {
|
|
135
|
+
collectTest(name, withTimeout(fn, timeout), "run", "concurrent");
|
|
136
|
+
}
|
|
137
|
+
concurrent.skip = (name, fn, timeout) => collectTest(name, withTimeout(fn, timeout), "skip", "concurrent");
|
|
138
|
+
concurrent.only = (name, fn, timeout) => collectTest(name, withTimeout(fn, timeout), "only", "concurrent");
|
|
139
|
+
concurrent.todo = todo;
|
|
140
|
+
function skip(name, fn, timeout) {
|
|
141
|
+
collectTest(name, withTimeout(fn, timeout), "skip");
|
|
142
|
+
}
|
|
143
|
+
skip.concurrent = concurrent.skip;
|
|
144
|
+
function only(name, fn, timeout) {
|
|
145
|
+
collectTest(name, withTimeout(fn, timeout), "only");
|
|
146
|
+
}
|
|
147
|
+
only.concurrent = concurrent.only;
|
|
148
|
+
function todo(name) {
|
|
149
|
+
collectTest(name, () => {
|
|
150
|
+
}, "todo");
|
|
151
|
+
}
|
|
152
|
+
todo.concurrent = todo;
|
|
153
|
+
return test2;
|
|
154
|
+
}
|
|
155
|
+
var test = function() {
|
|
156
|
+
function test2(name, fn, timeout) {
|
|
157
|
+
return getCurrentSuite().test(name, fn, timeout);
|
|
158
|
+
}
|
|
159
|
+
function concurrent(name, fn, timeout) {
|
|
160
|
+
return getCurrentSuite().test.concurrent(name, fn, timeout);
|
|
161
|
+
}
|
|
162
|
+
concurrent.skip = (name, fn, timeout) => getCurrentSuite().test.concurrent.skip(name, fn, timeout);
|
|
163
|
+
concurrent.only = (name, fn, timeout) => getCurrentSuite().test.concurrent.only(name, fn, timeout);
|
|
164
|
+
concurrent.todo = (name) => getCurrentSuite().test.concurrent.todo(name);
|
|
165
|
+
function skip(name, fn, timeout) {
|
|
166
|
+
return getCurrentSuite().test.skip(name, fn, timeout);
|
|
167
|
+
}
|
|
168
|
+
skip.concurrent = (name, fn, timeout) => getCurrentSuite().test.skip.concurrent(name, fn, timeout);
|
|
169
|
+
function only(name, fn, timeout) {
|
|
170
|
+
return getCurrentSuite().test.only(name, fn, timeout);
|
|
171
|
+
}
|
|
172
|
+
only.concurrent = (name, fn, timeout) => getCurrentSuite().test.only.concurrent(name, fn, timeout);
|
|
173
|
+
function todo(name) {
|
|
174
|
+
return getCurrentSuite().test.todo(name);
|
|
175
|
+
}
|
|
176
|
+
todo.concurrent = (name) => getCurrentSuite().test.todo.concurrent(name);
|
|
177
|
+
test2.concurrent = concurrent;
|
|
178
|
+
test2.skip = skip;
|
|
179
|
+
test2.only = only;
|
|
180
|
+
test2.todo = todo;
|
|
181
|
+
return test2;
|
|
182
|
+
}();
|
|
183
|
+
function createSuite() {
|
|
184
|
+
function suite2(suiteName, factory) {
|
|
185
|
+
return createSuiteCollector(suiteName, factory, "run");
|
|
186
|
+
}
|
|
187
|
+
function concurrent(suiteName, factory) {
|
|
188
|
+
return createSuiteCollector(suiteName, factory, "run", "concurrent");
|
|
189
|
+
}
|
|
190
|
+
concurrent.skip = (suiteName, factory) => createSuiteCollector(suiteName, factory, "skip", "concurrent");
|
|
191
|
+
concurrent.only = (suiteName, factory) => createSuiteCollector(suiteName, factory, "only", "concurrent");
|
|
192
|
+
concurrent.todo = (suiteName) => createSuiteCollector(suiteName, void 0, "todo");
|
|
193
|
+
function skip(suiteName, factory) {
|
|
194
|
+
return createSuiteCollector(suiteName, factory, "skip");
|
|
195
|
+
}
|
|
196
|
+
skip.concurrent = concurrent.skip;
|
|
197
|
+
function only(suiteName, factory) {
|
|
198
|
+
return createSuiteCollector(suiteName, factory, "only");
|
|
199
|
+
}
|
|
200
|
+
only.concurrent = concurrent.only;
|
|
201
|
+
function todo(suiteName) {
|
|
202
|
+
return createSuiteCollector(suiteName, void 0, "todo");
|
|
203
|
+
}
|
|
204
|
+
todo.concurrent = concurrent.todo;
|
|
205
|
+
suite2.concurrent = concurrent;
|
|
206
|
+
suite2.skip = skip;
|
|
207
|
+
suite2.only = only;
|
|
208
|
+
suite2.todo = todo;
|
|
209
|
+
return suite2;
|
|
210
|
+
}
|
|
211
|
+
var describe = suite;
|
|
212
|
+
var it = test;
|
|
213
|
+
var beforeAll = (fn, timeout) => getCurrentSuite().on("beforeAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
214
|
+
var afterAll = (fn, timeout) => getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
215
|
+
var beforeEach = (fn, timeout) => getCurrentSuite().on("beforeEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
216
|
+
var afterEach = (fn, timeout) => getCurrentSuite().on("afterEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
217
|
+
function clearContext() {
|
|
218
|
+
context.tasks.length = 0;
|
|
219
|
+
defaultSuite.clear();
|
|
220
|
+
context.currentSuite = defaultSuite;
|
|
221
|
+
}
|
|
222
|
+
function withTimeout(fn, _timeout) {
|
|
223
|
+
const timeout = _timeout ?? getDefaultTestTimeout();
|
|
224
|
+
if (timeout <= 0 || timeout === Infinity)
|
|
225
|
+
return fn;
|
|
226
|
+
return (...args) => {
|
|
227
|
+
return Promise.race([fn(...args), new Promise((resolve, reject) => {
|
|
228
|
+
const timer = setTimeout(() => {
|
|
229
|
+
clearTimeout(timer);
|
|
230
|
+
reject(new Error(`Test timed out in ${timeout}ms.`));
|
|
231
|
+
}, timeout);
|
|
232
|
+
timer.unref();
|
|
233
|
+
})]);
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export {
|
|
238
|
+
context,
|
|
239
|
+
getFn,
|
|
240
|
+
setHooks,
|
|
241
|
+
getHooks,
|
|
242
|
+
suite,
|
|
243
|
+
defaultSuite,
|
|
244
|
+
createSuiteHooks,
|
|
245
|
+
test,
|
|
246
|
+
describe,
|
|
247
|
+
it,
|
|
248
|
+
beforeAll,
|
|
249
|
+
afterAll,
|
|
250
|
+
beforeEach,
|
|
251
|
+
afterEach,
|
|
252
|
+
clearContext
|
|
253
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-R2SMNEBL.js";
|
|
4
|
+
|
|
5
|
+
// node_modules/.pnpm/nanoid@3.1.30/node_modules/nanoid/non-secure/index.js
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
8
|
+
var nanoid = (size = 21) => {
|
|
9
|
+
let id = "";
|
|
10
|
+
let i = size;
|
|
11
|
+
while (i--) {
|
|
12
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
13
|
+
}
|
|
14
|
+
return id;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
nanoid
|
|
19
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __esm = (fn, res) => function __init() {
|
|
26
|
+
return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res;
|
|
27
|
+
};
|
|
28
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
29
|
+
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
30
|
+
};
|
|
31
|
+
var __export = (target, all) => {
|
|
32
|
+
__markAsModule(target);
|
|
33
|
+
for (var name in all)
|
|
34
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
35
|
+
};
|
|
36
|
+
var __reExport = (target, module, desc) => {
|
|
37
|
+
if (module && typeof module === "object" || typeof module === "function") {
|
|
38
|
+
for (let key of __getOwnPropNames(module))
|
|
39
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
40
|
+
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
};
|
|
44
|
+
var __toModule = (module) => {
|
|
45
|
+
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
|
|
46
|
+
};
|
|
47
|
+
var __accessCheck = (obj, member, msg) => {
|
|
48
|
+
if (!member.has(obj))
|
|
49
|
+
throw TypeError("Cannot " + msg);
|
|
50
|
+
};
|
|
51
|
+
var __privateGet = (obj, member, getter) => {
|
|
52
|
+
__accessCheck(obj, member, "read from private field");
|
|
53
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
54
|
+
};
|
|
55
|
+
var __privateAdd = (obj, member, value) => {
|
|
56
|
+
if (member.has(obj))
|
|
57
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
58
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
59
|
+
};
|
|
60
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
61
|
+
__accessCheck(obj, member, "write to private field");
|
|
62
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
63
|
+
return value;
|
|
64
|
+
};
|
|
65
|
+
var __privateWrapper = (obj, member, setter, getter) => {
|
|
66
|
+
return {
|
|
67
|
+
set _(value) {
|
|
68
|
+
__privateSet(obj, member, value, setter);
|
|
69
|
+
},
|
|
70
|
+
get _() {
|
|
71
|
+
return __privateGet(obj, member, getter);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// node_modules/.pnpm/tsup@5.11.1_typescript@4.5.3/node_modules/tsup/assets/esm_shims.js
|
|
77
|
+
import { fileURLToPath } from "url";
|
|
78
|
+
import path from "path";
|
|
79
|
+
var init_esm_shims = __esm({
|
|
80
|
+
"node_modules/.pnpm/tsup@5.11.1_typescript@4.5.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
__spreadValues,
|
|
86
|
+
__spreadProps,
|
|
87
|
+
__commonJS,
|
|
88
|
+
__export,
|
|
89
|
+
__toModule,
|
|
90
|
+
__privateGet,
|
|
91
|
+
__privateAdd,
|
|
92
|
+
__privateSet,
|
|
93
|
+
__privateWrapper,
|
|
94
|
+
init_esm_shims
|
|
95
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-R2SMNEBL.js";
|
|
4
|
+
|
|
5
|
+
// src/integrations/snapshot/port/jest-test-result-helper.ts
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
var emptySummary = (options) => {
|
|
8
|
+
const summary = {
|
|
9
|
+
added: 0,
|
|
10
|
+
failure: false,
|
|
11
|
+
filesAdded: 0,
|
|
12
|
+
filesRemoved: 0,
|
|
13
|
+
filesRemovedList: [],
|
|
14
|
+
filesUnmatched: 0,
|
|
15
|
+
filesUpdated: 0,
|
|
16
|
+
matched: 0,
|
|
17
|
+
total: 0,
|
|
18
|
+
unchecked: 0,
|
|
19
|
+
uncheckedKeysByFile: [],
|
|
20
|
+
unmatched: 0,
|
|
21
|
+
updated: 0,
|
|
22
|
+
didUpdate: options.updateSnapshot === "all"
|
|
23
|
+
};
|
|
24
|
+
return summary;
|
|
25
|
+
};
|
|
26
|
+
var packSnapshotState = (filepath, state) => {
|
|
27
|
+
const snapshot = {
|
|
28
|
+
filepath,
|
|
29
|
+
added: 0,
|
|
30
|
+
fileDeleted: false,
|
|
31
|
+
matched: 0,
|
|
32
|
+
unchecked: 0,
|
|
33
|
+
uncheckedKeys: [],
|
|
34
|
+
unmatched: 0,
|
|
35
|
+
updated: 0
|
|
36
|
+
};
|
|
37
|
+
const uncheckedCount = state.getUncheckedCount();
|
|
38
|
+
const uncheckedKeys = state.getUncheckedKeys();
|
|
39
|
+
if (uncheckedCount)
|
|
40
|
+
state.removeUncheckedKeys();
|
|
41
|
+
const status = state.save();
|
|
42
|
+
snapshot.fileDeleted = status.deleted;
|
|
43
|
+
snapshot.added = state.added;
|
|
44
|
+
snapshot.matched = state.matched;
|
|
45
|
+
snapshot.unmatched = state.unmatched;
|
|
46
|
+
snapshot.updated = state.updated;
|
|
47
|
+
snapshot.unchecked = !status.deleted ? uncheckedCount : 0;
|
|
48
|
+
snapshot.uncheckedKeys = Array.from(uncheckedKeys);
|
|
49
|
+
return snapshot;
|
|
50
|
+
};
|
|
51
|
+
var addSnapshotResult = (summary, result) => {
|
|
52
|
+
if (result.added)
|
|
53
|
+
summary.filesAdded++;
|
|
54
|
+
if (result.fileDeleted)
|
|
55
|
+
summary.filesRemoved++;
|
|
56
|
+
if (result.unmatched)
|
|
57
|
+
summary.filesUnmatched++;
|
|
58
|
+
if (result.updated)
|
|
59
|
+
summary.filesUpdated++;
|
|
60
|
+
summary.added += result.added;
|
|
61
|
+
summary.matched += result.matched;
|
|
62
|
+
summary.unchecked += result.unchecked;
|
|
63
|
+
if (result.uncheckedKeys && result.uncheckedKeys.length > 0) {
|
|
64
|
+
summary.uncheckedKeysByFile.push({
|
|
65
|
+
filePath: result.filepath,
|
|
66
|
+
keys: result.uncheckedKeys
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
summary.unmatched += result.unmatched;
|
|
70
|
+
summary.updated += result.updated;
|
|
71
|
+
summary.total += result.added + result.matched + result.unmatched + result.updated;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
emptySummary,
|
|
76
|
+
packSnapshotState,
|
|
77
|
+
addSnapshotResult
|
|
78
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-R2SMNEBL.js";
|
|
4
|
+
|
|
5
|
+
// src/constants.ts
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
import { resolve } from "path";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
var distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
|
|
10
|
+
var defaultIncludes = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
|
|
11
|
+
var defaultExcludes = ["**/node_modules/**", "**/dist/**"];
|
|
12
|
+
var globalApis = [
|
|
13
|
+
"suite",
|
|
14
|
+
"test",
|
|
15
|
+
"describe",
|
|
16
|
+
"it",
|
|
17
|
+
"chai",
|
|
18
|
+
"expect",
|
|
19
|
+
"assert",
|
|
20
|
+
"sinon",
|
|
21
|
+
"spy",
|
|
22
|
+
"mock",
|
|
23
|
+
"stub",
|
|
24
|
+
"beforeAll",
|
|
25
|
+
"afterAll",
|
|
26
|
+
"beforeEach",
|
|
27
|
+
"afterEach"
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
distDir,
|
|
32
|
+
defaultIncludes,
|
|
33
|
+
defaultExcludes,
|
|
34
|
+
globalApis
|
|
35
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
afterAll,
|
|
3
|
+
afterEach,
|
|
4
|
+
beforeAll,
|
|
5
|
+
beforeEach,
|
|
6
|
+
clearContext,
|
|
7
|
+
createSuiteHooks,
|
|
8
|
+
defaultSuite,
|
|
9
|
+
describe,
|
|
10
|
+
it,
|
|
11
|
+
suite,
|
|
12
|
+
test
|
|
13
|
+
} from "./chunk-ANPMHBIF.js";
|
|
14
|
+
import {
|
|
15
|
+
__export,
|
|
16
|
+
init_esm_shims
|
|
17
|
+
} from "./chunk-R2SMNEBL.js";
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
afterAll: () => afterAll,
|
|
23
|
+
afterEach: () => afterEach,
|
|
24
|
+
assert: () => assert,
|
|
25
|
+
beforeAll: () => beforeAll,
|
|
26
|
+
beforeEach: () => beforeEach,
|
|
27
|
+
chai: () => chai,
|
|
28
|
+
clearContext: () => clearContext,
|
|
29
|
+
createSuiteHooks: () => createSuiteHooks,
|
|
30
|
+
defaultSuite: () => defaultSuite,
|
|
31
|
+
describe: () => describe,
|
|
32
|
+
expect: () => expect,
|
|
33
|
+
it: () => it,
|
|
34
|
+
mock: () => mock,
|
|
35
|
+
should: () => should,
|
|
36
|
+
sinon: () => sinon,
|
|
37
|
+
spy: () => spy,
|
|
38
|
+
stub: () => stub,
|
|
39
|
+
suite: () => suite,
|
|
40
|
+
test: () => test
|
|
41
|
+
});
|
|
42
|
+
init_esm_shims();
|
|
43
|
+
|
|
44
|
+
// src/types/index.ts
|
|
45
|
+
init_esm_shims();
|
|
46
|
+
|
|
47
|
+
// src/types/options.ts
|
|
48
|
+
init_esm_shims();
|
|
49
|
+
|
|
50
|
+
// src/types/tasks.ts
|
|
51
|
+
init_esm_shims();
|
|
52
|
+
|
|
53
|
+
// src/types/reporter.ts
|
|
54
|
+
init_esm_shims();
|
|
55
|
+
|
|
56
|
+
// src/types/snapshot.ts
|
|
57
|
+
init_esm_shims();
|
|
58
|
+
|
|
59
|
+
// src/types/worker.ts
|
|
60
|
+
init_esm_shims();
|
|
61
|
+
|
|
62
|
+
// src/types/general.ts
|
|
63
|
+
init_esm_shims();
|
|
64
|
+
|
|
65
|
+
// src/integrations/chai/index.ts
|
|
66
|
+
init_esm_shims();
|
|
67
|
+
import chai from "chai";
|
|
68
|
+
import { assert, should, expect } from "chai";
|
|
69
|
+
|
|
70
|
+
// src/integrations/sinon.ts
|
|
71
|
+
init_esm_shims();
|
|
72
|
+
import sinon from "sinon";
|
|
73
|
+
var { mock, spy, stub } = sinon;
|
|
74
|
+
sinon.fn = sinon.spy;
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
chai,
|
|
78
|
+
assert,
|
|
79
|
+
should,
|
|
80
|
+
expect,
|
|
81
|
+
sinon,
|
|
82
|
+
mock,
|
|
83
|
+
spy,
|
|
84
|
+
stub,
|
|
85
|
+
src_exports
|
|
86
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
src_exports
|
|
3
|
+
} from "./chunk-YPKHVZRP.js";
|
|
4
|
+
import {
|
|
5
|
+
globalApis
|
|
6
|
+
} from "./chunk-XUIDSY4V.js";
|
|
7
|
+
import "./chunk-ANPMHBIF.js";
|
|
8
|
+
import "./chunk-APGELTDH.js";
|
|
9
|
+
import {
|
|
10
|
+
init_esm_shims
|
|
11
|
+
} from "./chunk-R2SMNEBL.js";
|
|
12
|
+
|
|
13
|
+
// src/integrations/global.ts
|
|
14
|
+
init_esm_shims();
|
|
15
|
+
function registerApiGlobally() {
|
|
16
|
+
globalApis.forEach((api) => {
|
|
17
|
+
globalThis[api] = src_exports[api];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
registerApiGlobally
|
|
22
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { R as ResolvedConfig, F as File, T as TaskResultPack, S as SnapshotResult, a as TestFactory, b as SuiteCollector, c as TestFunction, d as SuiteHooks, U as UserOptions } from './options-
|
|
2
|
-
export { C as CliOptions, g as ComputeMode, F as File, G as GlobalContext, H as HookListener, n as Reporter, R as ResolvedConfig, e as RunMode, o as SnapshotData, r as SnapshotMatchOptions, S as SnapshotResult, q as SnapshotStateOptions, t as SnapshotSummary, p as SnapshotUpdateState, j as Suite, b as SuiteCollector, d as SuiteHooks, l as Task, h as TaskBase, i as TaskResult, T as TaskResultPack, f as TaskState, k as Test, m as TestCollector, a as TestFactory, c as TestFunction, s as UncheckedSnapshot, U as UserOptions } from './options-
|
|
1
|
+
import { R as ResolvedConfig, F as File, T as TaskResultPack, S as SnapshotResult, a as TestFactory, b as SuiteCollector, c as TestFunction, d as SuiteHooks, U as UserOptions } from './options-63a726fa';
|
|
2
|
+
export { u as Arrayable, A as Awaitable, C as CliOptions, g as ComputeMode, v as Environment, E as EnvironmentReturn, F as File, G as GlobalContext, H as HookListener, M as ModuleCache, N as Nullable, n as Reporter, R as ResolvedConfig, e as RunMode, o as SnapshotData, r as SnapshotMatchOptions, S as SnapshotResult, q as SnapshotStateOptions, t as SnapshotSummary, p as SnapshotUpdateState, j as Suite, b as SuiteCollector, d as SuiteHooks, l as Task, h as TaskBase, i as TaskResult, T as TaskResultPack, f as TaskState, k as Test, m as TestCollector, a as TestFactory, c as TestFunction, s as UncheckedSnapshot, U as UserOptions, V as VitestContext } from './options-63a726fa';
|
|
3
3
|
import { MessagePort } from 'worker_threads';
|
|
4
4
|
import { TransformResult } from 'vite';
|
|
5
|
-
export { a as Environment, E as EnvironmentReturn, M as ModuleCache, V as VitestContext } from './general-39d52683';
|
|
6
5
|
export { assert, default as chai, expect, should } from 'chai';
|
|
7
6
|
import sinon from 'sinon';
|
|
8
7
|
export { default as sinon } from 'sinon';
|
|
9
|
-
import '@antfu/utils';
|
|
10
8
|
import 'pretty-format';
|
|
11
9
|
|
|
12
10
|
interface WorkerContext {
|
|
@@ -124,10 +122,10 @@ declare const it: {
|
|
|
124
122
|
concurrent(name: string): void;
|
|
125
123
|
};
|
|
126
124
|
};
|
|
127
|
-
declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number) => void;
|
|
128
|
-
declare const afterAll: (fn: SuiteHooks['afterAll'][0], timeout?: number) => void;
|
|
129
|
-
declare const beforeEach: (fn: SuiteHooks['beforeEach'][0], timeout?: number) => void;
|
|
130
|
-
declare const afterEach: (fn: SuiteHooks['afterEach'][0], timeout?: number) => void;
|
|
125
|
+
declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number | undefined) => void;
|
|
126
|
+
declare const afterAll: (fn: SuiteHooks['afterAll'][0], timeout?: number | undefined) => void;
|
|
127
|
+
declare const beforeEach: (fn: SuiteHooks['beforeEach'][0], timeout?: number | undefined) => void;
|
|
128
|
+
declare const afterEach: (fn: SuiteHooks['afterEach'][0], timeout?: number | undefined) => void;
|
|
131
129
|
declare function clearContext(): void;
|
|
132
130
|
|
|
133
131
|
declare const mock: sinon.SinonMockStatic;
|