vitest-auto-spy 5.0.0 → 5.0.1
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 +2 -2
- package/dist/angular.js +36 -26
- package/dist/bun-angular.js +5 -5
- package/dist/bun.d.ts +11 -0
- package/dist/bun.js +3 -3
- package/dist/{chunk-7U6CKTXA.js → chunk-5LLY42R7.js} +1 -1
- package/dist/{chunk-5UF3IVFC.js → chunk-CWHCYCCQ.js} +1 -1
- package/dist/{chunk-VZP5MG5N.js → chunk-NTJDMRHP.js} +1 -1
- package/dist/{chunk-E7HYS4K4.js → chunk-Q74KQJWG.js} +36 -26
- package/dist/{chunk-GNBP7CNT.js → chunk-VX5DDHAS.js} +1 -1
- package/dist/{chunk-KJREOXX6.js → chunk-YZOB2KRF.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/console.js +2 -2
- package/dist/diagnostics.js +5 -211
- package/dist/index.js +36 -26
- package/dist/jasmine.js +4 -4
- package/dist/nestjs.js +5 -5
- package/dist/node.cjs +36 -26
- package/dist/node.js +3 -3
- package/dist/react.js +4 -4
- package/dist/setup.js +3 -3
- package/dist/svelte.js +4 -4
- package/dist/vue.js +5 -5
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ faster at suite scale ([benchmarks](#benchmarks)) — and for
|
|
|
86
86
|
- 🤖 Built for AI agents too — one `npx vitest-auto-spy init` writes the pointer into the files your agents actually read and specialises it for this repository, backed by an offline [`AGENTS.md`](#using-this-library-with-an-ai-agent) inside the package, a [per-agent map](#which-file-your-agent-reads) for **Claude Code**, **OpenAI Codex**, **GLM/z.ai**, **Cursor**, **Copilot**, **Gemini CLI** and the rest, `llms.txt` on the docs site, a Claude Code skill, and errors that name their own fix
|
|
87
87
|
- 🟢 100% test coverage, **zero runtime dependencies** (in-tree arg serializer, no `javascript-stringify`)
|
|
88
88
|
|
|
89
|
-
## New in 5
|
|
89
|
+
## New in 5
|
|
90
90
|
|
|
91
91
|
A major that changes **no helper, no option and no runtime behaviour**. What it changes is what the
|
|
92
92
|
package claims to run on, because both old peer ranges were claims the code could not keep — the
|
|
@@ -103,7 +103,7 @@ full list, with what to do about each, is in
|
|
|
103
103
|
For almost everyone the whole upgrade is a version number: every Angular still supported by Angular
|
|
104
104
|
satisfies the new floor, and only a project pinning `rxjs@7.0` or `7.1` on purpose has to move.
|
|
105
105
|
|
|
106
|
-
## New in 4
|
|
106
|
+
## New in 4
|
|
107
107
|
|
|
108
108
|
A major with **one job**: take out of your project the weight this library was making it carry.
|
|
109
109
|
Nothing was removed or renamed and no runtime behaviour changed — the whole cost is two import
|
package/dist/angular.js
CHANGED
|
@@ -564,33 +564,43 @@ function isSameMatcher(configArg, candidateArg) {
|
|
|
564
564
|
function isBrandedMatcher(matcher) {
|
|
565
565
|
return matcher.$$typeof === ASYMMETRIC_MATCHER_BRAND;
|
|
566
566
|
}
|
|
567
|
+
var ARGS_MAP_BRAND = /* @__PURE__ */ Symbol.for("vitest-auto-spy.args-map");
|
|
568
|
+
var _a;
|
|
569
|
+
_a = ARGS_MAP_BRAND;
|
|
567
570
|
var ArgsMap = class {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
571
|
+
constructor() {
|
|
572
|
+
this[_a] = true;
|
|
573
|
+
// Prototype-less so a `'__proto__'` (or `'constructor'`) serialized key is a
|
|
574
|
+
// plain own property, never walking or polluting the object prototype chain.
|
|
575
|
+
this.#map = /* @__PURE__ */ Object.create(null);
|
|
576
|
+
this.#matcherConfigs = [];
|
|
577
|
+
// Argument counts present in the exact map. A call with a count nobody configured cannot be in
|
|
578
|
+
// that map — two arg lists of different lengths never serialize to the same string — so the
|
|
579
|
+
// serialization can be skipped outright. That matters because the map is consulted on *every*
|
|
580
|
+
// invocation of a spy that has any `calledWith` config: without this, `service.load(component)`
|
|
581
|
+
// on a spy configured with `calledWith(1)` walks and stringifies the whole component graph to
|
|
582
|
+
// build a key that provably cannot match, and throws it away one line later.
|
|
583
|
+
this.#arities = /* @__PURE__ */ new Set();
|
|
584
|
+
/**
|
|
585
|
+
* The configs of exactly one primitive argument, keyed by the argument itself.
|
|
586
|
+
*
|
|
587
|
+
* `calledWith(1)` / `calledWith('id')` is what nearly every spec writes, and it is looked up on
|
|
588
|
+
* **every call** of that spy. Through the string map that costs a rendered key per call — an array
|
|
589
|
+
* from `map`, a string per argument, a joined string, then a hash — for a lookup that a `Map` can
|
|
590
|
+
* do on the value with no allocation at all. The configs live in both maps: the string map still
|
|
591
|
+
* owns `configured()` and the arity set, so nothing about the failure messages or the miss check
|
|
592
|
+
* changes.
|
|
593
|
+
*
|
|
594
|
+
* Only shapes where the two agree go in here. A symbol renders by description, so two distinct
|
|
595
|
+
* symbols that share one are the same key in the string map and different keys in a `Map`; `-0`
|
|
596
|
+
* renders apart from `0` and is the same key under `SameValueZero`. Both stay on the string path.
|
|
597
|
+
*/
|
|
598
|
+
this.#exactSinglePrimitive = /* @__PURE__ */ new Map();
|
|
599
|
+
}
|
|
600
|
+
#map;
|
|
601
|
+
#matcherConfigs;
|
|
602
|
+
#arities;
|
|
603
|
+
#exactSinglePrimitive;
|
|
594
604
|
set(key, value) {
|
|
595
605
|
if (Array.isArray(key) && hasAsymmetricMatcher(key)) {
|
|
596
606
|
this.#setMatcherConfig(this.#buildMatcherConfig(key, value));
|
package/dist/bun-angular.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { flushEffects } from './chunk-ALFMIDWW.js';
|
|
2
2
|
export { flushEffects, stable } from './chunk-ALFMIDWW.js';
|
|
3
3
|
import './chunk-Y4YG7UOK.js';
|
|
4
|
-
import { createSpyForToken } from './chunk-
|
|
4
|
+
import { createSpyForToken } from './chunk-CWHCYCCQ.js';
|
|
5
5
|
import './chunk-NQXXUJPS.js';
|
|
6
|
-
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-
|
|
6
|
+
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-YZOB2KRF.js';
|
|
7
7
|
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-ZLF2YBXV.js';
|
|
8
|
-
import { createSpyFromClass } from './chunk-
|
|
9
|
-
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-
|
|
10
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
8
|
+
import { createSpyFromClass } from './chunk-VX5DDHAS.js';
|
|
9
|
+
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-VX5DDHAS.js';
|
|
10
|
+
export { createFunctionSpy, errorHandler } from './chunk-Q74KQJWG.js';
|
|
11
11
|
import './chunk-PC3FAZT3.js';
|
|
12
12
|
import { isAutoSpyLike } from './chunk-XRVVZXOM.js';
|
|
13
13
|
import { withDocs, DOCS_LINKS } from './chunk-B45HLBA4.js';
|
package/dist/bun.d.ts
CHANGED
|
@@ -384,8 +384,19 @@ interface ConfiguredEntry {
|
|
|
384
384
|
/** Whether an actual call's arguments hit this config. */
|
|
385
385
|
matches(actualArgs: unknown[]): boolean;
|
|
386
386
|
}
|
|
387
|
+
/**
|
|
388
|
+
* Identity that survives being bundled twice.
|
|
389
|
+
*
|
|
390
|
+
* tsup inlines a copy of this class into every entry point that reaches it, so a double built by
|
|
391
|
+
* `vitest-auto-spy` and read by `vitest-auto-spy/diagnostics` carries two different `ArgsMap`
|
|
392
|
+
* constructors and `instanceof` answers false. That is how `explainSpy` reported `nothing
|
|
393
|
+
* configured` for every configured double in the published package while every source-level spec
|
|
394
|
+
* passed: the specs import one copy. A registry symbol is the same value in both.
|
|
395
|
+
*/
|
|
396
|
+
declare const ARGS_MAP_BRAND: unique symbol;
|
|
387
397
|
declare class ArgsMap {
|
|
388
398
|
#private;
|
|
399
|
+
readonly [ARGS_MAP_BRAND] = true;
|
|
389
400
|
set(key: unknown, value: unknown): void;
|
|
390
401
|
get(key: unknown): unknown;
|
|
391
402
|
/**
|
package/dist/bun.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import './chunk-Y4YG7UOK.js';
|
|
2
2
|
import './chunk-NQXXUJPS.js';
|
|
3
|
-
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-
|
|
3
|
+
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-YZOB2KRF.js';
|
|
4
4
|
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-ZLF2YBXV.js';
|
|
5
|
-
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-
|
|
6
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
5
|
+
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-VX5DDHAS.js';
|
|
6
|
+
export { createFunctionSpy, errorHandler } from './chunk-Q74KQJWG.js';
|
|
7
7
|
import './chunk-PC3FAZT3.js';
|
|
8
8
|
import './chunk-XRVVZXOM.js';
|
|
9
9
|
import './chunk-B45HLBA4.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SWEEP_SENTINEL } from './chunk-YHDBRBGU.js';
|
|
2
|
-
import { FAST_SPY_BRAND, isThenable } from './chunk-
|
|
2
|
+
import { FAST_SPY_BRAND, isThenable } from './chunk-Q74KQJWG.js';
|
|
3
3
|
import { DISPOSE } from './chunk-PC3FAZT3.js';
|
|
4
4
|
import { vi } from 'vitest';
|
|
5
5
|
import { guardAccessorSpies } from './shared-state.js';
|
|
@@ -181,33 +181,43 @@ function isSameMatcher(configArg, candidateArg) {
|
|
|
181
181
|
function isBrandedMatcher(matcher) {
|
|
182
182
|
return matcher.$$typeof === ASYMMETRIC_MATCHER_BRAND;
|
|
183
183
|
}
|
|
184
|
+
var ARGS_MAP_BRAND = /* @__PURE__ */ Symbol.for("vitest-auto-spy.args-map");
|
|
185
|
+
var _a;
|
|
186
|
+
_a = ARGS_MAP_BRAND;
|
|
184
187
|
var ArgsMap = class {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
188
|
+
constructor() {
|
|
189
|
+
this[_a] = true;
|
|
190
|
+
// Prototype-less so a `'__proto__'` (or `'constructor'`) serialized key is a
|
|
191
|
+
// plain own property, never walking or polluting the object prototype chain.
|
|
192
|
+
this.#map = /* @__PURE__ */ Object.create(null);
|
|
193
|
+
this.#matcherConfigs = [];
|
|
194
|
+
// Argument counts present in the exact map. A call with a count nobody configured cannot be in
|
|
195
|
+
// that map — two arg lists of different lengths never serialize to the same string — so the
|
|
196
|
+
// serialization can be skipped outright. That matters because the map is consulted on *every*
|
|
197
|
+
// invocation of a spy that has any `calledWith` config: without this, `service.load(component)`
|
|
198
|
+
// on a spy configured with `calledWith(1)` walks and stringifies the whole component graph to
|
|
199
|
+
// build a key that provably cannot match, and throws it away one line later.
|
|
200
|
+
this.#arities = /* @__PURE__ */ new Set();
|
|
201
|
+
/**
|
|
202
|
+
* The configs of exactly one primitive argument, keyed by the argument itself.
|
|
203
|
+
*
|
|
204
|
+
* `calledWith(1)` / `calledWith('id')` is what nearly every spec writes, and it is looked up on
|
|
205
|
+
* **every call** of that spy. Through the string map that costs a rendered key per call — an array
|
|
206
|
+
* from `map`, a string per argument, a joined string, then a hash — for a lookup that a `Map` can
|
|
207
|
+
* do on the value with no allocation at all. The configs live in both maps: the string map still
|
|
208
|
+
* owns `configured()` and the arity set, so nothing about the failure messages or the miss check
|
|
209
|
+
* changes.
|
|
210
|
+
*
|
|
211
|
+
* Only shapes where the two agree go in here. A symbol renders by description, so two distinct
|
|
212
|
+
* symbols that share one are the same key in the string map and different keys in a `Map`; `-0`
|
|
213
|
+
* renders apart from `0` and is the same key under `SameValueZero`. Both stay on the string path.
|
|
214
|
+
*/
|
|
215
|
+
this.#exactSinglePrimitive = /* @__PURE__ */ new Map();
|
|
216
|
+
}
|
|
217
|
+
#map;
|
|
218
|
+
#matcherConfigs;
|
|
219
|
+
#arities;
|
|
220
|
+
#exactSinglePrimitive;
|
|
211
221
|
set(key, value) {
|
|
212
222
|
if (Array.isArray(key) && hasAsymmetricMatcher(key)) {
|
|
213
223
|
this.#setMatcherConfig(this.#buildMatcherConfig(key, value));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveUnstubbedGuard, createFunctionSpy } from './chunk-
|
|
1
|
+
import { resolveUnstubbedGuard, createFunctionSpy } from './chunk-Q74KQJWG.js';
|
|
2
2
|
import { DISPOSE } from './chunk-PC3FAZT3.js';
|
|
3
3
|
import { runClearHook, runConfigReset, AUTO_SPY_MARK, markAsMock, isMarkedMock, readDeepChildren } from './chunk-XRVVZXOM.js';
|
|
4
4
|
import { withDocs, DOCS_LINKS } from './chunk-B45HLBA4.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { redefineFailure, mockValueProp, mockAccessorsProp } from './chunk-ZLF2YBXV.js';
|
|
2
|
-
import { resolveConfiguration, mergeMethodNames, getCallableMemberNames, applyReturns, createSpyFromClass, resolveAccessors, createAccessorsSpies, createProxyPropStore, storeWriteTraps, describeStoredProp, readStoredAccessor, NOT_STORED, disposeAutoSpy, isProtocolKey, isDeletedProp } from './chunk-
|
|
3
|
-
import { defineHelper, serializeValue, resolveUnstubbedGuard, createFunctionSpy } from './chunk-
|
|
2
|
+
import { resolveConfiguration, mergeMethodNames, getCallableMemberNames, applyReturns, createSpyFromClass, resolveAccessors, createAccessorsSpies, createProxyPropStore, storeWriteTraps, describeStoredProp, readStoredAccessor, NOT_STORED, disposeAutoSpy, isProtocolKey, isDeletedProp } from './chunk-VX5DDHAS.js';
|
|
3
|
+
import { defineHelper, serializeValue, resolveUnstubbedGuard, createFunctionSpy } from './chunk-Q74KQJWG.js';
|
|
4
4
|
import { DISPOSE } from './chunk-PC3FAZT3.js';
|
|
5
5
|
import { DEEP_CHILDREN } from './chunk-XRVVZXOM.js';
|
|
6
6
|
import { withDocs, DOCS_LINKS } from './chunk-B45HLBA4.js';
|
package/dist/cli.js
CHANGED
|
@@ -2411,7 +2411,7 @@ function checkForeignPragma(graph) {
|
|
|
2411
2411
|
}
|
|
2412
2412
|
|
|
2413
2413
|
// src/cli/checks/export-map.generated.ts
|
|
2414
|
-
var EXPORT_MAP_VERSION = "5.0.
|
|
2414
|
+
var EXPORT_MAP_VERSION = "5.0.1";
|
|
2415
2415
|
var ENTRY_SPECIFIERS = "vitest-auto-spy vitest-auto-spy/bun vitest-auto-spy/bun-angular vitest-auto-spy/node vitest-auto-spy/rxjs vitest-auto-spy/console vitest-auto-spy/dom-stubs vitest-auto-spy/diagnostics vitest-auto-spy/jasmine vitest-auto-spy/jasmine-compat vitest-auto-spy/observer-spy vitest-auto-spy/angular vitest-auto-spy/angular-http vitest-auto-spy/nestjs vitest-auto-spy/react vitest-auto-spy/vue vitest-auto-spy/svelte vitest-auto-spy/setup vitest-auto-spy/zone vitest-auto-spy/eslint-plugin";
|
|
2416
2416
|
var EXPORTED_BY = {
|
|
2417
2417
|
AccessorImplementations: "0 1 2 3 11 14 15 16",
|
package/dist/console.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { vitestMockAdapter } from './chunk-
|
|
1
|
+
import { vitestMockAdapter } from './chunk-NTJDMRHP.js';
|
|
2
2
|
import './chunk-YHDBRBGU.js';
|
|
3
|
-
import { createFunctionSpy } from './chunk-
|
|
3
|
+
import { createFunctionSpy } from './chunk-Q74KQJWG.js';
|
|
4
4
|
import './chunk-PC3FAZT3.js';
|
|
5
5
|
import './chunk-XRVVZXOM.js';
|
|
6
6
|
import './chunk-B45HLBA4.js';
|
package/dist/diagnostics.js
CHANGED
|
@@ -125,9 +125,6 @@ function serializePrimitive(value) {
|
|
|
125
125
|
}
|
|
126
126
|
return String(value);
|
|
127
127
|
}
|
|
128
|
-
function isDeepValue(value) {
|
|
129
|
-
return typeof value === "object" && value !== null;
|
|
130
|
-
}
|
|
131
128
|
function serializeInContext(value, context) {
|
|
132
129
|
if (typeof value === "object" && value !== null) {
|
|
133
130
|
return serializeObject(value, context);
|
|
@@ -203,213 +200,10 @@ function diffByField(actual, expected) {
|
|
|
203
200
|
const lines = differences.map((difference) => describeField(difference, actual.length));
|
|
204
201
|
return [`${affected.size} of ${actual.length} elements differ.`, ...lines].join("\n");
|
|
205
202
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
const [argument] = args;
|
|
213
|
-
const kind = typeof argument;
|
|
214
|
-
if (kind === "object" || kind === "function" || kind === "symbol") {
|
|
215
|
-
return argument === null;
|
|
216
|
-
}
|
|
217
|
-
return !Object.is(argument, -0);
|
|
218
|
-
}
|
|
219
|
-
function isAsymmetricMatcher(value) {
|
|
220
|
-
return typeof value === "object" && value !== null && "asymmetricMatch" in value && typeof value.asymmetricMatch === "function";
|
|
221
|
-
}
|
|
222
|
-
function hasAsymmetricMatcher(args) {
|
|
223
|
-
return args.some(isAsymmetricMatcher);
|
|
224
|
-
}
|
|
225
|
-
var ASYMMETRIC_MATCHER_BRAND = /* @__PURE__ */ Symbol.for("jest.asymmetricMatcher");
|
|
226
|
-
function isSameMatcher(configArg, candidateArg) {
|
|
227
|
-
if (configArg === candidateArg) {
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
if (!isAsymmetricMatcher(candidateArg) || !isBrandedMatcher(configArg) || !isBrandedMatcher(candidateArg)) {
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
if (Object.getPrototypeOf(configArg) !== Object.getPrototypeOf(candidateArg)) {
|
|
234
|
-
return false;
|
|
235
|
-
}
|
|
236
|
-
return serializeValue(configArg) === serializeValue(candidateArg);
|
|
237
|
-
}
|
|
238
|
-
function isBrandedMatcher(matcher) {
|
|
239
|
-
return matcher.$$typeof === ASYMMETRIC_MATCHER_BRAND;
|
|
240
|
-
}
|
|
241
|
-
var ArgsMap = class {
|
|
242
|
-
// Prototype-less so a `'__proto__'` (or `'constructor'`) serialized key is a
|
|
243
|
-
// plain own property, never walking or polluting the object prototype chain.
|
|
244
|
-
#map = /* @__PURE__ */ Object.create(null);
|
|
245
|
-
#matcherConfigs = [];
|
|
246
|
-
// Argument counts present in the exact map. A call with a count nobody configured cannot be in
|
|
247
|
-
// that map — two arg lists of different lengths never serialize to the same string — so the
|
|
248
|
-
// serialization can be skipped outright. That matters because the map is consulted on *every*
|
|
249
|
-
// invocation of a spy that has any `calledWith` config: without this, `service.load(component)`
|
|
250
|
-
// on a spy configured with `calledWith(1)` walks and stringifies the whole component graph to
|
|
251
|
-
// build a key that provably cannot match, and throws it away one line later.
|
|
252
|
-
#arities = /* @__PURE__ */ new Set();
|
|
253
|
-
/**
|
|
254
|
-
* The configs of exactly one primitive argument, keyed by the argument itself.
|
|
255
|
-
*
|
|
256
|
-
* `calledWith(1)` / `calledWith('id')` is what nearly every spec writes, and it is looked up on
|
|
257
|
-
* **every call** of that spy. Through the string map that costs a rendered key per call — an array
|
|
258
|
-
* from `map`, a string per argument, a joined string, then a hash — for a lookup that a `Map` can
|
|
259
|
-
* do on the value with no allocation at all. The configs live in both maps: the string map still
|
|
260
|
-
* owns `configured()` and the arity set, so nothing about the failure messages or the miss check
|
|
261
|
-
* changes.
|
|
262
|
-
*
|
|
263
|
-
* Only shapes where the two agree go in here. A symbol renders by description, so two distinct
|
|
264
|
-
* symbols that share one are the same key in the string map and different keys in a `Map`; `-0`
|
|
265
|
-
* renders apart from `0` and is the same key under `SameValueZero`. Both stay on the string path.
|
|
266
|
-
*/
|
|
267
|
-
#exactSinglePrimitive = /* @__PURE__ */ new Map();
|
|
268
|
-
set(key, value) {
|
|
269
|
-
if (Array.isArray(key) && hasAsymmetricMatcher(key)) {
|
|
270
|
-
this.#setMatcherConfig(this.#buildMatcherConfig(key, value));
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
if (Array.isArray(key)) {
|
|
274
|
-
this.#arities.add(key.length);
|
|
275
|
-
if (isSinglePrimitiveArgs(key)) {
|
|
276
|
-
this.#exactSinglePrimitive.set(key[0], value);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
this.#map[this.#serialize(key)] = value;
|
|
280
|
-
}
|
|
281
|
-
get(key) {
|
|
282
|
-
if (Array.isArray(key) && !this.#arities.has(key.length)) {
|
|
283
|
-
return this.#findByMatcher(key);
|
|
284
|
-
}
|
|
285
|
-
if (Array.isArray(key) && isSinglePrimitiveArgs(key)) {
|
|
286
|
-
const hit = this.#exactSinglePrimitive.get(key[0]);
|
|
287
|
-
return hit === void 0 ? this.#findByMatcher(key) : hit;
|
|
288
|
-
}
|
|
289
|
-
const serialized = this.#serialize(key);
|
|
290
|
-
if (serialized in this.#map) {
|
|
291
|
-
return this.#map[serialized];
|
|
292
|
-
}
|
|
293
|
-
return this.#findByMatcher(key);
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Every configured argument list, rendered the way a lookup key is — the *wanted* half of a
|
|
297
|
-
* `mustBeCalledWith` failure.
|
|
298
|
-
*
|
|
299
|
-
* Nothing is rendered here: the exact configs are keyed by their own serialization, and an
|
|
300
|
-
* asymmetric config carries the description built when it was registered. A failure message is
|
|
301
|
-
* assembling text it already has.
|
|
302
|
-
*/
|
|
303
|
-
configured() {
|
|
304
|
-
const asymmetric = this.#matcherConfigs.map((config) => `[${config.described.join(",")}]`);
|
|
305
|
-
return [...Object.keys(this.#map), ...asymmetric];
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Every configured argument list as a {@link ConfiguredEntry} — the same lists {@link configured}
|
|
309
|
-
* returns, each carrying its own position and its own predicate.
|
|
310
|
-
*
|
|
311
|
-
* The order is the order a lookup consults them (exact configs first, then the asymmetric ones in
|
|
312
|
-
* registration order), so the first entry whose `matches` holds is the config `get` would have
|
|
313
|
-
* answered from. That is what lets a reader be told "call 3 hit config 2" instead of a list of
|
|
314
|
-
* configs and a list of calls with nothing joining them.
|
|
315
|
-
*/
|
|
316
|
-
configuredEntries() {
|
|
317
|
-
const exact = Object.keys(this.#map).map((key, position) => ({
|
|
318
|
-
index: position + 1,
|
|
319
|
-
args: key,
|
|
320
|
-
matches: (actualArgs) => this.#serialize(actualArgs) === key
|
|
321
|
-
}));
|
|
322
|
-
const asymmetric = this.#matcherConfigs.map((config, position) => ({
|
|
323
|
-
index: exact.length + position + 1,
|
|
324
|
-
args: `[${config.described.join(",")}]`,
|
|
325
|
-
matches: (actualArgs) => this.#argsMatch(config, actualArgs)
|
|
326
|
-
}));
|
|
327
|
-
return [...exact, ...asymmetric];
|
|
328
|
-
}
|
|
329
|
-
/** Render one asymmetric config once, at registration time. See {@link MatcherConfig}. */
|
|
330
|
-
#buildMatcherConfig(key, value) {
|
|
331
|
-
const serialized = [];
|
|
332
|
-
const described = [];
|
|
333
|
-
for (const arg of key) {
|
|
334
|
-
if (isAsymmetricMatcher(arg)) {
|
|
335
|
-
serialized.push(void 0);
|
|
336
|
-
described.push(arg.toAsymmetricMatcher?.() ?? String(arg));
|
|
337
|
-
} else {
|
|
338
|
-
const rendered = this.#serialize([arg]);
|
|
339
|
-
serialized.push(rendered);
|
|
340
|
-
described.push(rendered.slice(1, -1));
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
return { args: key, serialized, described, value };
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Register an asymmetric config, replacing an equivalent one in place.
|
|
347
|
-
*
|
|
348
|
-
* Re-registering args is how a test overrides an earlier answer, and on the exact map that falls
|
|
349
|
-
* out for free — the second `set` writes the same key. The matcher list has to do it by hand:
|
|
350
|
-
* lookup takes the first predicate that matches, so an appended duplicate would sit behind the
|
|
351
|
-
* config it was meant to replace and never be reached, and a `beforeEach` that reconfigures the
|
|
352
|
-
* same spy would grow the list on every test. Replacing in place also keeps the registration
|
|
353
|
-
* order that decides which of two *overlapping* configs wins.
|
|
354
|
-
*/
|
|
355
|
-
#setMatcherConfig(config) {
|
|
356
|
-
const index = this.#matcherConfigs.findIndex((existing) => this.#sameConfigArgs(existing, config));
|
|
357
|
-
if (index === -1) {
|
|
358
|
-
this.#matcherConfigs.push(config);
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
this.#matcherConfigs[index] = config;
|
|
362
|
-
}
|
|
363
|
-
/** Whether two configs were registered for the same argument list, matcher positions included. */
|
|
364
|
-
#sameConfigArgs(existing, candidate) {
|
|
365
|
-
if (existing.args.length !== candidate.args.length) {
|
|
366
|
-
return false;
|
|
367
|
-
}
|
|
368
|
-
return existing.args.every(
|
|
369
|
-
(arg, index) => isAsymmetricMatcher(arg) ? isSameMatcher(arg, candidate.args[index]) : existing.serialized[index] === candidate.serialized[index]
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
// Keys are always argument arrays; `serializeValue` renders them to a stable,
|
|
373
|
-
// total string (single-quoted strings, bracketed arrays, distinct `undefined`
|
|
374
|
-
// / function / symbol / BigInt / Date renderings, circular-ref safe). Arrays of
|
|
375
|
-
// only primitive args take a fast path that skips the circular-ref bookkeeping.
|
|
376
|
-
#serialize(key) {
|
|
377
|
-
if (Array.isArray(key) && !key.some(isDeepValue)) {
|
|
378
|
-
return `[${key.map((arg) => serializePrimitive(arg)).join(",")}]`;
|
|
379
|
-
}
|
|
380
|
-
return serializeValue(key);
|
|
381
|
-
}
|
|
382
|
-
/** Return the value of the first asymmetric config whose predicate matches the actual args. */
|
|
383
|
-
#findByMatcher(actualArgs) {
|
|
384
|
-
if (!Array.isArray(actualArgs)) {
|
|
385
|
-
return void 0;
|
|
386
|
-
}
|
|
387
|
-
const match = this.#matcherConfigs.find((config) => this.#argsMatch(config, actualArgs));
|
|
388
|
-
return match?.value;
|
|
389
|
-
}
|
|
390
|
-
/** Whether every configured arg matches the actual arg at the same position (same length). */
|
|
391
|
-
#argsMatch(config, actualArgs) {
|
|
392
|
-
if (config.args.length !== actualArgs.length) {
|
|
393
|
-
return false;
|
|
394
|
-
}
|
|
395
|
-
return config.args.every((configArg, index) => this.#valueMatches(configArg, config.serialized[index], actualArgs[index]));
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Match a single arg: asymmetric matchers delegate to `asymmetricMatch`, others compare the
|
|
399
|
-
* config arg's serialization — rendered once at `set()` time — against the actual arg's.
|
|
400
|
-
*
|
|
401
|
-
* The branch is taken on `configArg` rather than on `serializedConfigArg === undefined`, even
|
|
402
|
-
* though the two are the same test by construction: the type guard is what narrows `configArg`
|
|
403
|
-
* to something with `asymmetricMatch` on it, and the alternative needs an assertion to say the
|
|
404
|
-
* same thing less safely.
|
|
405
|
-
*/
|
|
406
|
-
#valueMatches(configArg, serializedConfigArg, actualArg) {
|
|
407
|
-
if (isAsymmetricMatcher(configArg)) {
|
|
408
|
-
return configArg.asymmetricMatch(actualArg);
|
|
409
|
-
}
|
|
410
|
-
return serializedConfigArg === this.#serialize([actualArg]);
|
|
411
|
-
}
|
|
412
|
-
};
|
|
203
|
+
var ARGS_MAP_BRAND = /* @__PURE__ */ Symbol.for("vitest-auto-spy.args-map");
|
|
204
|
+
function isArgsMap(value) {
|
|
205
|
+
return typeof value === "object" && value !== null && Reflect.get(value, ARGS_MAP_BRAND) === true;
|
|
206
|
+
}
|
|
413
207
|
|
|
414
208
|
// src/lib/spy-mark.ts
|
|
415
209
|
var AUTO_SPY_MARK = /* @__PURE__ */ Symbol.for("vitest-auto-spy.mock");
|
|
@@ -447,7 +241,7 @@ function chainsOf(mock) {
|
|
|
447
241
|
for (const name of CHAIN_NAMES) {
|
|
448
242
|
const chain = Reflect.get(state, name);
|
|
449
243
|
const map = isObject(chain) ? Reflect.get(chain, "argsToValuesMap") : void 0;
|
|
450
|
-
if (map
|
|
244
|
+
if (isArgsMap(map)) {
|
|
451
245
|
chains.push({ name, map });
|
|
452
246
|
}
|
|
453
247
|
}
|
package/dist/index.js
CHANGED
|
@@ -613,33 +613,43 @@ function isSameMatcher(configArg, candidateArg) {
|
|
|
613
613
|
function isBrandedMatcher(matcher) {
|
|
614
614
|
return matcher.$$typeof === ASYMMETRIC_MATCHER_BRAND;
|
|
615
615
|
}
|
|
616
|
+
var ARGS_MAP_BRAND = /* @__PURE__ */ Symbol.for("vitest-auto-spy.args-map");
|
|
617
|
+
var _a;
|
|
618
|
+
_a = ARGS_MAP_BRAND;
|
|
616
619
|
var ArgsMap = class {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
620
|
+
constructor() {
|
|
621
|
+
this[_a] = true;
|
|
622
|
+
// Prototype-less so a `'__proto__'` (or `'constructor'`) serialized key is a
|
|
623
|
+
// plain own property, never walking or polluting the object prototype chain.
|
|
624
|
+
this.#map = /* @__PURE__ */ Object.create(null);
|
|
625
|
+
this.#matcherConfigs = [];
|
|
626
|
+
// Argument counts present in the exact map. A call with a count nobody configured cannot be in
|
|
627
|
+
// that map — two arg lists of different lengths never serialize to the same string — so the
|
|
628
|
+
// serialization can be skipped outright. That matters because the map is consulted on *every*
|
|
629
|
+
// invocation of a spy that has any `calledWith` config: without this, `service.load(component)`
|
|
630
|
+
// on a spy configured with `calledWith(1)` walks and stringifies the whole component graph to
|
|
631
|
+
// build a key that provably cannot match, and throws it away one line later.
|
|
632
|
+
this.#arities = /* @__PURE__ */ new Set();
|
|
633
|
+
/**
|
|
634
|
+
* The configs of exactly one primitive argument, keyed by the argument itself.
|
|
635
|
+
*
|
|
636
|
+
* `calledWith(1)` / `calledWith('id')` is what nearly every spec writes, and it is looked up on
|
|
637
|
+
* **every call** of that spy. Through the string map that costs a rendered key per call — an array
|
|
638
|
+
* from `map`, a string per argument, a joined string, then a hash — for a lookup that a `Map` can
|
|
639
|
+
* do on the value with no allocation at all. The configs live in both maps: the string map still
|
|
640
|
+
* owns `configured()` and the arity set, so nothing about the failure messages or the miss check
|
|
641
|
+
* changes.
|
|
642
|
+
*
|
|
643
|
+
* Only shapes where the two agree go in here. A symbol renders by description, so two distinct
|
|
644
|
+
* symbols that share one are the same key in the string map and different keys in a `Map`; `-0`
|
|
645
|
+
* renders apart from `0` and is the same key under `SameValueZero`. Both stay on the string path.
|
|
646
|
+
*/
|
|
647
|
+
this.#exactSinglePrimitive = /* @__PURE__ */ new Map();
|
|
648
|
+
}
|
|
649
|
+
#map;
|
|
650
|
+
#matcherConfigs;
|
|
651
|
+
#arities;
|
|
652
|
+
#exactSinglePrimitive;
|
|
643
653
|
set(key, value) {
|
|
644
654
|
if (Array.isArray(key) && hasAsymmetricMatcher(key)) {
|
|
645
655
|
this.#setMatcherConfig(this.#buildMatcherConfig(key, value));
|
package/dist/jasmine.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useVitestAdapter } from './chunk-
|
|
1
|
+
import { useVitestAdapter } from './chunk-5LLY42R7.js';
|
|
2
2
|
import { enableJasmineCompat } from './chunk-MAKQSO2R.js';
|
|
3
3
|
export { enableJasmineCompat } from './chunk-MAKQSO2R.js';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-NTJDMRHP.js';
|
|
5
5
|
import './chunk-YHDBRBGU.js';
|
|
6
|
-
import { createSpyFromClass } from './chunk-
|
|
7
|
-
import { createFunctionSpy } from './chunk-
|
|
6
|
+
import { createSpyFromClass } from './chunk-VX5DDHAS.js';
|
|
7
|
+
import { createFunctionSpy } from './chunk-Q74KQJWG.js';
|
|
8
8
|
import './chunk-PC3FAZT3.js';
|
|
9
9
|
import './chunk-XRVVZXOM.js';
|
|
10
10
|
import './chunk-B45HLBA4.js';
|
package/dist/nestjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createSpyForToken } from './chunk-
|
|
2
|
-
export { trackInjections } from './chunk-
|
|
3
|
-
import { vitestMockAdapter } from './chunk-
|
|
1
|
+
import { createSpyForToken } from './chunk-CWHCYCCQ.js';
|
|
2
|
+
export { trackInjections } from './chunk-CWHCYCCQ.js';
|
|
3
|
+
import { vitestMockAdapter } from './chunk-NTJDMRHP.js';
|
|
4
4
|
import './chunk-YHDBRBGU.js';
|
|
5
|
-
import { createSpyFromClass } from './chunk-
|
|
6
|
-
import './chunk-
|
|
5
|
+
import { createSpyFromClass } from './chunk-VX5DDHAS.js';
|
|
6
|
+
import './chunk-Q74KQJWG.js';
|
|
7
7
|
import './chunk-PC3FAZT3.js';
|
|
8
8
|
import './chunk-XRVVZXOM.js';
|
|
9
9
|
import { withDocs, DOCS_LINKS } from './chunk-B45HLBA4.js';
|
package/dist/node.cjs
CHANGED
|
@@ -513,33 +513,43 @@ function isSameMatcher(configArg, candidateArg) {
|
|
|
513
513
|
function isBrandedMatcher(matcher) {
|
|
514
514
|
return matcher.$$typeof === ASYMMETRIC_MATCHER_BRAND;
|
|
515
515
|
}
|
|
516
|
+
var ARGS_MAP_BRAND = /* @__PURE__ */ Symbol.for("vitest-auto-spy.args-map");
|
|
517
|
+
var _a;
|
|
518
|
+
_a = ARGS_MAP_BRAND;
|
|
516
519
|
var ArgsMap = class {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
520
|
+
constructor() {
|
|
521
|
+
this[_a] = true;
|
|
522
|
+
// Prototype-less so a `'__proto__'` (or `'constructor'`) serialized key is a
|
|
523
|
+
// plain own property, never walking or polluting the object prototype chain.
|
|
524
|
+
this.#map = /* @__PURE__ */ Object.create(null);
|
|
525
|
+
this.#matcherConfigs = [];
|
|
526
|
+
// Argument counts present in the exact map. A call with a count nobody configured cannot be in
|
|
527
|
+
// that map — two arg lists of different lengths never serialize to the same string — so the
|
|
528
|
+
// serialization can be skipped outright. That matters because the map is consulted on *every*
|
|
529
|
+
// invocation of a spy that has any `calledWith` config: without this, `service.load(component)`
|
|
530
|
+
// on a spy configured with `calledWith(1)` walks and stringifies the whole component graph to
|
|
531
|
+
// build a key that provably cannot match, and throws it away one line later.
|
|
532
|
+
this.#arities = /* @__PURE__ */ new Set();
|
|
533
|
+
/**
|
|
534
|
+
* The configs of exactly one primitive argument, keyed by the argument itself.
|
|
535
|
+
*
|
|
536
|
+
* `calledWith(1)` / `calledWith('id')` is what nearly every spec writes, and it is looked up on
|
|
537
|
+
* **every call** of that spy. Through the string map that costs a rendered key per call — an array
|
|
538
|
+
* from `map`, a string per argument, a joined string, then a hash — for a lookup that a `Map` can
|
|
539
|
+
* do on the value with no allocation at all. The configs live in both maps: the string map still
|
|
540
|
+
* owns `configured()` and the arity set, so nothing about the failure messages or the miss check
|
|
541
|
+
* changes.
|
|
542
|
+
*
|
|
543
|
+
* Only shapes where the two agree go in here. A symbol renders by description, so two distinct
|
|
544
|
+
* symbols that share one are the same key in the string map and different keys in a `Map`; `-0`
|
|
545
|
+
* renders apart from `0` and is the same key under `SameValueZero`. Both stay on the string path.
|
|
546
|
+
*/
|
|
547
|
+
this.#exactSinglePrimitive = /* @__PURE__ */ new Map();
|
|
548
|
+
}
|
|
549
|
+
#map;
|
|
550
|
+
#matcherConfigs;
|
|
551
|
+
#arities;
|
|
552
|
+
#exactSinglePrimitive;
|
|
543
553
|
set(key, value) {
|
|
544
554
|
if (Array.isArray(key) && hasAsymmetricMatcher(key)) {
|
|
545
555
|
this.#setMatcherConfig(this.#buildMatcherConfig(key, value));
|
package/dist/node.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRedefineMockAdapter } from './chunk-NQXXUJPS.js';
|
|
2
|
-
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-
|
|
2
|
+
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-YZOB2KRF.js';
|
|
3
3
|
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-ZLF2YBXV.js';
|
|
4
|
-
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-
|
|
5
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
4
|
+
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-VX5DDHAS.js';
|
|
5
|
+
export { createFunctionSpy, errorHandler } from './chunk-Q74KQJWG.js';
|
|
6
6
|
import './chunk-PC3FAZT3.js';
|
|
7
7
|
import './chunk-XRVVZXOM.js';
|
|
8
8
|
import './chunk-B45HLBA4.js';
|
package/dist/react.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { vitestMockAdapter } from './chunk-
|
|
1
|
+
import { vitestMockAdapter } from './chunk-NTJDMRHP.js';
|
|
2
2
|
import './chunk-YHDBRBGU.js';
|
|
3
|
-
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-
|
|
3
|
+
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-YZOB2KRF.js';
|
|
4
4
|
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-ZLF2YBXV.js';
|
|
5
|
-
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-
|
|
6
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
5
|
+
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-VX5DDHAS.js';
|
|
6
|
+
export { createFunctionSpy, errorHandler } from './chunk-Q74KQJWG.js';
|
|
7
7
|
import './chunk-PC3FAZT3.js';
|
|
8
8
|
import './chunk-XRVVZXOM.js';
|
|
9
9
|
import './chunk-B45HLBA4.js';
|
package/dist/setup.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useVitestAdapter } from './chunk-
|
|
2
|
-
export { getSpyEngine, setSpyEngine } from './chunk-
|
|
1
|
+
import { useVitestAdapter } from './chunk-5LLY42R7.js';
|
|
2
|
+
export { getSpyEngine, setSpyEngine } from './chunk-NTJDMRHP.js';
|
|
3
3
|
import { SWEEP_SENTINEL } from './chunk-YHDBRBGU.js';
|
|
4
4
|
import { mockValueProp, countMockedProps, restoreMockedProps } from './chunk-ZLF2YBXV.js';
|
|
5
|
-
import { defineHelper, setDefaultStrictMode } from './chunk-
|
|
5
|
+
import { defineHelper, setDefaultStrictMode } from './chunk-Q74KQJWG.js';
|
|
6
6
|
import './chunk-PC3FAZT3.js';
|
|
7
7
|
import './chunk-XRVVZXOM.js';
|
|
8
8
|
import { withDocs, DOCS_LINKS } from './chunk-B45HLBA4.js';
|
package/dist/svelte.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { vitestMockAdapter } from './chunk-
|
|
1
|
+
import { vitestMockAdapter } from './chunk-NTJDMRHP.js';
|
|
2
2
|
import './chunk-YHDBRBGU.js';
|
|
3
|
-
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-
|
|
3
|
+
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-YZOB2KRF.js';
|
|
4
4
|
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-ZLF2YBXV.js';
|
|
5
|
-
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-
|
|
6
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
5
|
+
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-VX5DDHAS.js';
|
|
6
|
+
export { createFunctionSpy, errorHandler } from './chunk-Q74KQJWG.js';
|
|
7
7
|
import './chunk-PC3FAZT3.js';
|
|
8
8
|
import './chunk-XRVVZXOM.js';
|
|
9
9
|
import './chunk-B45HLBA4.js';
|
package/dist/vue.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { vitestMockAdapter } from './chunk-
|
|
1
|
+
import { vitestMockAdapter } from './chunk-NTJDMRHP.js';
|
|
2
2
|
import './chunk-YHDBRBGU.js';
|
|
3
|
-
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-
|
|
3
|
+
export { asInstance, asInstances, asSpy, assertMocked, captureArg, createFixture, createFixtureFactory, createMock, createSpyClass, createSpyFromInstance, describeDuplicateCopies, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, getPackageCopies, mockConstructor, mockDeep, moduleNamespace, narrow, restoreSpiedInstance, setEmissionTimeout, settleDynamicImport, stubConstructor, withOverrides } from './chunk-YZOB2KRF.js';
|
|
4
4
|
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-ZLF2YBXV.js';
|
|
5
|
-
import { createSpyFromClass } from './chunk-
|
|
6
|
-
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-
|
|
7
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
5
|
+
import { createSpyFromClass } from './chunk-VX5DDHAS.js';
|
|
6
|
+
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-VX5DDHAS.js';
|
|
7
|
+
export { createFunctionSpy, errorHandler } from './chunk-Q74KQJWG.js';
|
|
8
8
|
import './chunk-PC3FAZT3.js';
|
|
9
9
|
import './chunk-XRVVZXOM.js';
|
|
10
10
|
import './chunk-B45HLBA4.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-auto-spy",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Auto-generate fully-typed test spies from a class — across Vitest, Bun and node:test, with Angular/NestJS/React/Vue/Svelte recipes. Drop-in replacement for jest-auto-spies and jasmine-auto-spies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auto-mock",
|
|
@@ -223,6 +223,7 @@
|
|
|
223
223
|
"size:entries": "node scripts/size-entries.mjs",
|
|
224
224
|
"size:entries:check": "node scripts/size-entries.mjs --check",
|
|
225
225
|
"size:entries:update": "node scripts/size-entries.mjs --update",
|
|
226
|
+
"smoke:dist": "node scripts/smoke-dist.mjs",
|
|
226
227
|
"cold-import": "node scripts/cold-import.mjs",
|
|
227
228
|
"cold-import:check": "node scripts/cold-import.mjs --check",
|
|
228
229
|
"cold-import:update": "node scripts/cold-import.mjs --update",
|
|
@@ -319,6 +320,7 @@
|
|
|
319
320
|
"@types/node": "^24.13.3",
|
|
320
321
|
"@typescript-eslint/eslint-plugin": "^8.69.0",
|
|
321
322
|
"@typescript-eslint/parser": "^8.69.0",
|
|
323
|
+
"@vitest/coverage-istanbul": "^5.0.0",
|
|
322
324
|
"@vitest/coverage-v8": "^5.0.0",
|
|
323
325
|
"eslint": "^10.10.0",
|
|
324
326
|
"eslint-plugin-import-x": "^4.17.1",
|