vitest-auto-spy 3.15.0 → 3.16.0
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/AGENTS.md +23 -11
- package/README.md +17 -16
- package/dist/angular.d.ts +5 -5
- package/dist/angular.js +197 -85
- package/dist/bun-angular.d.ts +4 -4
- package/dist/bun-angular.js +7 -8
- package/dist/bun.d.ts +4 -4
- package/dist/bun.js +5 -5
- package/dist/{chunk-3OX44LME.js → chunk-3EHP3NKE.js} +94 -9
- package/dist/chunk-4K5F2NVN.js +91 -0
- package/dist/{chunk-AQSVZK2R.js → chunk-52DZMI55.js} +88 -145
- package/dist/{chunk-LIOV4WZK.js → chunk-BNZFNS42.js} +2 -2
- package/dist/{chunk-DMOJ4NZH.js → chunk-MMKKLL5J.js} +1 -1
- package/dist/{chunk-CR5Q3YMQ.js → chunk-YXHG5DXF.js} +4 -3
- package/dist/cli.js +47 -2
- package/dist/console.d.ts +1 -1
- package/dist/console.js +2 -2
- package/dist/{expect-emission-COcg6YzT.d.ts → expect-emission-BhGKIi7_.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +197 -85
- package/dist/jasmine-compat.d.ts +1 -1
- package/dist/jasmine.d.ts +2 -2
- package/dist/jasmine.js +3 -3
- package/dist/nestjs.d.ts +2 -2
- package/dist/nestjs.js +4 -4
- package/dist/node.cjs +203 -83
- package/dist/node.d.ts +3 -3
- package/dist/node.js +5 -5
- package/dist/{prop-mock-CEBKBA7k.d.ts → prop-mock-B5TLaKCg.d.ts} +1 -1
- package/dist/react.d.ts +3 -3
- package/dist/react.js +5 -5
- package/dist/rxjs.d.ts +2 -10
- package/dist/rxjs.js +118 -76
- package/dist/setup.d.ts +2 -2
- package/dist/setup.js +3 -3
- package/dist/svelte.d.ts +3 -3
- package/dist/svelte.js +5 -5
- package/dist/{track-injections-BU-WSjji.d.ts → track-injections-DXoDu6sG.d.ts} +1 -1
- package/dist/{types-W5kEgzND.d.ts → types-d8Mdj_jK.d.ts} +9 -1
- package/dist/vue.d.ts +4 -4
- package/dist/vue.js +6 -6
- package/dist/{zoneless-DzUXGIYb.d.ts → zoneless-BxqMRfiJ.d.ts} +3 -3
- package/package.json +4 -2
- package/skills/vitest-auto-spy/SKILL.md +60 -59
- package/dist/chunk-J5O72UHX.js +0 -6
package/AGENTS.md
CHANGED
|
@@ -265,6 +265,14 @@ across two thousand tests is under a tenth of a second. Call the factory in `bef
|
|
|
265
265
|
`provideAutoSpy` defaults to, and `autoSpyAccessors: true` walks the prototype chain uncached on
|
|
266
266
|
every call — name the accessors instead.
|
|
267
267
|
|
|
268
|
+
Memory is the exception, and only on classes wide enough for it to matter. `lazySpies: true` still
|
|
269
|
+
defines one accessor per method, and that placeholder is nearly all of what an untouched double
|
|
270
|
+
retains: 101.6 kB on a 400-method class against 11.8 kB with `lazySpies: 'proxy'`, which answers
|
|
271
|
+
every method from a single trap object instead (25 B per method against 253 B). It is opt-in because
|
|
272
|
+
a `Proxy` cannot remove itself — +30 ns per read and +43 ns per call, forever — and it loses on a
|
|
273
|
+
five-method service. Reach for it on generated API clients and ngrx facades under `isolate: false`,
|
|
274
|
+
where the doubles of a whole file are alive at once; leave the default everywhere else.
|
|
275
|
+
|
|
268
276
|
---
|
|
269
277
|
|
|
270
278
|
## 3. The 90% recipe
|
|
@@ -468,21 +476,21 @@ createSpyFromClass(MyService, {
|
|
|
468
476
|
gettersToSpyOn: ['userName'],
|
|
469
477
|
settersToSpyOn: ['userName'],
|
|
470
478
|
autoSpyAccessors: true, // discover every accessor on the prototype chain
|
|
471
|
-
lazySpies: true, // build each method spy on first access
|
|
479
|
+
lazySpies: true, // build each method spy on first access ('proxy' for very wide classes)
|
|
472
480
|
returns: { getProducts: of([]) }, // what a spied METHOD answers
|
|
473
481
|
overrides: { products$: subject }, // a member that is not a method result
|
|
474
482
|
});
|
|
475
483
|
```
|
|
476
484
|
|
|
477
|
-
| Key | Semantics
|
|
478
|
-
| ------------------------ |
|
|
479
|
-
| `methodsToSpyOn` | **Additive**, as in `jest-auto-spies`. Same behaviour as `instanceMethodsToSpyOn`.
|
|
480
|
-
| `onlyMethodsToSpyOn` | **Exhaustive whitelist.** Skips discovery; anything not listed is absent.
|
|
481
|
-
| `instanceMethodsToSpyOn` | **Additive.** The name to prefer in new code (see below).
|
|
482
|
-
| `autoSpyAccessors` | Merged with the explicit getter/setter lists.
|
|
483
|
-
| `lazySpies` | Behaviour-identical; only changes _when_ each spy is built.
|
|
484
|
-
| `strict` | Throw on a method nobody configured, instead of answering `undefined` (below).
|
|
485
|
-
| `onUnstubbedCall` | The general form of `strict`; its return value becomes the call's return value.
|
|
485
|
+
| Key | Semantics |
|
|
486
|
+
| ------------------------ | --------------------------------------------------------------------------------------------------------- |
|
|
487
|
+
| `methodsToSpyOn` | **Additive**, as in `jest-auto-spies`. Same behaviour as `instanceMethodsToSpyOn`. |
|
|
488
|
+
| `onlyMethodsToSpyOn` | **Exhaustive whitelist.** Skips discovery; anything not listed is absent. |
|
|
489
|
+
| `instanceMethodsToSpyOn` | **Additive.** The name to prefer in new code (see below). |
|
|
490
|
+
| `autoSpyAccessors` | Merged with the explicit getter/setter lists. |
|
|
491
|
+
| `lazySpies` | Behaviour-identical; only changes _when_ each spy is built. `'proxy'` also changes _what holds the name_. |
|
|
492
|
+
| `strict` | Throw on a method nobody configured, instead of answering `undefined` (below). |
|
|
493
|
+
| `onUnstubbedCall` | The general form of `strict`; its return value becomes the call's return value. |
|
|
486
494
|
|
|
487
495
|
**`instanceMethodsToSpyOn` is not an edge case — it is a top-5 option** (103 of ~370 spec files in
|
|
488
496
|
the reference suite). Method discovery walks the _prototype chain_; a callable assigned to an
|
|
@@ -2334,7 +2342,11 @@ suite that runs green but does not type-check is not done.
|
|
|
2334
2342
|
`doctor` is read-only and finds what a green run cannot: a `tsconfig` `include` pattern that
|
|
2335
2343
|
matches no file (so it type-checks nothing while `tsc --noEmit` still reports success), a
|
|
2336
2344
|
production module importing a `*.spec.ts`, a spec importing another spec, a `@jest-environment`
|
|
2337
|
-
pragma the runner never reads, and configuration left behind for a runner that is gone.
|
|
2345
|
+
pragma the runner never reads, and configuration left behind for a runner that is gone. Three of
|
|
2346
|
+
its checks are about coverage, where the run is green and the report is simply not the one the
|
|
2347
|
+
config describes — `coverage.all` on a Vitest that stopped reading the key, a source-only
|
|
2348
|
+
`coverage.include` in a runner config over a bundle, and a scope so large that `picomatch`
|
|
2349
|
+
recompiling it per file costs more than collecting the coverage does. It is
|
|
2338
2350
|
worth one run after any large edit to a test suite — especially after a codemod, which is where
|
|
2339
2351
|
the eaten glob below came from. Full reference:
|
|
2340
2352
|
<https://asdalexey.github.io/vitest-auto-spy/utilities/cli>.
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ identical API, with **RxJS** spies and **Angular / NestJS / React / Vue·Pinia /
|
|
|
19
19
|
[](https://www.npmjs.com/package/vitest-auto-spy)
|
|
20
20
|
[](https://www.npmjs.com/package/vitest-auto-spy)
|
|
21
21
|
[](https://github.com/ASDAlexey/vitest-auto-spy/actions/workflows/ci.yml)
|
|
22
|
-
[](#install)
|
|
23
23
|
[](https://www.npmjs.com/package/vitest-auto-spy)
|
|
24
24
|
[](https://github.com/ASDAlexey/vitest-auto-spy/actions/workflows/ci.yml)
|
|
25
25
|
[](./LICENSE)
|
|
@@ -239,20 +239,21 @@ error tsconfig-glob-matches-nothing libs/users/tsconfig.spec.json
|
|
|
239
239
|
3 errors, 4 warnings, 1 note
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
| Check
|
|
243
|
-
|
|
|
244
|
-
| `tsconfig-glob-matches-nothing`
|
|
245
|
-
| `tsconfig-file-missing`
|
|
246
|
-
| `spec-imported-by-non-spec`
|
|
247
|
-
| `spec-exports-fixture`
|
|
248
|
-
| `foreign-runner-pragma`
|
|
249
|
-
| `dead-runner-config`
|
|
250
|
-
| `orphan-runner-file`
|
|
251
|
-
| `angular-build-splitting-off`
|
|
252
|
-
| `coverage-all-removed`
|
|
253
|
-
| `coverage-include-misses-bundle`
|
|
254
|
-
| `
|
|
255
|
-
| `
|
|
242
|
+
| Check | What it finds |
|
|
243
|
+
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
244
|
+
| `tsconfig-glob-matches-nothing` | An `include` pattern that matches no file — so it type-checks nothing |
|
|
245
|
+
| `tsconfig-file-missing` | A `files` entry naming a file that is gone |
|
|
246
|
+
| `spec-imported-by-non-spec` | A production module importing a `*.spec.ts` |
|
|
247
|
+
| `spec-exports-fixture` | A spec importing another spec, whose hooks then run in a foreign file |
|
|
248
|
+
| `foreign-runner-pragma` | `@jest-environment` left in a spec, which Vitest never reads |
|
|
249
|
+
| `dead-runner-config` | `jest.config.*` / `karma.conf.*` for a runner that is not installed |
|
|
250
|
+
| `orphan-runner-file` | A setup file only that dead config referenced |
|
|
251
|
+
| `angular-build-splitting-off` | `@angular/build` in `[22.1.5, 22.1.7)` — the OOM under `--coverage` |
|
|
252
|
+
| `coverage-all-removed` | `coverage.all` in a config, on a Vitest that stopped reading the key |
|
|
253
|
+
| `coverage-include-misses-bundle` | A `coverage.include` of sources only, in a runner config over a bundle |
|
|
254
|
+
| `coverage-include-recompiles-globs` | A coverage scope large enough that `picomatch` recompiling it per file costs more than the coverage. Info |
|
|
255
|
+
| `jasmine-era-project` | `jasmine-core`, `@types/jasmine`, `karma.conf.*` or `@hirez_io/observer-spy` still installed. Info, not an error |
|
|
256
|
+
| `no-agent-instructions` | No instruction file names the package. A note, not an error |
|
|
256
257
|
|
|
257
258
|
The check that motivated the tool: a spec showing `Cannot find name 'vi'` in the editor while
|
|
258
259
|
`tsc --noEmit` reported zero errors. A migration codemod editing `include` had eaten a `/**`,
|
|
@@ -2682,7 +2683,7 @@ as `methodsToSpyOn`, named for callables that live on the instance — `signal()
|
|
|
2682
2683
|
`gettersToSpyOn`, `settersToSpyOn`, `autoSpyAccessors` (discover every getter/setter),
|
|
2683
2684
|
`fillMissing` (answer a name the prototype never carried with a spy — for a **partially** abstract
|
|
2684
2685
|
class, where `abstract` members are erased and the empty-prototype fallback no longer fires),
|
|
2685
|
-
`lazySpies` (materialize method spies on first access — cheaper for wide classes; the `provideAutoSpy` default on Angular)
|
|
2686
|
+
`lazySpies` (materialize method spies on first access — cheaper for wide classes; the `provideAutoSpy` default on Angular. `'proxy'` keeps the laziness and drops the per-method placeholder: 11.8 kB retained against 101.6 kB on a 400-method class, at +30 ns per read — opt-in, and worth it only above ~20 methods)
|
|
2686
2687
|
|
|
2687
2688
|
`ValueConfig` (for `nextWithValues`): `{ value, delay? }` | `{ errorValue, delay? }` | `{ complete?, delay? }`.
|
|
2688
2689
|
|
package/dist/angular.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { l as AngularTokenProvider, A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, R as RenderShallowOptions, c as ResourceStatusLike, S as SettleResourceOptions, d as ShallowRender, e as SpyRegistry, f as StableOptions, g as createWithAutoSpies, h as flushEffects, i as injectSpy, p as provideAutoSpy, m as provideAutoSpyForToken, r as renderShallow, j as runEffect, s as settleResource, k as stable } from './zoneless-
|
|
1
|
+
export { l as AngularTokenProvider, A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, R as RenderShallowOptions, c as ResourceStatusLike, S as SettleResourceOptions, d as ShallowRender, e as SpyRegistry, f as StableOptions, g as createWithAutoSpies, h as flushEffects, i as injectSpy, p as provideAutoSpy, m as provideAutoSpyForToken, r as renderShallow, j as runEffect, s as settleResource, k as stable } from './zoneless-BxqMRfiJ.js';
|
|
2
2
|
import { InjectionToken, Provider, Type, Signal, WritableSignal } from '@angular/core';
|
|
3
3
|
import { TestAPI } from 'vitest';
|
|
4
|
-
import { C as ClassType, S as Spy, a as ClassSpyConfiguration, O as OnlyMethodKeysOf, j as AddSpyMethodsByReturnTypes } from './types-
|
|
5
|
-
export { I as InjectionLog, T as TrackInjectionsOptions, a as TrackedProvider, t as trackInjections } from './track-injections-
|
|
6
|
-
export { A as AccessorImplementations, R as RestoreProp, c as countMockedProps, m as mockAccessorsProp, a as mockReadonlyProp, b as mockReadonlyPropGetter, d as mockValueProp, r as restoreMockedProps } from './prop-mock-
|
|
7
|
-
export { C as CallbackSubscribable, E as EmissionObserver, a as EmissionOptions, b as EmissionSource, S as SubscribableLike, e as expectCompletion, f as expectEmission, g as expectEmissions, h as expectError, i as expectNoEmission, s as setEmissionTimeout } from './expect-emission-
|
|
4
|
+
import { C as ClassType, S as Spy, a as ClassSpyConfiguration, O as OnlyMethodKeysOf, j as AddSpyMethodsByReturnTypes } from './types-d8Mdj_jK.js';
|
|
5
|
+
export { I as InjectionLog, T as TrackInjectionsOptions, a as TrackedProvider, t as trackInjections } from './track-injections-DXoDu6sG.js';
|
|
6
|
+
export { A as AccessorImplementations, R as RestoreProp, c as countMockedProps, m as mockAccessorsProp, a as mockReadonlyProp, b as mockReadonlyPropGetter, d as mockValueProp, r as restoreMockedProps } from './prop-mock-B5TLaKCg.js';
|
|
7
|
+
export { C as CallbackSubscribable, E as EmissionObserver, a as EmissionOptions, b as EmissionSource, S as SubscribableLike, e as expectCompletion, f as expectEmission, g as expectEmissions, h as expectError, i as expectNoEmission, s as setEmissionTimeout } from './expect-emission-BhGKIi7_.js';
|
|
8
8
|
import '@angular/core/testing';
|
|
9
9
|
import 'rxjs';
|
|
10
10
|
|
package/dist/angular.js
CHANGED
|
@@ -380,6 +380,14 @@ Actual: ${actualCall(functionName, actualArgs)}`;
|
|
|
380
380
|
};
|
|
381
381
|
|
|
382
382
|
// src/lib/spy-decoration.ts
|
|
383
|
+
function detachedHelperError(helper) {
|
|
384
|
+
return new Error(
|
|
385
|
+
withDocs(
|
|
386
|
+
`[vitest-auto-spy] ${helper} was called off its spy: \`const { ${helper} } = spy.method\` loses the spy it configures. Call it as a method \u2014 spy.method.${helper}(\u2026) \u2014 or bind it first.`,
|
|
387
|
+
DOCS_LINKS.controlHelpers
|
|
388
|
+
)
|
|
389
|
+
);
|
|
390
|
+
}
|
|
383
391
|
function decorate(target, helpers) {
|
|
384
392
|
return Object.assign(target, helpers);
|
|
385
393
|
}
|
|
@@ -390,34 +398,35 @@ function toResolvedPerCallValues(valueConfigsPerCall) {
|
|
|
390
398
|
wrappedValue: config.delay === void 0 ? Promise.resolve(config.value) : new Promise((resolve) => setTimeout(() => resolve(config.value), config.delay))
|
|
391
399
|
}));
|
|
392
400
|
}
|
|
393
|
-
function
|
|
394
|
-
|
|
395
|
-
resolveWith
|
|
396
|
-
store({ value: Promise.resolve(value) });
|
|
401
|
+
function promiseHelpers(store) {
|
|
402
|
+
return {
|
|
403
|
+
resolveWith(value) {
|
|
404
|
+
store(this, { value: Promise.resolve(value) }, "resolveWith");
|
|
397
405
|
},
|
|
398
|
-
rejectWith
|
|
399
|
-
store({ value, _isRejectedPromise: true });
|
|
406
|
+
rejectWith(value) {
|
|
407
|
+
store(this, { value, _isRejectedPromise: true }, "rejectWith");
|
|
400
408
|
},
|
|
401
|
-
resolveWithPerCall
|
|
409
|
+
resolveWithPerCall(valueConfigsPerCall) {
|
|
402
410
|
if (valueConfigsPerCall.length === 0) {
|
|
403
411
|
return;
|
|
404
412
|
}
|
|
405
|
-
store({ value: void 0, valuesPerCalls: toResolvedPerCallValues(valueConfigsPerCall) });
|
|
413
|
+
store(this, { value: void 0, valuesPerCalls: toResolvedPerCallValues(valueConfigsPerCall) }, "resolveWithPerCall");
|
|
406
414
|
}
|
|
407
|
-
}
|
|
415
|
+
};
|
|
408
416
|
}
|
|
409
|
-
function
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
valueContainer.valuesPerCalls = container.valuesPerCalls ?? [];
|
|
415
|
-
});
|
|
417
|
+
function storePromiseConfig(valueContainer, container) {
|
|
418
|
+
valueContainer.value = container.value;
|
|
419
|
+
valueContainer._isRejectedPromise = container._isRejectedPromise ?? false;
|
|
420
|
+
valueContainer._isThrown = false;
|
|
421
|
+
valueContainer.valuesPerCalls = container.valuesPerCalls ?? [];
|
|
416
422
|
}
|
|
417
423
|
function addPromiseHelpersToCalledWithObject(calledWithObject, calledWithArgs) {
|
|
418
|
-
|
|
419
|
-
calledWithObject
|
|
420
|
-
|
|
424
|
+
decorate(
|
|
425
|
+
calledWithObject,
|
|
426
|
+
promiseHelpers((_self, container) => {
|
|
427
|
+
calledWithObject.argsToValuesMap.set(calledWithArgs, container);
|
|
428
|
+
})
|
|
429
|
+
);
|
|
421
430
|
}
|
|
422
431
|
|
|
423
432
|
// src/lib/settled-results.ts
|
|
@@ -467,11 +476,16 @@ function installSettledResultsPolyfill(mockFn) {
|
|
|
467
476
|
|
|
468
477
|
// src/lib/spy-mark.ts
|
|
469
478
|
var AUTO_SPY_MARK = /* @__PURE__ */ Symbol.for("vitest-auto-spy.mock");
|
|
470
|
-
var RESET_CONFIG = /* @__PURE__ */ Symbol.for("vitest-auto-spy.resetConfig");
|
|
471
|
-
var CLEAR_HOOK = /* @__PURE__ */ Symbol.for("vitest-auto-spy.clearHook");
|
|
472
479
|
var DEEP_CHILDREN = /* @__PURE__ */ Symbol.for("vitest-auto-spy.deepChildren");
|
|
473
|
-
function markAsMock(mock) {
|
|
474
|
-
Object.defineProperty(mock, AUTO_SPY_MARK, { value:
|
|
480
|
+
function markAsMock(mock, mark = true) {
|
|
481
|
+
Object.defineProperty(mock, AUTO_SPY_MARK, { value: mark, enumerable: false, configurable: true });
|
|
482
|
+
}
|
|
483
|
+
function isMarkHooks(value) {
|
|
484
|
+
return typeof value === "object" && value !== null && "reset" in value && "clear" in value;
|
|
485
|
+
}
|
|
486
|
+
function hooksOf(mock) {
|
|
487
|
+
const mark = Reflect.get(mock, AUTO_SPY_MARK);
|
|
488
|
+
return isMarkHooks(mark) ? mark : void 0;
|
|
475
489
|
}
|
|
476
490
|
function isAutoSpyLike(value) {
|
|
477
491
|
if (typeof value !== "object" || value === null) {
|
|
@@ -493,29 +507,11 @@ function readDeepChildren(value) {
|
|
|
493
507
|
}
|
|
494
508
|
return [...children.values()].filter(isMarkedMock);
|
|
495
509
|
}
|
|
496
|
-
function attachConfigReset(spy, reset2) {
|
|
497
|
-
Object.defineProperty(spy, RESET_CONFIG, { value: reset2, enumerable: false, configurable: true });
|
|
498
|
-
}
|
|
499
510
|
function runConfigReset(mock) {
|
|
500
|
-
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
const reset2 = Reflect.get(mock, RESET_CONFIG);
|
|
504
|
-
if (typeof reset2 === "function") {
|
|
505
|
-
reset2();
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
function attachClearHook(spy, clear) {
|
|
509
|
-
Object.defineProperty(spy, CLEAR_HOOK, { value: clear, enumerable: false, configurable: true });
|
|
511
|
+
hooksOf(mock)?.reset();
|
|
510
512
|
}
|
|
511
513
|
function runClearHook(mock) {
|
|
512
|
-
|
|
513
|
-
return;
|
|
514
|
-
}
|
|
515
|
-
const clear = Reflect.get(mock, CLEAR_HOOK);
|
|
516
|
-
if (typeof clear === "function") {
|
|
517
|
-
clear();
|
|
518
|
-
}
|
|
514
|
+
hooksOf(mock)?.clear();
|
|
519
515
|
}
|
|
520
516
|
|
|
521
517
|
// src/lib/function-spy.ts
|
|
@@ -610,6 +606,68 @@ function ensureCalledWithObject(state, chain) {
|
|
|
610
606
|
state[chain] = created;
|
|
611
607
|
return created;
|
|
612
608
|
}
|
|
609
|
+
var FunctionSpyInternals = class {
|
|
610
|
+
constructor(state, valueContainer, host, dispatch, recorder) {
|
|
611
|
+
this.state = state;
|
|
612
|
+
this.valueContainer = valueContainer;
|
|
613
|
+
this.host = host;
|
|
614
|
+
this.dispatch = dispatch;
|
|
615
|
+
this.recorder = recorder;
|
|
616
|
+
this.observable = void 0;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* `resetAutoSpy` reverts this spy's configuration; the state lives here, where the host runner's
|
|
620
|
+
* own reset cannot reach it. Clearing the container in place keeps the reference the mock
|
|
621
|
+
* implementation closed over.
|
|
622
|
+
*/
|
|
623
|
+
reset() {
|
|
624
|
+
const { state, valueContainer } = this;
|
|
625
|
+
delete state.calledWith;
|
|
626
|
+
delete state.mustBeCalledWith;
|
|
627
|
+
valueContainer.value = void 0;
|
|
628
|
+
delete valueContainer._isRejectedPromise;
|
|
629
|
+
delete valueContainer._isThrown;
|
|
630
|
+
delete valueContainer.valuesPerCalls;
|
|
631
|
+
this.observable?.reset();
|
|
632
|
+
getMockAdapter().restoreImplementation(this.host, this.dispatch);
|
|
633
|
+
}
|
|
634
|
+
/** Empties the polyfilled `settledResults` on `clearAutoSpy` / `resetAutoSpy` (a no-op on Vitest, where the host clears its native array). */
|
|
635
|
+
clear() {
|
|
636
|
+
this.recorder.clear();
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
function internalsOf(self, helper) {
|
|
640
|
+
const mark = typeof self === "function" || typeof self === "object" && self !== null ? Reflect.get(self, AUTO_SPY_MARK) : void 0;
|
|
641
|
+
if (mark instanceof FunctionSpyInternals) {
|
|
642
|
+
return mark;
|
|
643
|
+
}
|
|
644
|
+
throw detachedHelperError(helper);
|
|
645
|
+
}
|
|
646
|
+
var SPY_HELPERS = /* @__PURE__ */ Object.assign(
|
|
647
|
+
// The inner call carries its own mark: a pure annotation covers the call it precedes, not its
|
|
648
|
+
// arguments, and an unmarked argument call is evaluated — and everything it reaches kept.
|
|
649
|
+
/* @__PURE__ */ promiseHelpers((self, container, helper) => {
|
|
650
|
+
storePromiseConfig(internalsOf(self, helper).valueContainer, container);
|
|
651
|
+
}),
|
|
652
|
+
{
|
|
653
|
+
failWith(error) {
|
|
654
|
+
const { valueContainer } = internalsOf(this, "failWith");
|
|
655
|
+
valueContainer.value = error;
|
|
656
|
+
valueContainer._isThrown = true;
|
|
657
|
+
valueContainer._isRejectedPromise = false;
|
|
658
|
+
valueContainer.valuesPerCalls = [];
|
|
659
|
+
},
|
|
660
|
+
calledWith(...calledWithArgs) {
|
|
661
|
+
return addMethodsToCalledWith(ensureCalledWithObject(internalsOf(this, "calledWith").state, "calledWith"), calledWithArgs);
|
|
662
|
+
},
|
|
663
|
+
mustBeCalledWith(...calledWithArgs) {
|
|
664
|
+
return addMethodsToCalledWith(
|
|
665
|
+
ensureCalledWithObject(internalsOf(this, "mustBeCalledWith").state, "mustBeCalledWith"),
|
|
666
|
+
calledWithArgs
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
);
|
|
613
671
|
function createFunctionSpy(name, unstubbed) {
|
|
614
672
|
const valueContainer = { value: void 0 };
|
|
615
673
|
const state = { valueContainer };
|
|
@@ -621,46 +679,16 @@ function createFunctionSpy(name, unstubbed) {
|
|
|
621
679
|
const functionSpy = getMockAdapter().createMockFn(dispatch, name);
|
|
622
680
|
const recorder = installSettledResultsPolyfill(functionSpy);
|
|
623
681
|
settledResultsRecorder = recorder;
|
|
624
|
-
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
// The sync twin of `resolveWith` / `nextWith`, and the reason it is here rather than left to
|
|
628
|
-
// the runner: Vitest 4.1 grew `mockThrow`, but Bun and `node:test` have nothing like it, and
|
|
629
|
-
// no runtime has a way to make a *`calledWith` chain* throw — `mockImplementation` replaces the
|
|
630
|
-
// whole dispatch, which is the opposite of configuring one set of arguments.
|
|
631
|
-
//
|
|
632
|
-
// `failWith` and not `throwWith`, which is the name the shape asks for: `throwWith` is already
|
|
633
|
-
// the observable helper that *errors the stream*, it is attached to every spy at runtime (the
|
|
634
|
-
// return type that tells the two apart exists only in the types), and whichever is installed
|
|
635
|
-
// last wins. Sharing the name therefore breaks one of them on every spy in the run — which it
|
|
636
|
-
// did, loudly, the first time this was written that way.
|
|
637
|
-
failWith: (error) => {
|
|
638
|
-
valueContainer.value = error;
|
|
639
|
-
valueContainer._isThrown = true;
|
|
640
|
-
valueContainer._isRejectedPromise = false;
|
|
641
|
-
valueContainer.valuesPerCalls = [];
|
|
642
|
-
},
|
|
643
|
-
calledWith: (...calledWithArgs) => addMethodsToCalledWith(ensureCalledWithObject(state, "calledWith"), calledWithArgs),
|
|
644
|
-
mustBeCalledWith: (...calledWithArgs) => addMethodsToCalledWith(ensureCalledWithObject(state, "mustBeCalledWith"), calledWithArgs)
|
|
645
|
-
});
|
|
682
|
+
const internals = new FunctionSpyInternals(state, valueContainer, functionSpy, dispatch, recorder);
|
|
683
|
+
const spy = decorate(functionSpy, SPY_HELPERS);
|
|
684
|
+
internals.observable = getObservableSupport()?.addToFunctionSpy(spy, valueContainer);
|
|
646
685
|
getJasmineSupport()?.addToFunctionSpy(spy, {
|
|
647
686
|
name,
|
|
648
687
|
restoreDispatch: () => {
|
|
649
688
|
getMockAdapter().restoreImplementation(functionSpy, dispatch);
|
|
650
689
|
}
|
|
651
690
|
});
|
|
652
|
-
|
|
653
|
-
delete state.calledWith;
|
|
654
|
-
delete state.mustBeCalledWith;
|
|
655
|
-
valueContainer.value = void 0;
|
|
656
|
-
delete valueContainer._isRejectedPromise;
|
|
657
|
-
delete valueContainer._isThrown;
|
|
658
|
-
delete valueContainer.valuesPerCalls;
|
|
659
|
-
resetObservableStream?.();
|
|
660
|
-
getMockAdapter().restoreImplementation(functionSpy, dispatch);
|
|
661
|
-
});
|
|
662
|
-
attachClearHook(spy, () => recorder.clear());
|
|
663
|
-
markAsMock(spy);
|
|
691
|
+
markAsMock(spy, internals);
|
|
664
692
|
return exposeAsSpy(spy);
|
|
665
693
|
}
|
|
666
694
|
function exposeAsSpy(spy) {
|
|
@@ -921,6 +949,87 @@ function fillMissingMembers(autoSpy, unstubbed) {
|
|
|
921
949
|
}
|
|
922
950
|
});
|
|
923
951
|
}
|
|
952
|
+
|
|
953
|
+
// src/lib/lazy-spy-proxy.ts
|
|
954
|
+
var hasOwn = (target, key) => Object.prototype.hasOwnProperty.call(target, key);
|
|
955
|
+
function defineSpy(target, key, value) {
|
|
956
|
+
Object.defineProperty(target, key, { configurable: true, enumerable: true, writable: true, value });
|
|
957
|
+
}
|
|
958
|
+
function materialize(target, state, key) {
|
|
959
|
+
const spy = createFunctionSpy(key, state.unstubbed);
|
|
960
|
+
defineSpy(target, key, spy);
|
|
961
|
+
return spy;
|
|
962
|
+
}
|
|
963
|
+
function pendingDescriptor(target, state, key) {
|
|
964
|
+
return {
|
|
965
|
+
configurable: true,
|
|
966
|
+
enumerable: true,
|
|
967
|
+
get: () => materialize(target, state, key),
|
|
968
|
+
set: (value) => defineSpy(target, key, value)
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
function orderedKeys(target, state) {
|
|
972
|
+
const own = Reflect.ownKeys(target);
|
|
973
|
+
if (!Reflect.isExtensible(target)) {
|
|
974
|
+
return own;
|
|
975
|
+
}
|
|
976
|
+
const ownStrings = own.filter((key) => typeof key === "string");
|
|
977
|
+
const present = new Set(ownStrings);
|
|
978
|
+
return [
|
|
979
|
+
...state.preKeys.filter((key) => present.has(key)),
|
|
980
|
+
...[...state.names].filter((key) => state.isPending(key) || present.has(key)),
|
|
981
|
+
...ownStrings.filter((key) => !state.preSet.has(key) && !state.names.has(key)),
|
|
982
|
+
...own.filter((key) => typeof key === "symbol")
|
|
983
|
+
];
|
|
984
|
+
}
|
|
985
|
+
function createLazySpyProxy(autoSpy, methodNames, unstubbed) {
|
|
986
|
+
const preKeys = Reflect.ownKeys(autoSpy).filter((key) => typeof key === "string");
|
|
987
|
+
const state = {
|
|
988
|
+
// Insertion order doubles as declaration order for `ownKeys`, so no second array is retained.
|
|
989
|
+
names: new Set(methodNames),
|
|
990
|
+
// Only ever holds a name a caller explicitly deleted: without it, `delete spy.method` would leave
|
|
991
|
+
// the name pending again and the next read would resurrect it.
|
|
992
|
+
deleted: /* @__PURE__ */ new Set(),
|
|
993
|
+
preKeys,
|
|
994
|
+
preSet: new Set(preKeys),
|
|
995
|
+
unstubbed,
|
|
996
|
+
isPending: (key) => typeof key === "string" && state.names.has(key) && !state.deleted.has(key) && !hasOwn(autoSpy, key)
|
|
997
|
+
};
|
|
998
|
+
return new Proxy(autoSpy, {
|
|
999
|
+
get(target, key) {
|
|
1000
|
+
return state.isPending(key) ? materialize(target, state, key) : Reflect.get(target, key);
|
|
1001
|
+
},
|
|
1002
|
+
set(target, key, value) {
|
|
1003
|
+
if (state.isPending(key)) {
|
|
1004
|
+
defineSpy(target, key, value);
|
|
1005
|
+
return true;
|
|
1006
|
+
}
|
|
1007
|
+
return Reflect.set(target, key, value);
|
|
1008
|
+
},
|
|
1009
|
+
has(target, key) {
|
|
1010
|
+
return state.isPending(key) || Reflect.has(target, key);
|
|
1011
|
+
},
|
|
1012
|
+
getOwnPropertyDescriptor(target, key) {
|
|
1013
|
+
return state.isPending(key) ? pendingDescriptor(target, state, key) : Reflect.getOwnPropertyDescriptor(target, key);
|
|
1014
|
+
},
|
|
1015
|
+
deleteProperty(target, key) {
|
|
1016
|
+
const wasPending = state.isPending(key);
|
|
1017
|
+
if (typeof key === "string" && state.names.has(key)) {
|
|
1018
|
+
state.deleted.add(key);
|
|
1019
|
+
}
|
|
1020
|
+
return wasPending || Reflect.deleteProperty(target, key);
|
|
1021
|
+
},
|
|
1022
|
+
ownKeys: (target) => orderedKeys(target, state),
|
|
1023
|
+
preventExtensions(target) {
|
|
1024
|
+
state.names.forEach((key) => {
|
|
1025
|
+
if (state.isPending(key)) {
|
|
1026
|
+
materialize(target, state, key);
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
return Reflect.preventExtensions(target);
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
924
1033
|
var EMPTY_CONFIGURATION = {
|
|
925
1034
|
methodsToSpyOn: [],
|
|
926
1035
|
onlyMethodsToSpyOn: [],
|
|
@@ -1134,15 +1243,18 @@ function assembleSpy(ObjectClass, config) {
|
|
|
1134
1243
|
});
|
|
1135
1244
|
warnOnAccessorNamingAMethod(ObjectClass, config);
|
|
1136
1245
|
createAccessorsSpies(autoSpy, accessors.getters, accessors.setters);
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1246
|
+
if (config.lazySpies !== "proxy") {
|
|
1247
|
+
methodNames.forEach((methodName) => {
|
|
1248
|
+
if (config.lazySpies) {
|
|
1249
|
+
defineLazyMethodSpy(autoSpy, methodName, unstubbed);
|
|
1250
|
+
} else {
|
|
1251
|
+
autoSpy[methodName] = createFunctionSpy(methodName, unstubbed);
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1144
1255
|
attachDispose(autoSpy);
|
|
1145
|
-
|
|
1256
|
+
const assembled = config.lazySpies === "proxy" ? createLazySpyProxy(autoSpy, methodNames, unstubbed) : autoSpy;
|
|
1257
|
+
return config.fillMissing ? fillMissingMembers(assembled, unstubbed) : assembled;
|
|
1146
1258
|
}
|
|
1147
1259
|
function hasNothingToRead(ObjectClass, accessors, config) {
|
|
1148
1260
|
return getAllMethodNames(ObjectClass.prototype).length === 0 && accessors.getters.length === 0 && accessors.setters.length === 0 && config.observablePropsToSpyOn.length === 0 && // A *restricting* list asks for the opposite of what the proxy provides. `onlyMethodsToSpyOn`
|
package/dist/bun-angular.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { d as AccessorKeysOf, e as AddAccessorsSpies, f as AddCalledWithObservable, g as AddCalledWithPromise, h as AddCalledWithSpyMethods, A as AddObservableSpyMethods, i as AddPromiseSpyMethods, j as AddSpyMethodsByReturnTypes, k as AddThrowHelper, l as AddVoidReturnHelpers, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, D as DeepMockProxy, m as DeepPartial, E as ErrorValueConfig, F as Func, M as MethodReturns, n as Mutable, N as NextValueConfig, O as OnlyMethodKeysOf, o as OnlyObservablePropsOf, p as OnlyPropsOf, q as Overload, r as Overloads, P as PropStubValue, S as Spy, s as SpyDisposable, t as SpyOptions, u as StrictSpyConfiguration, U as UnstubbedCall, v as UnstubbedCallHandler, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { d as AccessorKeysOf, e as AddAccessorsSpies, f as AddCalledWithObservable, g as AddCalledWithPromise, h as AddCalledWithSpyMethods, A as AddObservableSpyMethods, i as AddPromiseSpyMethods, j as AddSpyMethodsByReturnTypes, k as AddThrowHelper, l as AddVoidReturnHelpers, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, D as DeepMockProxy, m as DeepPartial, E as ErrorValueConfig, F as Func, M as MethodReturns, n as Mutable, N as NextValueConfig, O as OnlyMethodKeysOf, o as OnlyObservablePropsOf, p as OnlyPropsOf, q as Overload, r as Overloads, P as PropStubValue, S as Spy, s as SpyDisposable, t as SpyOptions, u as StrictSpyConfiguration, U as UnstubbedCall, v as UnstubbedCallHandler, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-d8Mdj_jK.js';
|
|
2
2
|
export { ArgCaptor, AsInstances, AssertMockedOptions, ConstructorMock, ConstructorSpy, FixtureFactory, FlushUntilOptions, IntersectionObserverStubOptions, MediaElementState, MediaElementStub, MediaElementStubOptions, MockDeepOptions, ModuleNamespace, ModuleNamespaceOptions, MutationRecordInit, ObserverGlobal, ObserverInstance, ObserverStub, ObserverStubOptions, ResizeEntryRect, TestRunComparison, TestRunReport, TestRunSummary, asInstance, asInstances, asSpy, assertMocked, captureArg, clearAutoSpy, compareTestRuns, createFixture, createFixtureFactory, createFunctionSpy, createMock, createSpyClass, createSpyFromClass, diffByField, errorHandler, flushEventLoop, flushEventLoopUntil, formatTestRunComparison, intersectionEntry, mockConstructor, mockDeep, moduleNamespace, mutationRecord, narrow, resetAutoSpy, resizeEntry, settleDynamicImport, stubAbortController, stubConstructor, stubIntersectionObserver, stubMediaElement, stubMutationObserver, stubObserver, stubResizeObserver, summarizeTestRun, withOverrides } from './bun.js';
|
|
3
|
-
export { A as AutoMockConfiguration, C as CallbackSubscribable, E as EmissionObserver, a as EmissionOptions, b as EmissionSource, S as SubscribableLike, c as autoMocked, d as createAutoMock, e as expectCompletion, f as expectEmission, g as expectEmissions, h as expectError, i as expectNoEmission, s as setEmissionTimeout } from './expect-emission-
|
|
4
|
-
export { A as AccessorImplementations, R as RestoreProp, c as countMockedProps, m as mockAccessorsProp, a as mockReadonlyProp, b as mockReadonlyPropGetter, d as mockValueProp, r as restoreMockedProps } from './prop-mock-
|
|
3
|
+
export { A as AutoMockConfiguration, C as CallbackSubscribable, E as EmissionObserver, a as EmissionOptions, b as EmissionSource, S as SubscribableLike, c as autoMocked, d as createAutoMock, e as expectCompletion, f as expectEmission, g as expectEmissions, h as expectError, i as expectNoEmission, s as setEmissionTimeout } from './expect-emission-BhGKIi7_.js';
|
|
4
|
+
export { A as AccessorImplementations, R as RestoreProp, c as countMockedProps, m as mockAccessorsProp, a as mockReadonlyProp, b as mockReadonlyPropGetter, d as mockValueProp, r as restoreMockedProps } from './prop-mock-B5TLaKCg.js';
|
|
5
5
|
export { d as describeDuplicateCopies, g as getPackageCopies } from './package-identity-B1pqa-Sh.js';
|
|
6
|
-
export { A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, R as RenderShallowOptions, c as ResourceStatusLike, S as SettleResourceOptions, d as ShallowRender, e as SpyRegistry, f as StableOptions, g as createWithAutoSpies, h as flushEffects, i as injectSpy, p as provideAutoSpy, r as renderShallow, j as runEffect, s as settleResource, k as stable } from './zoneless-
|
|
6
|
+
export { A as AngularValueProvider, a as AutoSpiedInstance, C as ComponentInputs, b as CreateWithAutoSpiesOptions, R as RenderShallowOptions, c as ResourceStatusLike, S as SettleResourceOptions, d as ShallowRender, e as SpyRegistry, f as StableOptions, g as createWithAutoSpies, h as flushEffects, i as injectSpy, p as provideAutoSpy, r as renderShallow, j as runEffect, s as settleResource, k as stable } from './zoneless-BxqMRfiJ.js';
|
|
7
7
|
import 'rxjs';
|
|
8
8
|
import 'vitest';
|
|
9
9
|
import '@angular/core';
|
package/dist/bun-angular.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import './chunk-Y4YG7UOK.js';
|
|
2
|
-
import { createSpyForToken } from './chunk-
|
|
2
|
+
import { createSpyForToken } from './chunk-BNZFNS42.js';
|
|
3
3
|
import './chunk-NQXXUJPS.js';
|
|
4
|
-
export { asInstance, asInstances, asSpy, assertMocked, captureArg, compareTestRuns, createFixture, createFixtureFactory, createMock, createSpyClass, describeDuplicateCopies, diffByField, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, formatTestRunComparison, getPackageCopies, intersectionEntry, mockConstructor, mockDeep, moduleNamespace, mutationRecord, narrow, resizeEntry, setEmissionTimeout, settleDynamicImport, stubAbortController, stubConstructor, stubIntersectionObserver, stubMediaElement, stubMutationObserver, stubObserver, stubResizeObserver, summarizeTestRun, withOverrides } from './chunk-
|
|
5
|
-
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-
|
|
6
|
-
import { createSpyFromClass } from './chunk-
|
|
7
|
-
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-
|
|
4
|
+
export { asInstance, asInstances, asSpy, assertMocked, captureArg, compareTestRuns, createFixture, createFixtureFactory, createMock, createSpyClass, describeDuplicateCopies, diffByField, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, formatTestRunComparison, getPackageCopies, intersectionEntry, mockConstructor, mockDeep, moduleNamespace, mutationRecord, narrow, resizeEntry, setEmissionTimeout, settleDynamicImport, stubAbortController, stubConstructor, stubIntersectionObserver, stubMediaElement, stubMutationObserver, stubObserver, stubResizeObserver, summarizeTestRun, withOverrides } from './chunk-YXHG5DXF.js';
|
|
5
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-MMKKLL5J.js';
|
|
6
|
+
import { createSpyFromClass } from './chunk-3EHP3NKE.js';
|
|
7
|
+
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-3EHP3NKE.js';
|
|
8
8
|
import './chunk-PC3FAZT3.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import './chunk-J5O72UHX.js';
|
|
9
|
+
export { createFunctionSpy, errorHandler } from './chunk-52DZMI55.js';
|
|
10
|
+
import { withDocs, DOCS_LINKS, isAutoSpyLike } from './chunk-4K5F2NVN.js';
|
|
12
11
|
import '@angular/compiler';
|
|
13
12
|
import { NgModule, provideZonelessChangeDetection, Injector, runInInjectionContext, NO_ERRORS_SCHEMA, ApplicationRef, ɵSIGNAL as _SIGNAL } from '@angular/core';
|
|
14
13
|
import { getTestBed, TestBed } from '@angular/core/testing';
|
package/dist/bun.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as SpyOptions, C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf, S as Spy, m as DeepPartial, D as DeepMockProxy, F as Func, v as UnstubbedCallHandler, j as AddSpyMethodsByReturnTypes } from './types-
|
|
2
|
-
export { d as AccessorKeysOf, e as AddAccessorsSpies, f as AddCalledWithObservable, g as AddCalledWithPromise, h as AddCalledWithSpyMethods, A as AddObservableSpyMethods, i as AddPromiseSpyMethods, k as AddThrowHelper, l as AddVoidReturnHelpers, b as CompleteValueConfig, E as ErrorValueConfig, M as MethodReturns, n as Mutable, N as NextValueConfig, o as OnlyObservablePropsOf, p as OnlyPropsOf, q as Overload, r as Overloads, P as PropStubValue, s as SpyDisposable, u as StrictSpyConfiguration, U as UnstubbedCall, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
3
|
-
export { A as AutoMockConfiguration, C as CallbackSubscribable, E as EmissionObserver, a as EmissionOptions, b as EmissionSource, S as SubscribableLike, c as autoMocked, d as createAutoMock, e as expectCompletion, f as expectEmission, g as expectEmissions, h as expectError, i as expectNoEmission, s as setEmissionTimeout } from './expect-emission-
|
|
4
|
-
export { A as AccessorImplementations, R as RestoreProp, c as countMockedProps, m as mockAccessorsProp, a as mockReadonlyProp, b as mockReadonlyPropGetter, d as mockValueProp, r as restoreMockedProps } from './prop-mock-
|
|
1
|
+
import { t as SpyOptions, C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf, S as Spy, m as DeepPartial, D as DeepMockProxy, F as Func, v as UnstubbedCallHandler, j as AddSpyMethodsByReturnTypes } from './types-d8Mdj_jK.js';
|
|
2
|
+
export { d as AccessorKeysOf, e as AddAccessorsSpies, f as AddCalledWithObservable, g as AddCalledWithPromise, h as AddCalledWithSpyMethods, A as AddObservableSpyMethods, i as AddPromiseSpyMethods, k as AddThrowHelper, l as AddVoidReturnHelpers, b as CompleteValueConfig, E as ErrorValueConfig, M as MethodReturns, n as Mutable, N as NextValueConfig, o as OnlyObservablePropsOf, p as OnlyPropsOf, q as Overload, r as Overloads, P as PropStubValue, s as SpyDisposable, u as StrictSpyConfiguration, U as UnstubbedCall, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-d8Mdj_jK.js';
|
|
3
|
+
export { A as AutoMockConfiguration, C as CallbackSubscribable, E as EmissionObserver, a as EmissionOptions, b as EmissionSource, S as SubscribableLike, c as autoMocked, d as createAutoMock, e as expectCompletion, f as expectEmission, g as expectEmissions, h as expectError, i as expectNoEmission, s as setEmissionTimeout } from './expect-emission-BhGKIi7_.js';
|
|
4
|
+
export { A as AccessorImplementations, R as RestoreProp, c as countMockedProps, m as mockAccessorsProp, a as mockReadonlyProp, b as mockReadonlyPropGetter, d as mockValueProp, r as restoreMockedProps } from './prop-mock-B5TLaKCg.js';
|
|
5
5
|
export { d as describeDuplicateCopies, g as getPackageCopies } from './package-identity-B1pqa-Sh.js';
|
|
6
6
|
import { Mock } from 'vitest';
|
|
7
7
|
import 'rxjs';
|
package/dist/bun.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import './chunk-Y4YG7UOK.js';
|
|
2
2
|
import './chunk-NQXXUJPS.js';
|
|
3
|
-
export { asInstance, asInstances, asSpy, assertMocked, captureArg, compareTestRuns, createFixture, createFixtureFactory, createMock, createSpyClass, describeDuplicateCopies, diffByField, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, formatTestRunComparison, getPackageCopies, intersectionEntry, mockConstructor, mockDeep, moduleNamespace, mutationRecord, narrow, resizeEntry, setEmissionTimeout, settleDynamicImport, stubAbortController, stubConstructor, stubIntersectionObserver, stubMediaElement, stubMutationObserver, stubObserver, stubResizeObserver, summarizeTestRun, withOverrides } from './chunk-
|
|
4
|
-
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-
|
|
5
|
-
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-
|
|
3
|
+
export { asInstance, asInstances, asSpy, assertMocked, captureArg, compareTestRuns, createFixture, createFixtureFactory, createMock, createSpyClass, describeDuplicateCopies, diffByField, expectCompletion, expectEmission, expectEmissions, expectError, expectNoEmission, flushEventLoop, flushEventLoopUntil, formatTestRunComparison, getPackageCopies, intersectionEntry, mockConstructor, mockDeep, moduleNamespace, mutationRecord, narrow, resizeEntry, setEmissionTimeout, settleDynamicImport, stubAbortController, stubConstructor, stubIntersectionObserver, stubMediaElement, stubMutationObserver, stubObserver, stubResizeObserver, summarizeTestRun, withOverrides } from './chunk-YXHG5DXF.js';
|
|
4
|
+
export { countMockedProps, mockAccessorsProp, mockReadonlyProp, mockReadonlyPropGetter, mockValueProp, restoreMockedProps } from './chunk-MMKKLL5J.js';
|
|
5
|
+
export { autoMocked, clearAutoSpy, createAutoMock, createSpyFromClass, resetAutoSpy } from './chunk-3EHP3NKE.js';
|
|
6
6
|
import './chunk-PC3FAZT3.js';
|
|
7
|
-
export { createFunctionSpy, errorHandler } from './chunk-
|
|
8
|
-
import './chunk-
|
|
7
|
+
export { createFunctionSpy, errorHandler } from './chunk-52DZMI55.js';
|
|
8
|
+
import './chunk-4K5F2NVN.js';
|