@noma.to/qwik-testing-library 1.3.0 → 1.3.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.
- package/README.md +12 -2
- package/lib/index.qwik.cjs +0 -4
- package/lib/index.qwik.mjs +0 -4
- package/lib/lib/qwik-testing-library.qwik.cjs +1 -5
- package/lib/lib/qwik-testing-library.qwik.mjs +2 -6
- package/lib/lib/qwikloader.qwik.cjs +1 -1
- package/lib/lib/qwikloader.qwik.mjs +1 -1
- package/lib-types/lib/qwik-testing-library.d.ts +1 -2
- package/package.json +9 -9
- package/lib/lib/mock.qwik.cjs +0 -14
- package/lib/lib/mock.qwik.mjs +0 -14
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.cjs +0 -89
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.mjs +0 -89
- package/lib/node_modules/.pnpm/@vitest_expect@2.1.8/node_modules/@vitest/expect/dist/index.qwik.cjs +0 -2051
- package/lib/node_modules/.pnpm/@vitest_expect@2.1.8/node_modules/@vitest/expect/dist/index.qwik.mjs +0 -2051
- package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +0 -1208
- package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +0 -1208
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.8/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +0 -44
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.8/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +0 -44
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.8/node_modules/@vitest/runner/dist/index.qwik.cjs +0 -671
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.8/node_modules/@vitest/runner/dist/index.qwik.mjs +0 -671
- package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.8/node_modules/@vitest/snapshot/dist/index.qwik.cjs +0 -2044
- package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.8/node_modules/@vitest/snapshot/dist/index.qwik.mjs +0 -2044
- package/lib/node_modules/.pnpm/@vitest_spy@2.1.8/node_modules/@vitest/spy/dist/index.qwik.cjs +0 -148
- package/lib/node_modules/.pnpm/@vitest_spy@2.1.8/node_modules/@vitest/spy/dist/index.qwik.mjs +0 -148
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs +0 -162
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs +0 -162
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/diff.qwik.cjs +0 -1739
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/diff.qwik.mjs +0 -1739
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/error.qwik.cjs +0 -137
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/error.qwik.mjs +0 -137
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/helpers.qwik.cjs +0 -150
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/helpers.qwik.mjs +0 -150
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/index.qwik.cjs +0 -472
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/index.qwik.mjs +0 -472
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/source-map.qwik.cjs +0 -216
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/source-map.qwik.mjs +0 -216
- package/lib/node_modules/.pnpm/chai@5.1.2/node_modules/chai/chai.qwik.cjs +0 -3937
- package/lib/node_modules/.pnpm/chai@5.1.2/node_modules/chai/chai.qwik.mjs +0 -3937
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/arguments.qwik.cjs +0 -9
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/arguments.qwik.mjs +0 -10
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/array.qwik.cjs +0 -16
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/array.qwik.mjs +0 -17
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/bigint.qwik.cjs +0 -9
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/bigint.qwik.mjs +0 -10
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/class.qwik.cjs +0 -16
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/class.qwik.mjs +0 -17
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/date.qwik.cjs +0 -12
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/date.qwik.mjs +0 -13
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/error.qwik.cjs +0 -36
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/error.qwik.mjs +0 -37
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/function.qwik.cjs +0 -11
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/function.qwik.mjs +0 -12
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/helpers.qwik.cjs +0 -160
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/helpers.qwik.mjs +0 -160
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/html.qwik.cjs +0 -36
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/html.qwik.mjs +0 -36
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/index.qwik.cjs +0 -130
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/index.qwik.mjs +0 -130
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/map.qwik.cjs +0 -25
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/map.qwik.mjs +0 -26
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/number.qwik.cjs +0 -19
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/number.qwik.mjs +0 -20
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/object.qwik.cjs +0 -24
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/object.qwik.mjs +0 -25
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/promise.qwik.cjs +0 -17
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/promise.qwik.mjs +0 -18
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/regexp.qwik.cjs +0 -9
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/regexp.qwik.mjs +0 -10
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/set.qwik.cjs +0 -16
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/set.qwik.mjs +0 -17
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/string.qwik.cjs +0 -23
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/string.qwik.mjs +0 -24
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/symbol.qwik.cjs +0 -8
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/symbol.qwik.mjs +0 -9
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/typedarray.qwik.cjs +0 -34
- package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/typedarray.qwik.mjs +0 -35
- package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.cjs +0 -979
- package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.mjs +0 -979
- package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs +0 -101
- package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs +0 -101
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +0 -7
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +0 -8
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +0 -80
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +0 -80
- package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs +0 -104
- package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs +0 -104
- package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +0 -8
- package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +0 -8
- package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +0 -56
- package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +0 -56
- package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +0 -66
- package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +0 -66
- package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.cjs +0 -2749
- package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.mjs +0 -2749
- package/lib-types/lib/mock.d.ts +0 -34
package/lib/node_modules/.pnpm/@vitest_spy@2.1.8/node_modules/@vitest/spy/dist/index.qwik.cjs
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("../../../../../tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs");
|
|
4
|
-
const mocks = /* @__PURE__ */ new Set();
|
|
5
|
-
function isMockFunction(fn2) {
|
|
6
|
-
return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
|
|
7
|
-
}
|
|
8
|
-
function spyOn(obj, method, accessType) {
|
|
9
|
-
const dictionary = {
|
|
10
|
-
get: "getter",
|
|
11
|
-
set: "setter"
|
|
12
|
-
};
|
|
13
|
-
const objMethod = accessType ? { [dictionary[accessType]]: method } : method;
|
|
14
|
-
const stub = index.internalSpyOn(obj, objMethod);
|
|
15
|
-
return enhanceSpy(stub);
|
|
16
|
-
}
|
|
17
|
-
let callOrder = 0;
|
|
18
|
-
function enhanceSpy(spy) {
|
|
19
|
-
const stub = spy;
|
|
20
|
-
let implementation;
|
|
21
|
-
let instances = [];
|
|
22
|
-
let contexts = [];
|
|
23
|
-
let invocations = [];
|
|
24
|
-
const state = index.getInternalState(spy);
|
|
25
|
-
const mockContext = {
|
|
26
|
-
get calls() {
|
|
27
|
-
return state.calls;
|
|
28
|
-
},
|
|
29
|
-
get contexts() {
|
|
30
|
-
return contexts;
|
|
31
|
-
},
|
|
32
|
-
get instances() {
|
|
33
|
-
return instances;
|
|
34
|
-
},
|
|
35
|
-
get invocationCallOrder() {
|
|
36
|
-
return invocations;
|
|
37
|
-
},
|
|
38
|
-
get results() {
|
|
39
|
-
return state.results.map(([callType, value]) => {
|
|
40
|
-
const type = callType === "error" ? "throw" : "return";
|
|
41
|
-
return { type, value };
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
get settledResults() {
|
|
45
|
-
return state.resolves.map(([callType, value]) => {
|
|
46
|
-
const type = callType === "error" ? "rejected" : "fulfilled";
|
|
47
|
-
return { type, value };
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
get lastCall() {
|
|
51
|
-
return state.calls[state.calls.length - 1];
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
let onceImplementations = [];
|
|
55
|
-
let implementationChangedTemporarily = false;
|
|
56
|
-
function mockCall(...args) {
|
|
57
|
-
instances.push(this);
|
|
58
|
-
contexts.push(this);
|
|
59
|
-
invocations.push(++callOrder);
|
|
60
|
-
const impl = implementationChangedTemporarily ? implementation : onceImplementations.shift() || implementation || state.getOriginal() || (() => {
|
|
61
|
-
});
|
|
62
|
-
return impl.apply(this, args);
|
|
63
|
-
}
|
|
64
|
-
let name = stub.name;
|
|
65
|
-
stub.getMockName = () => name || "vi.fn()";
|
|
66
|
-
stub.mockName = (n) => {
|
|
67
|
-
name = n;
|
|
68
|
-
return stub;
|
|
69
|
-
};
|
|
70
|
-
stub.mockClear = () => {
|
|
71
|
-
state.reset();
|
|
72
|
-
instances = [];
|
|
73
|
-
contexts = [];
|
|
74
|
-
invocations = [];
|
|
75
|
-
return stub;
|
|
76
|
-
};
|
|
77
|
-
stub.mockReset = () => {
|
|
78
|
-
stub.mockClear();
|
|
79
|
-
implementation = () => void 0;
|
|
80
|
-
onceImplementations = [];
|
|
81
|
-
return stub;
|
|
82
|
-
};
|
|
83
|
-
stub.mockRestore = () => {
|
|
84
|
-
stub.mockReset();
|
|
85
|
-
state.restore();
|
|
86
|
-
implementation = void 0;
|
|
87
|
-
return stub;
|
|
88
|
-
};
|
|
89
|
-
stub.getMockImplementation = () => implementation;
|
|
90
|
-
stub.mockImplementation = (fn2) => {
|
|
91
|
-
implementation = fn2;
|
|
92
|
-
state.willCall(mockCall);
|
|
93
|
-
return stub;
|
|
94
|
-
};
|
|
95
|
-
stub.mockImplementationOnce = (fn2) => {
|
|
96
|
-
onceImplementations.push(fn2);
|
|
97
|
-
return stub;
|
|
98
|
-
};
|
|
99
|
-
function withImplementation(fn2, cb) {
|
|
100
|
-
const originalImplementation = implementation;
|
|
101
|
-
implementation = fn2;
|
|
102
|
-
state.willCall(mockCall);
|
|
103
|
-
implementationChangedTemporarily = true;
|
|
104
|
-
const reset = () => {
|
|
105
|
-
implementation = originalImplementation;
|
|
106
|
-
implementationChangedTemporarily = false;
|
|
107
|
-
};
|
|
108
|
-
const result = cb();
|
|
109
|
-
if (result instanceof Promise) {
|
|
110
|
-
return result.then(() => {
|
|
111
|
-
reset();
|
|
112
|
-
return stub;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
reset();
|
|
116
|
-
return stub;
|
|
117
|
-
}
|
|
118
|
-
stub.withImplementation = withImplementation;
|
|
119
|
-
stub.mockReturnThis = () => stub.mockImplementation(function() {
|
|
120
|
-
return this;
|
|
121
|
-
});
|
|
122
|
-
stub.mockReturnValue = (val) => stub.mockImplementation(() => val);
|
|
123
|
-
stub.mockReturnValueOnce = (val) => stub.mockImplementationOnce(() => val);
|
|
124
|
-
stub.mockResolvedValue = (val) => stub.mockImplementation(() => Promise.resolve(val));
|
|
125
|
-
stub.mockResolvedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.resolve(val));
|
|
126
|
-
stub.mockRejectedValue = (val) => stub.mockImplementation(() => Promise.reject(val));
|
|
127
|
-
stub.mockRejectedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.reject(val));
|
|
128
|
-
Object.defineProperty(stub, "mock", {
|
|
129
|
-
get: () => mockContext
|
|
130
|
-
});
|
|
131
|
-
state.willCall(mockCall);
|
|
132
|
-
mocks.add(stub);
|
|
133
|
-
return stub;
|
|
134
|
-
}
|
|
135
|
-
function fn(implementation) {
|
|
136
|
-
const enhancedSpy = enhanceSpy(index.internalSpyOn({
|
|
137
|
-
spy: implementation || function() {
|
|
138
|
-
}
|
|
139
|
-
}, "spy"));
|
|
140
|
-
if (implementation) {
|
|
141
|
-
enhancedSpy.mockImplementation(implementation);
|
|
142
|
-
}
|
|
143
|
-
return enhancedSpy;
|
|
144
|
-
}
|
|
145
|
-
exports.fn = fn;
|
|
146
|
-
exports.isMockFunction = isMockFunction;
|
|
147
|
-
exports.mocks = mocks;
|
|
148
|
-
exports.spyOn = spyOn;
|
package/lib/node_modules/.pnpm/@vitest_spy@2.1.8/node_modules/@vitest/spy/dist/index.qwik.mjs
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { internalSpyOn as C, getInternalState as T } from "../../../../../tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs";
|
|
2
|
-
const mocks = /* @__PURE__ */ new Set();
|
|
3
|
-
function isMockFunction(fn2) {
|
|
4
|
-
return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
|
|
5
|
-
}
|
|
6
|
-
function spyOn(obj, method, accessType) {
|
|
7
|
-
const dictionary = {
|
|
8
|
-
get: "getter",
|
|
9
|
-
set: "setter"
|
|
10
|
-
};
|
|
11
|
-
const objMethod = accessType ? { [dictionary[accessType]]: method } : method;
|
|
12
|
-
const stub = C(obj, objMethod);
|
|
13
|
-
return enhanceSpy(stub);
|
|
14
|
-
}
|
|
15
|
-
let callOrder = 0;
|
|
16
|
-
function enhanceSpy(spy) {
|
|
17
|
-
const stub = spy;
|
|
18
|
-
let implementation;
|
|
19
|
-
let instances = [];
|
|
20
|
-
let contexts = [];
|
|
21
|
-
let invocations = [];
|
|
22
|
-
const state = T(spy);
|
|
23
|
-
const mockContext = {
|
|
24
|
-
get calls() {
|
|
25
|
-
return state.calls;
|
|
26
|
-
},
|
|
27
|
-
get contexts() {
|
|
28
|
-
return contexts;
|
|
29
|
-
},
|
|
30
|
-
get instances() {
|
|
31
|
-
return instances;
|
|
32
|
-
},
|
|
33
|
-
get invocationCallOrder() {
|
|
34
|
-
return invocations;
|
|
35
|
-
},
|
|
36
|
-
get results() {
|
|
37
|
-
return state.results.map(([callType, value]) => {
|
|
38
|
-
const type = callType === "error" ? "throw" : "return";
|
|
39
|
-
return { type, value };
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
get settledResults() {
|
|
43
|
-
return state.resolves.map(([callType, value]) => {
|
|
44
|
-
const type = callType === "error" ? "rejected" : "fulfilled";
|
|
45
|
-
return { type, value };
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
get lastCall() {
|
|
49
|
-
return state.calls[state.calls.length - 1];
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
let onceImplementations = [];
|
|
53
|
-
let implementationChangedTemporarily = false;
|
|
54
|
-
function mockCall(...args) {
|
|
55
|
-
instances.push(this);
|
|
56
|
-
contexts.push(this);
|
|
57
|
-
invocations.push(++callOrder);
|
|
58
|
-
const impl = implementationChangedTemporarily ? implementation : onceImplementations.shift() || implementation || state.getOriginal() || (() => {
|
|
59
|
-
});
|
|
60
|
-
return impl.apply(this, args);
|
|
61
|
-
}
|
|
62
|
-
let name = stub.name;
|
|
63
|
-
stub.getMockName = () => name || "vi.fn()";
|
|
64
|
-
stub.mockName = (n) => {
|
|
65
|
-
name = n;
|
|
66
|
-
return stub;
|
|
67
|
-
};
|
|
68
|
-
stub.mockClear = () => {
|
|
69
|
-
state.reset();
|
|
70
|
-
instances = [];
|
|
71
|
-
contexts = [];
|
|
72
|
-
invocations = [];
|
|
73
|
-
return stub;
|
|
74
|
-
};
|
|
75
|
-
stub.mockReset = () => {
|
|
76
|
-
stub.mockClear();
|
|
77
|
-
implementation = () => void 0;
|
|
78
|
-
onceImplementations = [];
|
|
79
|
-
return stub;
|
|
80
|
-
};
|
|
81
|
-
stub.mockRestore = () => {
|
|
82
|
-
stub.mockReset();
|
|
83
|
-
state.restore();
|
|
84
|
-
implementation = void 0;
|
|
85
|
-
return stub;
|
|
86
|
-
};
|
|
87
|
-
stub.getMockImplementation = () => implementation;
|
|
88
|
-
stub.mockImplementation = (fn2) => {
|
|
89
|
-
implementation = fn2;
|
|
90
|
-
state.willCall(mockCall);
|
|
91
|
-
return stub;
|
|
92
|
-
};
|
|
93
|
-
stub.mockImplementationOnce = (fn2) => {
|
|
94
|
-
onceImplementations.push(fn2);
|
|
95
|
-
return stub;
|
|
96
|
-
};
|
|
97
|
-
function withImplementation(fn2, cb) {
|
|
98
|
-
const originalImplementation = implementation;
|
|
99
|
-
implementation = fn2;
|
|
100
|
-
state.willCall(mockCall);
|
|
101
|
-
implementationChangedTemporarily = true;
|
|
102
|
-
const reset = () => {
|
|
103
|
-
implementation = originalImplementation;
|
|
104
|
-
implementationChangedTemporarily = false;
|
|
105
|
-
};
|
|
106
|
-
const result = cb();
|
|
107
|
-
if (result instanceof Promise) {
|
|
108
|
-
return result.then(() => {
|
|
109
|
-
reset();
|
|
110
|
-
return stub;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
reset();
|
|
114
|
-
return stub;
|
|
115
|
-
}
|
|
116
|
-
stub.withImplementation = withImplementation;
|
|
117
|
-
stub.mockReturnThis = () => stub.mockImplementation(function() {
|
|
118
|
-
return this;
|
|
119
|
-
});
|
|
120
|
-
stub.mockReturnValue = (val) => stub.mockImplementation(() => val);
|
|
121
|
-
stub.mockReturnValueOnce = (val) => stub.mockImplementationOnce(() => val);
|
|
122
|
-
stub.mockResolvedValue = (val) => stub.mockImplementation(() => Promise.resolve(val));
|
|
123
|
-
stub.mockResolvedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.resolve(val));
|
|
124
|
-
stub.mockRejectedValue = (val) => stub.mockImplementation(() => Promise.reject(val));
|
|
125
|
-
stub.mockRejectedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.reject(val));
|
|
126
|
-
Object.defineProperty(stub, "mock", {
|
|
127
|
-
get: () => mockContext
|
|
128
|
-
});
|
|
129
|
-
state.willCall(mockCall);
|
|
130
|
-
mocks.add(stub);
|
|
131
|
-
return stub;
|
|
132
|
-
}
|
|
133
|
-
function fn(implementation) {
|
|
134
|
-
const enhancedSpy = enhanceSpy(C({
|
|
135
|
-
spy: implementation || function() {
|
|
136
|
-
}
|
|
137
|
-
}, "spy"));
|
|
138
|
-
if (implementation) {
|
|
139
|
-
enhancedSpy.mockImplementation(implementation);
|
|
140
|
-
}
|
|
141
|
-
return enhancedSpy;
|
|
142
|
-
}
|
|
143
|
-
export {
|
|
144
|
-
fn,
|
|
145
|
-
isMockFunction,
|
|
146
|
-
mocks,
|
|
147
|
-
spyOn
|
|
148
|
-
};
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index$1 = require("../../../../../@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.cjs");
|
|
4
|
-
const index = require("../../../../../loupe@3.1.2/node_modules/loupe/lib/index.qwik.cjs");
|
|
5
|
-
const {
|
|
6
|
-
AsymmetricMatcher,
|
|
7
|
-
DOMCollection,
|
|
8
|
-
DOMElement,
|
|
9
|
-
Immutable,
|
|
10
|
-
ReactElement,
|
|
11
|
-
ReactTestComponent
|
|
12
|
-
} = index$1.plugins;
|
|
13
|
-
const PLUGINS = [
|
|
14
|
-
ReactTestComponent,
|
|
15
|
-
ReactElement,
|
|
16
|
-
DOMElement,
|
|
17
|
-
DOMCollection,
|
|
18
|
-
Immutable,
|
|
19
|
-
AsymmetricMatcher
|
|
20
|
-
];
|
|
21
|
-
function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
|
|
22
|
-
const MAX_LENGTH = maxLength ?? 1e4;
|
|
23
|
-
let result;
|
|
24
|
-
try {
|
|
25
|
-
result = index$1.format(object, {
|
|
26
|
-
maxDepth,
|
|
27
|
-
escapeString: false,
|
|
28
|
-
// min: true,
|
|
29
|
-
plugins: PLUGINS,
|
|
30
|
-
...options
|
|
31
|
-
});
|
|
32
|
-
} catch {
|
|
33
|
-
result = index$1.format(object, {
|
|
34
|
-
callToJSON: false,
|
|
35
|
-
maxDepth,
|
|
36
|
-
escapeString: false,
|
|
37
|
-
// min: true,
|
|
38
|
-
plugins: PLUGINS,
|
|
39
|
-
...options
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
|
|
43
|
-
}
|
|
44
|
-
const formatRegExp = /%[sdjifoOc%]/g;
|
|
45
|
-
function format(...args) {
|
|
46
|
-
if (typeof args[0] !== "string") {
|
|
47
|
-
const objects = [];
|
|
48
|
-
for (let i2 = 0; i2 < args.length; i2++) {
|
|
49
|
-
objects.push(inspect(args[i2], { depth: 0, colors: false }));
|
|
50
|
-
}
|
|
51
|
-
return objects.join(" ");
|
|
52
|
-
}
|
|
53
|
-
const len = args.length;
|
|
54
|
-
let i = 1;
|
|
55
|
-
const template = args[0];
|
|
56
|
-
let str = String(template).replace(formatRegExp, (x) => {
|
|
57
|
-
if (x === "%%") {
|
|
58
|
-
return "%";
|
|
59
|
-
}
|
|
60
|
-
if (i >= len) {
|
|
61
|
-
return x;
|
|
62
|
-
}
|
|
63
|
-
switch (x) {
|
|
64
|
-
case "%s": {
|
|
65
|
-
const value = args[i++];
|
|
66
|
-
if (typeof value === "bigint") {
|
|
67
|
-
return `${value.toString()}n`;
|
|
68
|
-
}
|
|
69
|
-
if (typeof value === "number" && value === 0 && 1 / value < 0) {
|
|
70
|
-
return "-0";
|
|
71
|
-
}
|
|
72
|
-
if (typeof value === "object" && value !== null) {
|
|
73
|
-
return inspect(value, { depth: 0, colors: false });
|
|
74
|
-
}
|
|
75
|
-
return String(value);
|
|
76
|
-
}
|
|
77
|
-
case "%d": {
|
|
78
|
-
const value = args[i++];
|
|
79
|
-
if (typeof value === "bigint") {
|
|
80
|
-
return `${value.toString()}n`;
|
|
81
|
-
}
|
|
82
|
-
return Number(value).toString();
|
|
83
|
-
}
|
|
84
|
-
case "%i": {
|
|
85
|
-
const value = args[i++];
|
|
86
|
-
if (typeof value === "bigint") {
|
|
87
|
-
return `${value.toString()}n`;
|
|
88
|
-
}
|
|
89
|
-
return Number.parseInt(String(value)).toString();
|
|
90
|
-
}
|
|
91
|
-
case "%f":
|
|
92
|
-
return Number.parseFloat(String(args[i++])).toString();
|
|
93
|
-
case "%o":
|
|
94
|
-
return inspect(args[i++], { showHidden: true, showProxy: true });
|
|
95
|
-
case "%O":
|
|
96
|
-
return inspect(args[i++]);
|
|
97
|
-
case "%c": {
|
|
98
|
-
i++;
|
|
99
|
-
return "";
|
|
100
|
-
}
|
|
101
|
-
case "%j":
|
|
102
|
-
try {
|
|
103
|
-
return JSON.stringify(args[i++]);
|
|
104
|
-
} catch (err) {
|
|
105
|
-
const m = err.message;
|
|
106
|
-
if (
|
|
107
|
-
// chromium
|
|
108
|
-
m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")
|
|
109
|
-
) {
|
|
110
|
-
return "[Circular]";
|
|
111
|
-
}
|
|
112
|
-
throw err;
|
|
113
|
-
}
|
|
114
|
-
default:
|
|
115
|
-
return x;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
for (let x = args[i]; i < len; x = args[++i]) {
|
|
119
|
-
if (x === null || typeof x !== "object") {
|
|
120
|
-
str += ` ${x}`;
|
|
121
|
-
} else {
|
|
122
|
-
str += ` ${inspect(x)}`;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return str;
|
|
126
|
-
}
|
|
127
|
-
function inspect(obj, options = {}) {
|
|
128
|
-
if (options.truncate === 0) {
|
|
129
|
-
options.truncate = Number.POSITIVE_INFINITY;
|
|
130
|
-
}
|
|
131
|
-
return index.inspect(obj, options);
|
|
132
|
-
}
|
|
133
|
-
function objDisplay(obj, options = {}) {
|
|
134
|
-
if (typeof options.truncate === "undefined") {
|
|
135
|
-
options.truncate = 40;
|
|
136
|
-
}
|
|
137
|
-
const str = inspect(obj, options);
|
|
138
|
-
const type = Object.prototype.toString.call(obj);
|
|
139
|
-
if (options.truncate && str.length >= options.truncate) {
|
|
140
|
-
if (type === "[object Function]") {
|
|
141
|
-
const fn = obj;
|
|
142
|
-
return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
|
|
143
|
-
} else if (type === "[object Array]") {
|
|
144
|
-
return `[ Array(${obj.length}) ]`;
|
|
145
|
-
} else if (type === "[object Object]") {
|
|
146
|
-
const keys = Object.keys(obj);
|
|
147
|
-
const kstr = keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ");
|
|
148
|
-
return `{ Object (${kstr}) }`;
|
|
149
|
-
} else {
|
|
150
|
-
return str;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return str;
|
|
154
|
-
}
|
|
155
|
-
function getDefaultExportFromCjs(x) {
|
|
156
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
157
|
-
}
|
|
158
|
-
exports.f = format;
|
|
159
|
-
exports.g = getDefaultExportFromCjs;
|
|
160
|
-
exports.i = inspect;
|
|
161
|
-
exports.o = objDisplay;
|
|
162
|
-
exports.s = stringify;
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { format as format$1, plugins } from "../../../../../@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.mjs";
|
|
2
|
-
import { inspect as inspect$1 } from "../../../../../loupe@3.1.2/node_modules/loupe/lib/index.qwik.mjs";
|
|
3
|
-
const {
|
|
4
|
-
AsymmetricMatcher,
|
|
5
|
-
DOMCollection,
|
|
6
|
-
DOMElement,
|
|
7
|
-
Immutable,
|
|
8
|
-
ReactElement,
|
|
9
|
-
ReactTestComponent
|
|
10
|
-
} = plugins;
|
|
11
|
-
const PLUGINS = [
|
|
12
|
-
ReactTestComponent,
|
|
13
|
-
ReactElement,
|
|
14
|
-
DOMElement,
|
|
15
|
-
DOMCollection,
|
|
16
|
-
Immutable,
|
|
17
|
-
AsymmetricMatcher
|
|
18
|
-
];
|
|
19
|
-
function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
|
|
20
|
-
const MAX_LENGTH = maxLength ?? 1e4;
|
|
21
|
-
let result;
|
|
22
|
-
try {
|
|
23
|
-
result = format$1(object, {
|
|
24
|
-
maxDepth,
|
|
25
|
-
escapeString: false,
|
|
26
|
-
// min: true,
|
|
27
|
-
plugins: PLUGINS,
|
|
28
|
-
...options
|
|
29
|
-
});
|
|
30
|
-
} catch {
|
|
31
|
-
result = format$1(object, {
|
|
32
|
-
callToJSON: false,
|
|
33
|
-
maxDepth,
|
|
34
|
-
escapeString: false,
|
|
35
|
-
// min: true,
|
|
36
|
-
plugins: PLUGINS,
|
|
37
|
-
...options
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
|
|
41
|
-
}
|
|
42
|
-
const formatRegExp = /%[sdjifoOc%]/g;
|
|
43
|
-
function format(...args) {
|
|
44
|
-
if (typeof args[0] !== "string") {
|
|
45
|
-
const objects = [];
|
|
46
|
-
for (let i2 = 0; i2 < args.length; i2++) {
|
|
47
|
-
objects.push(inspect(args[i2], { depth: 0, colors: false }));
|
|
48
|
-
}
|
|
49
|
-
return objects.join(" ");
|
|
50
|
-
}
|
|
51
|
-
const len = args.length;
|
|
52
|
-
let i = 1;
|
|
53
|
-
const template = args[0];
|
|
54
|
-
let str = String(template).replace(formatRegExp, (x) => {
|
|
55
|
-
if (x === "%%") {
|
|
56
|
-
return "%";
|
|
57
|
-
}
|
|
58
|
-
if (i >= len) {
|
|
59
|
-
return x;
|
|
60
|
-
}
|
|
61
|
-
switch (x) {
|
|
62
|
-
case "%s": {
|
|
63
|
-
const value = args[i++];
|
|
64
|
-
if (typeof value === "bigint") {
|
|
65
|
-
return `${value.toString()}n`;
|
|
66
|
-
}
|
|
67
|
-
if (typeof value === "number" && value === 0 && 1 / value < 0) {
|
|
68
|
-
return "-0";
|
|
69
|
-
}
|
|
70
|
-
if (typeof value === "object" && value !== null) {
|
|
71
|
-
return inspect(value, { depth: 0, colors: false });
|
|
72
|
-
}
|
|
73
|
-
return String(value);
|
|
74
|
-
}
|
|
75
|
-
case "%d": {
|
|
76
|
-
const value = args[i++];
|
|
77
|
-
if (typeof value === "bigint") {
|
|
78
|
-
return `${value.toString()}n`;
|
|
79
|
-
}
|
|
80
|
-
return Number(value).toString();
|
|
81
|
-
}
|
|
82
|
-
case "%i": {
|
|
83
|
-
const value = args[i++];
|
|
84
|
-
if (typeof value === "bigint") {
|
|
85
|
-
return `${value.toString()}n`;
|
|
86
|
-
}
|
|
87
|
-
return Number.parseInt(String(value)).toString();
|
|
88
|
-
}
|
|
89
|
-
case "%f":
|
|
90
|
-
return Number.parseFloat(String(args[i++])).toString();
|
|
91
|
-
case "%o":
|
|
92
|
-
return inspect(args[i++], { showHidden: true, showProxy: true });
|
|
93
|
-
case "%O":
|
|
94
|
-
return inspect(args[i++]);
|
|
95
|
-
case "%c": {
|
|
96
|
-
i++;
|
|
97
|
-
return "";
|
|
98
|
-
}
|
|
99
|
-
case "%j":
|
|
100
|
-
try {
|
|
101
|
-
return JSON.stringify(args[i++]);
|
|
102
|
-
} catch (err) {
|
|
103
|
-
const m = err.message;
|
|
104
|
-
if (
|
|
105
|
-
// chromium
|
|
106
|
-
m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")
|
|
107
|
-
) {
|
|
108
|
-
return "[Circular]";
|
|
109
|
-
}
|
|
110
|
-
throw err;
|
|
111
|
-
}
|
|
112
|
-
default:
|
|
113
|
-
return x;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
for (let x = args[i]; i < len; x = args[++i]) {
|
|
117
|
-
if (x === null || typeof x !== "object") {
|
|
118
|
-
str += ` ${x}`;
|
|
119
|
-
} else {
|
|
120
|
-
str += ` ${inspect(x)}`;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return str;
|
|
124
|
-
}
|
|
125
|
-
function inspect(obj, options = {}) {
|
|
126
|
-
if (options.truncate === 0) {
|
|
127
|
-
options.truncate = Number.POSITIVE_INFINITY;
|
|
128
|
-
}
|
|
129
|
-
return inspect$1(obj, options);
|
|
130
|
-
}
|
|
131
|
-
function objDisplay(obj, options = {}) {
|
|
132
|
-
if (typeof options.truncate === "undefined") {
|
|
133
|
-
options.truncate = 40;
|
|
134
|
-
}
|
|
135
|
-
const str = inspect(obj, options);
|
|
136
|
-
const type = Object.prototype.toString.call(obj);
|
|
137
|
-
if (options.truncate && str.length >= options.truncate) {
|
|
138
|
-
if (type === "[object Function]") {
|
|
139
|
-
const fn = obj;
|
|
140
|
-
return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
|
|
141
|
-
} else if (type === "[object Array]") {
|
|
142
|
-
return `[ Array(${obj.length}) ]`;
|
|
143
|
-
} else if (type === "[object Object]") {
|
|
144
|
-
const keys = Object.keys(obj);
|
|
145
|
-
const kstr = keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ");
|
|
146
|
-
return `{ Object (${kstr}) }`;
|
|
147
|
-
} else {
|
|
148
|
-
return str;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return str;
|
|
152
|
-
}
|
|
153
|
-
function getDefaultExportFromCjs(x) {
|
|
154
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
155
|
-
}
|
|
156
|
-
export {
|
|
157
|
-
format as f,
|
|
158
|
-
getDefaultExportFromCjs as g,
|
|
159
|
-
inspect as i,
|
|
160
|
-
objDisplay as o,
|
|
161
|
-
stringify as s
|
|
162
|
-
};
|