@noma.to/qwik-mock 1.1.0 → 1.1.2

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.
Files changed (51) hide show
  1. package/lib/lib/qwik-mock.cjs +3 -3
  2. package/lib/lib/qwik-mock.mjs +1 -1
  3. package/package.json +7 -6
  4. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -83
  5. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -83
  6. package/lib/node_modules/.pnpm/@vitest_expect@4.0.18/node_modules/@vitest/expect/dist/index.cjs +0 -1785
  7. package/lib/node_modules/.pnpm/@vitest_expect@4.0.18/node_modules/@vitest/expect/dist/index.mjs +0 -1785
  8. package/lib/node_modules/.pnpm/@vitest_pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.cjs +0 -964
  9. package/lib/node_modules/.pnpm/@vitest_pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.mjs +0 -964
  10. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/chunk-tasks.cjs +0 -60
  11. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/chunk-tasks.mjs +0 -60
  12. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/index.cjs +0 -1102
  13. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/index.mjs +0 -1102
  14. package/lib/node_modules/.pnpm/@vitest_snapshot@4.0.18/node_modules/@vitest/snapshot/dist/index.cjs +0 -1289
  15. package/lib/node_modules/.pnpm/@vitest_snapshot@4.0.18/node_modules/@vitest/snapshot/dist/index.mjs +0 -1289
  16. package/lib/node_modules/.pnpm/@vitest_spy@4.0.18/node_modules/@vitest/spy/dist/index.cjs +0 -422
  17. package/lib/node_modules/.pnpm/@vitest_spy@4.0.18/node_modules/@vitest/spy/dist/index.mjs +0 -422
  18. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs +0 -6
  19. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs +0 -6
  20. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.cjs +0 -98
  21. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +0 -98
  22. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/diff.cjs +0 -1626
  23. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/diff.mjs +0 -1626
  24. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/display.cjs +0 -690
  25. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/display.mjs +0 -690
  26. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/error.cjs +0 -39
  27. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/error.mjs +0 -39
  28. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/helpers.cjs +0 -151
  29. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/helpers.mjs +0 -151
  30. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/serialize.cjs +0 -114
  31. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/serialize.mjs +0 -114
  32. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/source-map.cjs +0 -125
  33. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/source-map.mjs +0 -125
  34. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.cjs +0 -22
  35. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.mjs +0 -22
  36. package/lib/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.cjs +0 -4056
  37. package/lib/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs +0 -4056
  38. package/lib/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -994
  39. package/lib/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -994
  40. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +0 -101
  41. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -101
  42. package/lib/node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.cjs +0 -84
  43. package/lib/node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.mjs +0 -84
  44. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.cjs +0 -4
  45. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +0 -4
  46. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.cjs +0 -51
  47. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.mjs +0 -51
  48. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/utils.DvEY5TfP.cjs +0 -45
  49. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/utils.DvEY5TfP.mjs +0 -45
  50. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/vi.2VT5v0um.cjs +0 -2609
  51. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/vi.2VT5v0um.mjs +0 -2609
@@ -1,422 +0,0 @@
1
- function isMockFunction(fn2) {
2
- return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction === true;
3
- }
4
- const MOCK_RESTORE = /* @__PURE__ */ new Set();
5
- const REGISTERED_MOCKS = /* @__PURE__ */ new Set();
6
- const MOCK_CONFIGS = /* @__PURE__ */ new WeakMap();
7
- function createMockInstance(options = {}) {
8
- var _ref;
9
- const { originalImplementation, restore, mockImplementation, resetToMockImplementation, resetToMockName } = options;
10
- if (restore) {
11
- MOCK_RESTORE.add(restore);
12
- }
13
- const config = getDefaultConfig(originalImplementation);
14
- const state = getDefaultState();
15
- const mock = createMock({
16
- config,
17
- state,
18
- ...options
19
- });
20
- const mockLength = ((_ref = mockImplementation || originalImplementation) === null || _ref === void 0 ? void 0 : _ref.length) ?? 0;
21
- Object.defineProperty(mock, "length", {
22
- writable: true,
23
- enumerable: false,
24
- value: mockLength,
25
- configurable: true
26
- });
27
- if (resetToMockName) {
28
- config.mockName = mock.name || "vi.fn()";
29
- }
30
- MOCK_CONFIGS.set(mock, config);
31
- REGISTERED_MOCKS.add(mock);
32
- mock._isMockFunction = true;
33
- mock.getMockImplementation = () => {
34
- return config.onceMockImplementations[0] || config.mockImplementation;
35
- };
36
- Object.defineProperty(mock, "mock", {
37
- configurable: false,
38
- enumerable: true,
39
- writable: false,
40
- value: state
41
- });
42
- mock.mockImplementation = function mockImplementation2(implementation) {
43
- config.mockImplementation = implementation;
44
- return mock;
45
- };
46
- mock.mockImplementationOnce = function mockImplementationOnce(implementation) {
47
- config.onceMockImplementations.push(implementation);
48
- return mock;
49
- };
50
- mock.withImplementation = function withImplementation(implementation, callback) {
51
- const previousImplementation = config.mockImplementation;
52
- const previousOnceImplementations = config.onceMockImplementations;
53
- const reset = () => {
54
- config.mockImplementation = previousImplementation;
55
- config.onceMockImplementations = previousOnceImplementations;
56
- };
57
- config.mockImplementation = implementation;
58
- config.onceMockImplementations = [];
59
- const returnValue = callback();
60
- if (typeof returnValue === "object" && typeof (returnValue === null || returnValue === void 0 ? void 0 : returnValue.then) === "function") {
61
- return returnValue.then(() => {
62
- reset();
63
- return mock;
64
- });
65
- } else {
66
- reset();
67
- }
68
- return mock;
69
- };
70
- mock.mockReturnThis = function mockReturnThis() {
71
- return mock.mockImplementation(function() {
72
- return this;
73
- });
74
- };
75
- mock.mockReturnValue = function mockReturnValue(value) {
76
- return mock.mockImplementation(() => value);
77
- };
78
- mock.mockReturnValueOnce = function mockReturnValueOnce(value) {
79
- return mock.mockImplementationOnce(() => value);
80
- };
81
- mock.mockResolvedValue = function mockResolvedValue(value) {
82
- return mock.mockImplementation(() => Promise.resolve(value));
83
- };
84
- mock.mockResolvedValueOnce = function mockResolvedValueOnce(value) {
85
- return mock.mockImplementationOnce(() => Promise.resolve(value));
86
- };
87
- mock.mockRejectedValue = function mockRejectedValue(value) {
88
- return mock.mockImplementation(() => Promise.reject(value));
89
- };
90
- mock.mockRejectedValueOnce = function mockRejectedValueOnce(value) {
91
- return mock.mockImplementationOnce(() => Promise.reject(value));
92
- };
93
- mock.mockClear = function mockClear() {
94
- state.calls = [];
95
- state.contexts = [];
96
- state.instances = [];
97
- state.invocationCallOrder = [];
98
- state.results = [];
99
- state.settledResults = [];
100
- return mock;
101
- };
102
- mock.mockReset = function mockReset() {
103
- mock.mockClear();
104
- config.mockImplementation = resetToMockImplementation ? mockImplementation : void 0;
105
- config.mockName = resetToMockName ? mock.name || "vi.fn()" : "vi.fn()";
106
- config.onceMockImplementations = [];
107
- return mock;
108
- };
109
- mock.mockRestore = function mockRestore() {
110
- mock.mockReset();
111
- return restore === null || restore === void 0 ? void 0 : restore();
112
- };
113
- mock.mockName = function mockName(name) {
114
- if (typeof name === "string") {
115
- config.mockName = name;
116
- }
117
- return mock;
118
- };
119
- mock.getMockName = function getMockName() {
120
- return config.mockName || "vi.fn()";
121
- };
122
- if (Symbol.dispose) {
123
- mock[Symbol.dispose] = () => mock.mockRestore();
124
- }
125
- if (mockImplementation) {
126
- mock.mockImplementation(mockImplementation);
127
- }
128
- return mock;
129
- }
130
- function fn(originalImplementation) {
131
- if (originalImplementation != null && isMockFunction(originalImplementation)) {
132
- return originalImplementation;
133
- }
134
- return createMockInstance({
135
- mockImplementation: originalImplementation,
136
- resetToMockImplementation: true
137
- });
138
- }
139
- function spyOn(object, key, accessor) {
140
- assert(object != null, "The vi.spyOn() function could not find an object to spy upon. The first argument must be defined.");
141
- assert(typeof object === "object" || typeof object === "function", "Vitest cannot spy on a primitive value.");
142
- const [originalDescriptorObject, originalDescriptor] = getDescriptor(object, key) || [];
143
- assert(originalDescriptor || key in object, `The property "${String(key)}" is not defined on the ${typeof object}.`);
144
- let accessType = accessor || "value";
145
- let ssr = false;
146
- if (accessType === "value" && originalDescriptor && originalDescriptor.value == null && originalDescriptor.get) {
147
- accessType = "get";
148
- ssr = true;
149
- }
150
- let original;
151
- if (originalDescriptor) {
152
- original = originalDescriptor[accessType];
153
- } else if (accessType !== "value") {
154
- original = () => object[key];
155
- } else {
156
- original = object[key];
157
- }
158
- const originalImplementation = ssr && original ? original() : original;
159
- const originalType = typeof originalImplementation;
160
- assert(
161
- // allow only functions
162
- originalType === "function" || accessType !== "value" && original == null,
163
- `vi.spyOn() can only spy on a function. Received ${originalType}.`
164
- );
165
- if (isMockFunction(originalImplementation)) {
166
- return originalImplementation;
167
- }
168
- const reassign = (cb) => {
169
- const { value, ...desc } = originalDescriptor || {
170
- configurable: true,
171
- writable: true
172
- };
173
- if (accessType !== "value") {
174
- delete desc.writable;
175
- }
176
- desc[accessType] = cb;
177
- Object.defineProperty(object, key, desc);
178
- };
179
- const restore = () => {
180
- if (originalDescriptorObject !== object) {
181
- Reflect.deleteProperty(object, key);
182
- } else if (originalDescriptor && !original) {
183
- Object.defineProperty(object, key, originalDescriptor);
184
- } else {
185
- reassign(original);
186
- }
187
- };
188
- const mock = createMockInstance({
189
- restore,
190
- originalImplementation,
191
- resetToMockName: true
192
- });
193
- try {
194
- reassign(ssr ? () => mock : mock);
195
- } catch (error) {
196
- if (error instanceof TypeError && Symbol.toStringTag && object[Symbol.toStringTag] === "Module" && (error.message.includes("Cannot redefine property") || error.message.includes("Cannot replace module namespace") || error.message.includes("can't redefine non-configurable property"))) {
197
- throw new TypeError(`Cannot spy on export "${String(key)}". Module namespace is not configurable in ESM. See: https://vitest.dev/guide/browser/#limitations`, { cause: error });
198
- }
199
- throw error;
200
- }
201
- return mock;
202
- }
203
- function getDescriptor(obj, method) {
204
- const objDescriptor = Object.getOwnPropertyDescriptor(obj, method);
205
- if (objDescriptor) {
206
- return [obj, objDescriptor];
207
- }
208
- let currentProto = Object.getPrototypeOf(obj);
209
- while (currentProto !== null) {
210
- const descriptor = Object.getOwnPropertyDescriptor(currentProto, method);
211
- if (descriptor) {
212
- return [currentProto, descriptor];
213
- }
214
- currentProto = Object.getPrototypeOf(currentProto);
215
- }
216
- }
217
- function assert(condition, message) {
218
- if (!condition) {
219
- throw new Error(message);
220
- }
221
- }
222
- let invocationCallCounter = 1;
223
- function createMock({ state, config, name: mockName, prototypeState, prototypeConfig, keepMembersImplementation, mockImplementation, prototypeMembers = [] }) {
224
- const original = config.mockOriginal;
225
- const pseudoOriginal = mockImplementation;
226
- const name = mockName || (original === null || original === void 0 ? void 0 : original.name) || "Mock";
227
- const namedObject = { [name]: (function(...args) {
228
- registerCalls(args, state, prototypeState);
229
- registerInvocationOrder(invocationCallCounter++, state, prototypeState);
230
- const result = {
231
- type: "incomplete",
232
- value: void 0
233
- };
234
- const settledResult = {
235
- type: "incomplete",
236
- value: void 0
237
- };
238
- registerResult(result, state, prototypeState);
239
- registerSettledResult(settledResult, state, prototypeState);
240
- const context = new.target ? void 0 : this;
241
- const [instanceIndex, instancePrototypeIndex] = registerInstance(context, state, prototypeState);
242
- const [contextIndex, contextPrototypeIndex] = registerContext(context, state, prototypeState);
243
- const implementation = config.onceMockImplementations.shift() || config.mockImplementation || (prototypeConfig === null || prototypeConfig === void 0 ? void 0 : prototypeConfig.onceMockImplementations.shift()) || (prototypeConfig === null || prototypeConfig === void 0 ? void 0 : prototypeConfig.mockImplementation) || original || function() {
244
- };
245
- let returnValue;
246
- let thrownValue;
247
- let didThrow = false;
248
- try {
249
- if (new.target) {
250
- returnValue = Reflect.construct(implementation, args, new.target);
251
- for (const prop of prototypeMembers) {
252
- const prototypeMock = returnValue[prop];
253
- if (prototypeMock !== mock.prototype[prop]) {
254
- continue;
255
- }
256
- const isMock = isMockFunction(prototypeMock);
257
- const prototypeState2 = isMock ? prototypeMock.mock : void 0;
258
- const prototypeConfig2 = isMock ? MOCK_CONFIGS.get(prototypeMock) : void 0;
259
- returnValue[prop] = createMockInstance({
260
- originalImplementation: keepMembersImplementation ? prototypeConfig2 === null || prototypeConfig2 === void 0 ? void 0 : prototypeConfig2.mockOriginal : void 0,
261
- prototypeState: prototypeState2,
262
- prototypeConfig: prototypeConfig2,
263
- keepMembersImplementation
264
- });
265
- }
266
- } else {
267
- returnValue = implementation.apply(this, args);
268
- }
269
- } catch (error) {
270
- thrownValue = error;
271
- didThrow = true;
272
- if (error instanceof TypeError && error.message.includes("is not a constructor")) {
273
- console.warn(`[vitest] The ${namedObject[name].getMockName()} mock did not use 'function' or 'class' in its implementation, see https://vitest.dev/api/vi#vi-spyon for examples.`);
274
- }
275
- throw error;
276
- } finally {
277
- if (didThrow) {
278
- result.type = "throw";
279
- result.value = thrownValue;
280
- settledResult.type = "rejected";
281
- settledResult.value = thrownValue;
282
- } else {
283
- result.type = "return";
284
- result.value = returnValue;
285
- if (new.target) {
286
- state.contexts[contextIndex - 1] = returnValue;
287
- state.instances[instanceIndex - 1] = returnValue;
288
- if (contextPrototypeIndex != null && prototypeState) {
289
- prototypeState.contexts[contextPrototypeIndex - 1] = returnValue;
290
- }
291
- if (instancePrototypeIndex != null && prototypeState) {
292
- prototypeState.instances[instancePrototypeIndex - 1] = returnValue;
293
- }
294
- }
295
- if (returnValue instanceof Promise) {
296
- returnValue.then((settledValue) => {
297
- settledResult.type = "fulfilled";
298
- settledResult.value = settledValue;
299
- }, (rejectedValue) => {
300
- settledResult.type = "rejected";
301
- settledResult.value = rejectedValue;
302
- });
303
- } else {
304
- settledResult.type = "fulfilled";
305
- settledResult.value = returnValue;
306
- }
307
- }
308
- }
309
- return returnValue;
310
- }) };
311
- const mock = namedObject[name];
312
- const copyPropertiesFrom = original || pseudoOriginal;
313
- if (copyPropertiesFrom) {
314
- copyOriginalStaticProperties(mock, copyPropertiesFrom);
315
- }
316
- return mock;
317
- }
318
- function registerCalls(args, state, prototypeState) {
319
- state.calls.push(args);
320
- prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.calls.push(args);
321
- }
322
- function registerInvocationOrder(order, state, prototypeState) {
323
- state.invocationCallOrder.push(order);
324
- prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.invocationCallOrder.push(order);
325
- }
326
- function registerResult(result, state, prototypeState) {
327
- state.results.push(result);
328
- prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.results.push(result);
329
- }
330
- function registerSettledResult(result, state, prototypeState) {
331
- state.settledResults.push(result);
332
- prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.settledResults.push(result);
333
- }
334
- function registerInstance(instance, state, prototypeState) {
335
- const instanceIndex = state.instances.push(instance);
336
- const instancePrototypeIndex = prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.instances.push(instance);
337
- return [instanceIndex, instancePrototypeIndex];
338
- }
339
- function registerContext(context, state, prototypeState) {
340
- const contextIndex = state.contexts.push(context);
341
- const contextPrototypeIndex = prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.contexts.push(context);
342
- return [contextIndex, contextPrototypeIndex];
343
- }
344
- function copyOriginalStaticProperties(mock, original) {
345
- const { properties, descriptors } = getAllProperties(original);
346
- for (const key of properties) {
347
- const descriptor = descriptors[key];
348
- const mockDescriptor = getDescriptor(mock, key);
349
- if (mockDescriptor) {
350
- continue;
351
- }
352
- Object.defineProperty(mock, key, descriptor);
353
- }
354
- }
355
- const ignoreProperties = /* @__PURE__ */ new Set([
356
- "length",
357
- "name",
358
- "prototype",
359
- /* @__PURE__ */ Symbol.for("nodejs.util.promisify.custom")
360
- ]);
361
- function getAllProperties(original) {
362
- const properties = /* @__PURE__ */ new Set();
363
- const descriptors = {};
364
- while (original && original !== Object.prototype && original !== Function.prototype) {
365
- const ownProperties = [...Object.getOwnPropertyNames(original), ...Object.getOwnPropertySymbols(original)];
366
- for (const prop of ownProperties) {
367
- if (descriptors[prop] || ignoreProperties.has(prop)) {
368
- continue;
369
- }
370
- properties.add(prop);
371
- descriptors[prop] = Object.getOwnPropertyDescriptor(original, prop);
372
- }
373
- original = Object.getPrototypeOf(original);
374
- }
375
- return {
376
- properties,
377
- descriptors
378
- };
379
- }
380
- function getDefaultConfig(original) {
381
- return {
382
- mockImplementation: void 0,
383
- mockOriginal: original,
384
- mockName: "vi.fn()",
385
- onceMockImplementations: []
386
- };
387
- }
388
- function getDefaultState() {
389
- const state = {
390
- calls: [],
391
- contexts: [],
392
- instances: [],
393
- invocationCallOrder: [],
394
- settledResults: [],
395
- results: [],
396
- get lastCall() {
397
- return state.calls.at(-1);
398
- }
399
- };
400
- return state;
401
- }
402
- function restoreAllMocks() {
403
- for (const restore of MOCK_RESTORE) {
404
- restore();
405
- }
406
- MOCK_RESTORE.clear();
407
- }
408
- function clearAllMocks() {
409
- REGISTERED_MOCKS.forEach((mock) => mock.mockClear());
410
- }
411
- function resetAllMocks() {
412
- REGISTERED_MOCKS.forEach((mock) => mock.mockReset());
413
- }
414
- export {
415
- clearAllMocks,
416
- createMockInstance,
417
- fn,
418
- isMockFunction,
419
- resetAllMocks,
420
- restoreAllMocks,
421
- spyOn
422
- };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function getDefaultExportFromCjs(x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
- }
6
- exports.g = getDefaultExportFromCjs;
@@ -1,6 +0,0 @@
1
- function getDefaultExportFromCjs(x) {
2
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
3
- }
4
- export {
5
- getDefaultExportFromCjs as g
6
- };
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
4
- function normalizeWindowsPath(input = "") {
5
- if (!input) {
6
- return input;
7
- }
8
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
9
- }
10
- const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
11
- function cwd() {
12
- if (typeof process !== "undefined" && typeof process.cwd === "function") {
13
- return process.cwd().replace(/\\/g, "/");
14
- }
15
- return "/";
16
- }
17
- const resolve = function(...arguments_) {
18
- arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
19
- let resolvedPath = "";
20
- let resolvedAbsolute = false;
21
- for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
22
- const path = index >= 0 ? arguments_[index] : cwd();
23
- if (!path || path.length === 0) {
24
- continue;
25
- }
26
- resolvedPath = `${path}/${resolvedPath}`;
27
- resolvedAbsolute = isAbsolute(path);
28
- }
29
- resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
30
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
31
- return `/${resolvedPath}`;
32
- }
33
- return resolvedPath.length > 0 ? resolvedPath : ".";
34
- };
35
- function normalizeString(path, allowAboveRoot) {
36
- let res = "";
37
- let lastSegmentLength = 0;
38
- let lastSlash = -1;
39
- let dots = 0;
40
- let char = null;
41
- for (let index = 0; index <= path.length; ++index) {
42
- if (index < path.length) {
43
- char = path[index];
44
- } else if (char === "/") {
45
- break;
46
- } else {
47
- char = "/";
48
- }
49
- if (char === "/") {
50
- if (lastSlash === index - 1 || dots === 1) ;
51
- else if (dots === 2) {
52
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
53
- if (res.length > 2) {
54
- const lastSlashIndex = res.lastIndexOf("/");
55
- if (lastSlashIndex === -1) {
56
- res = "";
57
- lastSegmentLength = 0;
58
- } else {
59
- res = res.slice(0, lastSlashIndex);
60
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
61
- }
62
- lastSlash = index;
63
- dots = 0;
64
- continue;
65
- } else if (res.length > 0) {
66
- res = "";
67
- lastSegmentLength = 0;
68
- lastSlash = index;
69
- dots = 0;
70
- continue;
71
- }
72
- }
73
- if (allowAboveRoot) {
74
- res += res.length > 0 ? "/.." : "..";
75
- lastSegmentLength = 2;
76
- }
77
- } else {
78
- if (res.length > 0) {
79
- res += `/${path.slice(lastSlash + 1, index)}`;
80
- } else {
81
- res = path.slice(lastSlash + 1, index);
82
- }
83
- lastSegmentLength = index - lastSlash - 1;
84
- }
85
- lastSlash = index;
86
- dots = 0;
87
- } else if (char === "." && dots !== -1) {
88
- ++dots;
89
- } else {
90
- dots = -1;
91
- }
92
- }
93
- return res;
94
- }
95
- const isAbsolute = function(p) {
96
- return _IS_ABSOLUTE_RE.test(p);
97
- };
98
- exports.r = resolve;
@@ -1,98 +0,0 @@
1
- const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
2
- function normalizeWindowsPath(input = "") {
3
- if (!input) {
4
- return input;
5
- }
6
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
7
- }
8
- const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
9
- function cwd() {
10
- if (typeof process !== "undefined" && typeof process.cwd === "function") {
11
- return process.cwd().replace(/\\/g, "/");
12
- }
13
- return "/";
14
- }
15
- const resolve = function(...arguments_) {
16
- arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
17
- let resolvedPath = "";
18
- let resolvedAbsolute = false;
19
- for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
20
- const path = index >= 0 ? arguments_[index] : cwd();
21
- if (!path || path.length === 0) {
22
- continue;
23
- }
24
- resolvedPath = `${path}/${resolvedPath}`;
25
- resolvedAbsolute = isAbsolute(path);
26
- }
27
- resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
28
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
29
- return `/${resolvedPath}`;
30
- }
31
- return resolvedPath.length > 0 ? resolvedPath : ".";
32
- };
33
- function normalizeString(path, allowAboveRoot) {
34
- let res = "";
35
- let lastSegmentLength = 0;
36
- let lastSlash = -1;
37
- let dots = 0;
38
- let char = null;
39
- for (let index = 0; index <= path.length; ++index) {
40
- if (index < path.length) {
41
- char = path[index];
42
- } else if (char === "/") {
43
- break;
44
- } else {
45
- char = "/";
46
- }
47
- if (char === "/") {
48
- if (lastSlash === index - 1 || dots === 1) ;
49
- else if (dots === 2) {
50
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
51
- if (res.length > 2) {
52
- const lastSlashIndex = res.lastIndexOf("/");
53
- if (lastSlashIndex === -1) {
54
- res = "";
55
- lastSegmentLength = 0;
56
- } else {
57
- res = res.slice(0, lastSlashIndex);
58
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
59
- }
60
- lastSlash = index;
61
- dots = 0;
62
- continue;
63
- } else if (res.length > 0) {
64
- res = "";
65
- lastSegmentLength = 0;
66
- lastSlash = index;
67
- dots = 0;
68
- continue;
69
- }
70
- }
71
- if (allowAboveRoot) {
72
- res += res.length > 0 ? "/.." : "..";
73
- lastSegmentLength = 2;
74
- }
75
- } else {
76
- if (res.length > 0) {
77
- res += `/${path.slice(lastSlash + 1, index)}`;
78
- } else {
79
- res = path.slice(lastSlash + 1, index);
80
- }
81
- lastSegmentLength = index - lastSlash - 1;
82
- }
83
- lastSlash = index;
84
- dots = 0;
85
- } else if (char === "." && dots !== -1) {
86
- ++dots;
87
- } else {
88
- dots = -1;
89
- }
90
- }
91
- return res;
92
- }
93
- const isAbsolute = function(p) {
94
- return _IS_ABSOLUTE_RE.test(p);
95
- };
96
- export {
97
- resolve as r
98
- };