vitest-auto-spy 1.7.0 → 1.8.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/README.md +18 -2
- package/assets/angular-provide-auto-spy.svg +63 -0
- package/assets/one-api-three-runtimes.svg +51 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +1 -1
- package/dist/angular.d.ts +1 -1
- package/dist/angular.js +1 -1
- package/dist/bun.cjs +1 -1
- package/dist/bun.d.cts +2 -2
- package/dist/bun.d.ts +2 -2
- package/dist/bun.js +1 -1
- package/dist/{chunk-BCLT4UUA.js → chunk-HVN6A3AX.js} +1 -1
- package/dist/{chunk-PEAFUJBQ.js → chunk-MQCVIN2A.js} +1 -1
- package/dist/chunk-WP2TFS53.js +1 -0
- package/dist/console.cjs +1 -1
- package/dist/console.d.cts +1 -1
- package/dist/console.d.ts +1 -1
- package/dist/console.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/nestjs.cjs +1 -1
- package/dist/nestjs.d.cts +1 -1
- package/dist/nestjs.d.ts +1 -1
- package/dist/nestjs.js +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/rxjs.d.cts +2 -2
- package/dist/rxjs.d.ts +2 -2
- package/dist/svelte.cjs +1 -1
- package/dist/svelte.d.cts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +1 -1
- package/dist/{types-C84-zP_V.d.ts → types-Cv3L71P0.d.cts} +6 -1
- package/dist/{types-C84-zP_V.d.cts → types-Cv3L71P0.d.ts} +6 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +1 -1
- package/package.json +3 -1
- package/dist/chunk-CUVWIHH5.js +0 -1
package/README.md
CHANGED
|
@@ -25,6 +25,10 @@ replacement for [`jest-auto-spies`](https://www.npmjs.com/package/jest-auto-spie
|
|
|
25
25
|
|
|
26
26
|
📦 [**npm**](https://www.npmjs.com/package/vitest-auto-spy) · 🐙 [**GitHub**](https://github.com/ASDAlexey/vitest-auto-spy) · 🔖 [**Changelog**](./CHANGELOG.md)
|
|
27
27
|
|
|
28
|
+
<br/>
|
|
29
|
+
|
|
30
|
+
<img src="./assets/one-api-three-runtimes.svg" alt="One class-based API, three Vitest-compatible runtimes: Vitest, Bun and node:test" width="720" />
|
|
31
|
+
|
|
28
32
|
</div>
|
|
29
33
|
|
|
30
34
|
---
|
|
@@ -95,7 +99,7 @@ them only for the matching entry point. The package itself has **zero runtime de
|
|
|
95
99
|
| Peer | Needed for | Optional? |
|
|
96
100
|
| --- | --- | --- |
|
|
97
101
|
| `vitest` | the default runner | no |
|
|
98
|
-
| `rxjs` | `vitest-auto-spy/rxjs` observable spies (and `Spy<T>` type-checking) | yes |
|
|
102
|
+
| `rxjs` | `vitest-auto-spy/rxjs` observable spies (and `Spy<T>` type-checking) — `>=7`, **no upper bound** (the rxjs 8 line included) | yes |
|
|
99
103
|
| `@angular/core` | `vitest-auto-spy/angular` helpers | yes |
|
|
100
104
|
|
|
101
105
|
## Availability
|
|
@@ -259,8 +263,9 @@ import { createSpyFromClass } from 'vitest-auto-spy/node'; // node:test
|
|
|
259
263
|
|
|
260
264
|
| Library | Reads a class? | Return-type-aware helpers? | Runtimes | We win on |
|
|
261
265
|
| --- | :---: | :---: | --- | --- |
|
|
262
|
-
| **vitest-auto-spy** | ✅ | ✅ | Vitest
|
|
266
|
+
| **vitest-auto-spy** | ✅ | ✅ | Vitest · Bun · node:test | — |
|
|
263
267
|
| [jest-auto-spies](https://www.npmjs.com/package/jest-auto-spies) | ✅ | ✅ | Jest only | Vitest/Bun/Node successor, **same API** — direct migration path |
|
|
268
|
+
| [@bugsplat/vitest-auto-spies](https://www.npmjs.com/package/@bugsplat/vitest-auto-spies) | ✅ | ✅ | Vitest only | Same class-based API **plus** Bun & `node:test`, [type-only `createAutoMock`](#auto-mock-by-type-no-class-needed), framework recipes (Angular/NestJS/React/Vue/Svelte), console spies, and **zero runtime deps** (it depends on `@hirez_io/auto-spies-core`) |
|
|
264
269
|
| [vitest-mock-extended](https://www.npmjs.com/package/vitest-mock-extended) | ❌ (Proxy) | ❌ | Vitest | Return-type ergonomics **and** reading a real class (we also ship a Proxy mode: [`createAutoMock`](#auto-mock-by-type-no-class-needed)) |
|
|
265
270
|
| [@golevelup/ts-vitest](https://www.npmjs.com/package/@golevelup/ts-vitest) | partial | ❌ | Vitest | Typed `Promise`/`Observable` helpers + explicit class→spy + `mustBeCalledWith` |
|
|
266
271
|
| [sinon](https://www.npmjs.com/package/sinon) | ❌ (manual) | ❌ | Any | Auto-generated + fully typed vs. manual + loosely typed |
|
|
@@ -284,11 +289,16 @@ The public API is intentionally identical. In most projects the migration is a
|
|
|
284
289
|
The only API-shape change from `jest-auto-spies` is that the Angular helpers and the
|
|
285
290
|
observable layer live behind the `/angular` and `/rxjs` subpaths (see [Entry points & runtimes](#entry-points--runtimes)).
|
|
286
291
|
|
|
292
|
+
This also covers migrating from [`@bugsplat/vitest-auto-spies`](https://www.npmjs.com/package/@bugsplat/vitest-auto-spies),
|
|
293
|
+
which re-exports the same `jest-auto-spies` API — the swap is identical, and you gain Bun /
|
|
294
|
+
`node:test`, `createAutoMock`, framework recipes and console spies on top.
|
|
295
|
+
|
|
287
296
|
| jest-auto-spies | vitest-auto-spy | Status |
|
|
288
297
|
| --- | --- | --- |
|
|
289
298
|
| `createSpyFromClass` | `createSpyFromClass` | ✅ identical |
|
|
290
299
|
| `provideAutoSpy` | `provideAutoSpy` | ✅ identical |
|
|
291
300
|
| `calledWith` / `mustBeCalledWith` | same | ✅ identical |
|
|
301
|
+
| `calledWith(...).returnValue(v)` | same — `.returnValue` **and** `.mockReturnValue` both work | ✅ identical |
|
|
292
302
|
| `resolveWith` / `rejectWith` / `resolveWithPerCall` | same | ✅ identical |
|
|
293
303
|
| `nextWith` / `nextOneTimeWith` / `nextWithValues` / `nextWithPerCall` | same | ✅ identical |
|
|
294
304
|
| `throwWith` / `complete` / `returnSubject` | same | ✅ identical |
|
|
@@ -593,6 +603,12 @@ it('shows the cart total from the store', () => {
|
|
|
593
603
|
|
|
594
604
|
### Angular
|
|
595
605
|
|
|
606
|
+
<div align="center">
|
|
607
|
+
|
|
608
|
+
<img src="./assets/angular-provide-auto-spy.svg" alt="Angular TestBed recipe: provideAutoSpy registers a typed spy provider and injectSpy returns Spy<ApiService> — no manual { provide, useValue }, no TestBed.inject<any> cast" width="720" />
|
|
609
|
+
|
|
610
|
+
</div>
|
|
611
|
+
|
|
596
612
|
`provideAutoSpy` is the shorthand for providing an auto-spy in a `TestBed`:
|
|
597
613
|
|
|
598
614
|
```ts
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="840" height="320" viewBox="0 0 840 320" font-family="ui-sans-serif, -apple-system, Segoe UI, Roboto, sans-serif" role="img" aria-label="Angular TestBed: provideAutoSpy registers a typed spy provider and injectSpy returns Spy<ApiService> — no manual provide/useValue, no TestBed.inject<any>">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="acard" x1="0" y1="0" x2="0" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#ffffff"/>
|
|
5
|
+
<stop offset="1" stop-color="#f4f6fb"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<style>
|
|
8
|
+
@media (prefers-color-scheme: dark) {
|
|
9
|
+
.abg { fill: #0d1117; }
|
|
10
|
+
.acard { fill: #161b22; stroke: #30363d; }
|
|
11
|
+
.atitle { fill: #e6edf3; }
|
|
12
|
+
.asub { fill: #8b949e; }
|
|
13
|
+
.acode { fill: #e6edf3; }
|
|
14
|
+
.aarrow { stroke: #6e7681; }
|
|
15
|
+
.achip { fill: #1f6feb22; stroke: #388bfd; }
|
|
16
|
+
.achipText { fill: #58a6ff; }
|
|
17
|
+
.abad { fill: #2ea04326; stroke: #3fb950; }
|
|
18
|
+
.abadText { fill: #3fb950; }
|
|
19
|
+
}
|
|
20
|
+
</style>
|
|
21
|
+
</defs>
|
|
22
|
+
|
|
23
|
+
<rect class="abg" width="840" height="320" fill="#ffffff" rx="16"/>
|
|
24
|
+
|
|
25
|
+
<text class="atitle" x="40" y="52" font-size="26" font-weight="700" fill="#0d1117">Angular · TestBed recipe</text>
|
|
26
|
+
<text class="asub" x="40" y="78" font-size="15" fill="#57606a">provideAutoSpy + injectSpy — a typed spy provider, zero boilerplate.</text>
|
|
27
|
+
|
|
28
|
+
<!-- providers -->
|
|
29
|
+
<rect class="acard" x="40" y="108" width="330" height="76" rx="12" fill="url(#acard)" stroke="#d0d7de"/>
|
|
30
|
+
<text class="asub" x="62" y="132" font-size="12" fill="#57606a">providers:</text>
|
|
31
|
+
<text class="acode" x="62" y="158" font-size="15" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" fill="#0d1117">provideAutoSpy(</text>
|
|
32
|
+
<text class="acode" x="62" y="178" font-size="15" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" fill="#0d1117">  ApiService)</text>
|
|
33
|
+
|
|
34
|
+
<!-- arrow 1 -->
|
|
35
|
+
<line class="aarrow" x1="378" y1="146" x2="452" y2="146" stroke="#8c959f" stroke-width="2"/>
|
|
36
|
+
<polygon points="452,141 464,146 452,151" fill="#8c959f"/>
|
|
37
|
+
|
|
38
|
+
<!-- injectSpy -->
|
|
39
|
+
<rect class="acard" x="472" y="108" width="328" height="76" rx="12" fill="url(#acard)" stroke="#d0d7de"/>
|
|
40
|
+
<text class="acode" x="494" y="142" font-size="15" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" fill="#0d1117">injectSpy(ApiService)</text>
|
|
41
|
+
<text class="atitle" x="494" y="168" font-size="15" font-weight="600" fill="#0d1117">: Spy<ApiService></text>
|
|
42
|
+
|
|
43
|
+
<!-- what you DON'T write -->
|
|
44
|
+
<g>
|
|
45
|
+
<rect class="abad" x="40" y="216" width="378" height="42" rx="21" fill="#dafbe1" stroke="#4ac26b"/>
|
|
46
|
+
<text class="abadText" x="229" y="242" font-size="14" font-weight="600" text-anchor="middle" fill="#1a7f37">no manual { provide, useValue }</text>
|
|
47
|
+
|
|
48
|
+
<rect class="abad" x="430" y="216" width="370" height="42" rx="21" fill="#dafbe1" stroke="#4ac26b"/>
|
|
49
|
+
<text class="abadText" x="615" y="242" font-size="14" font-weight="600" text-anchor="middle" fill="#1a7f37">no TestBed.inject<any> cast</text>
|
|
50
|
+
</g>
|
|
51
|
+
|
|
52
|
+
<!-- frameworks sharing the recipe -->
|
|
53
|
+
<g>
|
|
54
|
+
<rect class="achip" x="40" y="272" width="240" height="34" rx="17" fill="#ddf4ff" stroke="#54aeff"/>
|
|
55
|
+
<text class="achipText" x="160" y="294" font-size="14" font-weight="600" text-anchor="middle" fill="#0969da">Angular</text>
|
|
56
|
+
|
|
57
|
+
<rect class="achip" x="300" y="272" width="240" height="34" rx="17" fill="#ddf4ff" stroke="#54aeff"/>
|
|
58
|
+
<text class="achipText" x="420" y="294" font-size="14" font-weight="600" text-anchor="middle" fill="#0969da">NestJS</text>
|
|
59
|
+
|
|
60
|
+
<rect class="achip" x="560" y="272" width="240" height="34" rx="17" fill="#ddf4ff" stroke="#54aeff"/>
|
|
61
|
+
<text class="achipText" x="680" y="294" font-size="14" font-weight="600" text-anchor="middle" fill="#0969da">Vue · Pinia</text>
|
|
62
|
+
</g>
|
|
63
|
+
</svg>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="840" height="300" viewBox="0 0 840 300" font-family="ui-sans-serif, -apple-system, Segoe UI, Roboto, sans-serif" role="img" aria-label="One class-based API, three Vitest-compatible runtimes: Vitest, Bun, node:test">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="card" x1="0" y1="0" x2="0" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#ffffff"/>
|
|
5
|
+
<stop offset="1" stop-color="#f4f6fb"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<style>
|
|
8
|
+
@media (prefers-color-scheme: dark) {
|
|
9
|
+
.bg { fill: #0d1117; }
|
|
10
|
+
.card { fill: #161b22; stroke: #30363d; }
|
|
11
|
+
.title { fill: #e6edf3; }
|
|
12
|
+
.sub { fill: #8b949e; }
|
|
13
|
+
.code { fill: #e6edf3; }
|
|
14
|
+
.arrow { stroke: #6e7681; }
|
|
15
|
+
.chip { fill: #1f6feb22; stroke: #388bfd; }
|
|
16
|
+
.chipText { fill: #58a6ff; }
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</defs>
|
|
20
|
+
|
|
21
|
+
<rect class="bg" width="840" height="300" fill="#ffffff" rx="16"/>
|
|
22
|
+
|
|
23
|
+
<text class="title" x="40" y="56" font-size="30" font-weight="700" fill="#0d1117">vitest-auto-spy</text>
|
|
24
|
+
<text class="sub" x="40" y="84" font-size="16" fill="#57606a">One class-based API. Every Vitest-compatible runtime.</text>
|
|
25
|
+
|
|
26
|
+
<!-- source call -->
|
|
27
|
+
<rect class="card" x="40" y="120" width="330" height="70" rx="12" fill="url(#card)" stroke="#d0d7de"/>
|
|
28
|
+
<text class="code" x="62" y="153" font-size="16" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" fill="#0d1117">createSpyFromClass(</text>
|
|
29
|
+
<text class="code" x="62" y="176" font-size="16" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" fill="#0d1117">  UserService)</text>
|
|
30
|
+
|
|
31
|
+
<!-- arrow -->
|
|
32
|
+
<line class="arrow" x1="378" y1="155" x2="470" y2="155" stroke="#8c959f" stroke-width="2"/>
|
|
33
|
+
<polygon points="470,150 482,155 470,160" fill="#8c959f"/>
|
|
34
|
+
|
|
35
|
+
<!-- fully-typed spy -->
|
|
36
|
+
<rect class="card" x="490" y="120" width="310" height="70" rx="12" fill="url(#card)" stroke="#d0d7de"/>
|
|
37
|
+
<text class="title" x="512" y="150" font-size="16" font-weight="600" fill="#0d1117">Spy<UserService></text>
|
|
38
|
+
<text class="sub" x="512" y="174" font-size="13" fill="#57606a">typed methods + resolveWith / nextWith / calledWith</text>
|
|
39
|
+
|
|
40
|
+
<!-- runtime chips -->
|
|
41
|
+
<g>
|
|
42
|
+
<rect class="chip" x="40" y="228" width="240" height="46" rx="23" fill="#ddf4ff" stroke="#54aeff"/>
|
|
43
|
+
<text class="chipText" x="160" y="257" font-size="17" font-weight="600" text-anchor="middle" fill="#0969da">Vitest</text>
|
|
44
|
+
|
|
45
|
+
<rect class="chip" x="300" y="228" width="240" height="46" rx="23" fill="#ddf4ff" stroke="#54aeff"/>
|
|
46
|
+
<text class="chipText" x="420" y="257" font-size="17" font-weight="600" text-anchor="middle" fill="#0969da">Bun  (bun:test)</text>
|
|
47
|
+
|
|
48
|
+
<rect class="chip" x="560" y="228" width="240" height="46" rx="23" fill="#ddf4ff" stroke="#54aeff"/>
|
|
49
|
+
<text class="chipText" x="680" y="257" font-size="17" font-weight="600" text-anchor="middle" fill="#0969da">node:test</text>
|
|
50
|
+
</g>
|
|
51
|
+
</svg>
|
package/dist/angular.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var vitest=require('vitest'),testing=require('@angular/core/testing');var y;function b(e){y=e;}var
|
|
1
|
+
'use strict';var vitest=require('vitest'),testing=require('@angular/core/testing');var y;function b(e){y=e;}var E="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function a(){if(!y)throw new Error(E);return y}var k={createMockFn(e,t){let r=e?vitest.vi.fn(e):vitest.vi.fn();return t!==void 0&&r.mockName(t),r},spyOnGetter(e,t){return vitest.vi.spyOn(e,t,"get")},spyOnSetter(e,t){return vitest.vi.spyOn(e,t,"set")},getCalls(e){return e.mock.calls},reset(e){e.mockReset();}};function T(e,t){Object.defineProperty(e,t,{get(){},set(r){},configurable:true});}function S(e,t,r){let n=a();return r==="setter"?n.spyOnSetter(e,t):n.spyOnGetter(e,t)}function O(e,t,r){let n={getters:{},setters:{}};e.accessorSpies=n,t.forEach(o=>{T(e,o),n.getters[o]=S(e,o,"getter");}),r.forEach(o=>{Object.prototype.hasOwnProperty.call(e,o)||T(e,o),n.setters[o]=S(e,o,"setter");});}function _(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function $(e,t){return Object.entries(e).map(([r,n])=>`${r}:${c(n,t)}`).join(",")}function H(e,t){return `new Map([${[...e.entries()].map(([n,o])=>`[${c(n,t)},${c(o,t)}]`).join(",")}])`}function K(e,t){if(t.has(e))return "[Circular]";t.add(e);let r;return e instanceof Date?r=`new Date(${e.getTime()})`:e instanceof Map?r=H(e,t):e instanceof Set?r=`new Set([${[...e].map(n=>c(n,t)).join(",")}])`:Array.isArray(e)?r=`[${e.map(n=>c(n,t)).join(",")}]`:r=`{${$(e,t)}}`,t.delete(e),r}function c(e,t=new WeakSet){return typeof e=="string"?_(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?K(e,t):Object.is(e,-0)?"-0":String(e)}var f=class{#e={};set(t,r){this.#e[this.#t(t)]=r;}get(t){return this.#e[this.#t(t)]}#t(t){return c(t)}};var z=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,B="But the function was called without any arguments.",G=e=>{let t=c(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},j={throwArgumentsError(e,t){let r=e.length===0?B:G(e);throw new Error(z(t)+r)}};var I="Observable spies require rxjs. Import 'vitest-auto-spy/rxjs' once (e.g. in your test setup) to enable observablePropsToSpyOn / nextWith / nextWithValues / throwWith / complete / returnSubject.";function C(){throw new Error(I);}function u(e,t){return Object.assign(e,t)}function D(e){return e.map(t=>({wrappedValue:t.delay===void 0?Promise.resolve(t.value):new Promise(r=>setTimeout(()=>r(t.value),t.delay))}))}function h(e,t){u(e,{resolveWith:r=>{t({value:Promise.resolve(r)});},rejectWith:r=>{t({value:r,_isRejectedPromise:true});},resolveWithPerCall:r=>{r.length!==0&&t({value:void 0,valuesPerCalls:D(r)});}});}function w(e,t){h(e,r=>{t.value=r.value,t._isRejectedPromise=r._isRejectedPromise??false,t.valuesPerCalls=r.valuesPerCalls??[];});}function M(e,t){h(e,r=>{e.argsToValuesMap.set(t,r);});}function q(e){return typeof e=="object"&&e!==null&&"value"in e}function F(e){if(e._isRejectedPromise)return Promise.reject(e.value);let t=e.valuesPerCalls?.shift();return t?t.wrappedValue:e.value}function v(e,t){let r=e.argsToValuesMap.get(t);return q(r)?{found:true,value:F(r)}:{found:false,value:void 0}}function N(e,t,r,n,o){if(e.wasConfigured){let s=v(e,n);if(s.found)return s.value}if(t.wasConfigured){let s=v(t,n);if(s.found)return s.value;j.throwArgumentsError(n,o);}return F(r)}function P(e,t){e.wasConfigured=true;let r=n=>{e.argsToValuesMap.set(t,{value:n});};return u(e,{mockReturnValue:r,returnValue:r}),M(e,t),e}function A(){return {wasConfigured:false,argsToValuesMap:new f}}function R(e){let t=A(),r=A(),n={value:void 0},o=a().createMockFn((...i)=>N(t,r,n,i,e),e);w(o,n);let s=u(o,{calledWith:(...i)=>P(t,i),mustBeCalledWith:(...i)=>P(r,i)});return s}var x={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function U(e){let t=Object.getOwnPropertyDescriptors(e);return Object.keys(t).filter(r=>r!=="constructor"&&!t[r]?.get)}var V=new WeakMap;function L(e){let t=V.get(e);if(t)return t;let r=new Set,n=e;for(;n;){let s=Object.getPrototypeOf(n);s&&U(n).forEach(i=>r.add(i)),n=s;}let o=[...r];return V.set(e,o),o}function J(e){return e?Array.isArray(e)?{...x,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...x}}function W(e,t){let{methodsToSpyOn:r,observablePropsToSpyOn:n,settersToSpyOn:o,gettersToSpyOn:s}=J(t),i=r.length>0?r:L(e.prototype),p={};return n.forEach(l=>{p[l]=C().createPropSpy();}),O(p,s,o),i.forEach(l=>{p[l]=R(l);}),p}function Y(e,t){return {provide:e,useValue:W(e,t)}}function Q(e){return testing.TestBed.inject(e)}function Z(e,t,r){Object.defineProperty(e,t,{get:()=>r,configurable:true});}function ee(e,t,r){Object.defineProperty(e,t,{get:r,configurable:true});}function te(e,t){let r=a();Object.defineProperty(e,t,{get:r.createMockFn(),set:r.createMockFn(),configurable:true});}b(k);exports.injectSpy=Q;exports.mockAccessorsProp=te;exports.mockReadonlyProp=Z;exports.mockReadonlyPropGetter=ee;exports.provideAutoSpy=Y;
|
package/dist/angular.d.cts
CHANGED
package/dist/angular.d.ts
CHANGED
package/dist/angular.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-6LFQMHSX.js';import {a as a$2}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-6LFQMHSX.js';import {a as a$2}from'./chunk-WP2TFS53.js';import {a,c as c$1}from'./chunk-MQCVIN2A.js';import'./chunk-7IUYJ6ZW.js';import {TestBed}from'@angular/core/testing';function c(e,o){return {provide:e,useValue:a$2(e,o)}}function s(e){return TestBed.inject(e)}function y(e,o,r){Object.defineProperty(e,o,{get:()=>r,configurable:true});}function d(e,o,r){Object.defineProperty(e,o,{get:r,configurable:true});}function u(e,o){let r=c$1();Object.defineProperty(e,o,{get:r.createMockFn(),set:r.createMockFn(),configurable:true});}a(a$1);export{s as injectSpy,u as mockAccessorsProp,y as mockReadonlyProp,d as mockReadonlyPropGetter,c as provideAutoSpy};
|
package/dist/bun.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var bun_test=require('bun:test');function S({createMockFn:e,getCalls:t,reset:r}){return {createMockFn:e,spyOnGetter:(o,n)=>b(e,o,n,"get"),spyOnSetter:(o,n)=>b(e,o,n,"set"),getCalls:t,reset:r}}function b(e,t,r,o){let n=Object.getOwnPropertyDescriptor(t,r),s=o==="get"?n?.get:n?.set,i=e(s),c={configurable:true,enumerable:n?.enumerable??true};return n?.get&&(c.get=n.get),n?.set&&(c.set=n.set),o==="get"?c.get=i:c.set=i,Object.defineProperty(t,r,c),i}function w(e){return S({createMockFn:(r,o)=>{let n=e.mock(r??(()=>{}));return o!==void 0&&n.mockName&&n.mockName(o),n},getCalls:r=>r.mock.calls,reset:r=>r.mockReset()})}var y;function M(e){y=e;}var
|
|
1
|
+
'use strict';var bun_test=require('bun:test');function S({createMockFn:e,getCalls:t,reset:r}){return {createMockFn:e,spyOnGetter:(o,n)=>b(e,o,n,"get"),spyOnSetter:(o,n)=>b(e,o,n,"set"),getCalls:t,reset:r}}function b(e,t,r,o){let n=Object.getOwnPropertyDescriptor(t,r),s=o==="get"?n?.get:n?.set,i=e(s),c={configurable:true,enumerable:n?.enumerable??true};return n?.get&&(c.get=n.get),n?.set&&(c.set=n.set),o==="get"?c.get=i:c.set=i,Object.defineProperty(t,r,c),i}function w(e){return S({createMockFn:(r,o)=>{let n=e.mock(r??(()=>{}));return o!==void 0&&n.mockName&&n.mockName(o),n},getCalls:r=>r.mock.calls,reset:r=>r.mockReset()})}var y;function M(e){y=e;}var E="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function d(){if(!y)throw new Error(E);return y}function h(e,t){Object.defineProperty(e,t,{get(){},set(r){},configurable:true});}function O(e,t,r){let o=d();return r==="setter"?o.spyOnSetter(e,t):o.spyOnGetter(e,t)}function T(e,t,r){let o={getters:{},setters:{}};e.accessorSpies=o,t.forEach(n=>{h(e,n),o.getters[n]=O(e,n,"getter");}),r.forEach(n=>{Object.prototype.hasOwnProperty.call(e,n)||h(e,n),o.setters[n]=O(e,n,"setter");});}function _(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function B(e,t){return Object.entries(e).map(([r,o])=>`${r}:${a(o,t)}`).join(",")}function H(e,t){return `new Map([${[...e.entries()].map(([o,n])=>`[${a(o,t)},${a(n,t)}]`).join(",")}])`}function $(e,t){if(t.has(e))return "[Circular]";t.add(e);let r;return e instanceof Date?r=`new Date(${e.getTime()})`:e instanceof Map?r=H(e,t):e instanceof Set?r=`new Set([${[...e].map(o=>a(o,t)).join(",")}])`:Array.isArray(e)?r=`[${e.map(o=>a(o,t)).join(",")}]`:r=`{${B(e,t)}}`,t.delete(e),r}function a(e,t=new WeakSet){return typeof e=="string"?_(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?$(e,t):Object.is(e,-0)?"-0":String(e)}var f=class{#e={};set(t,r){this.#e[this.#t(t)]=r;}get(t){return this.#e[this.#t(t)]}#t(t){return a(t)}};var z=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,D="But the function was called without any arguments.",I=e=>{let t=a(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},m={throwArgumentsError(e,t){let r=e.length===0?D:I(e);throw new Error(z(t)+r)}};var G="Observable spies require rxjs. Import 'vitest-auto-spy/rxjs' once (e.g. in your test setup) to enable observablePropsToSpyOn / nextWith / nextWithValues / throwWith / complete / returnSubject.";function C(){throw new Error(G);}function u(e,t){return Object.assign(e,t)}function K(e){return e.map(t=>({wrappedValue:t.delay===void 0?Promise.resolve(t.value):new Promise(r=>setTimeout(()=>r(t.value),t.delay))}))}function j(e,t){u(e,{resolveWith:r=>{t({value:Promise.resolve(r)});},rejectWith:r=>{t({value:r,_isRejectedPromise:true});},resolveWithPerCall:r=>{r.length!==0&&t({value:void 0,valuesPerCalls:K(r)});}});}function F(e,t){j(e,r=>{t.value=r.value,t._isRejectedPromise=r._isRejectedPromise??false,t.valuesPerCalls=r.valuesPerCalls??[];});}function A(e,t){j(e,r=>{e.argsToValuesMap.set(t,r);});}function N(e){return typeof e=="object"&&e!==null&&"value"in e}function x(e){if(e._isRejectedPromise)return Promise.reject(e.value);let t=e.valuesPerCalls?.shift();return t?t.wrappedValue:e.value}function P(e,t){let r=e.argsToValuesMap.get(t);return N(r)?{found:true,value:x(r)}:{found:false,value:void 0}}function q(e,t,r,o,n){if(e.wasConfigured){let s=P(e,o);if(s.found)return s.value}if(t.wasConfigured){let s=P(t,o);if(s.found)return s.value;m.throwArgumentsError(o,n);}return x(r)}function R(e,t){e.wasConfigured=true;let r=o=>{e.argsToValuesMap.set(t,{value:o});};return u(e,{mockReturnValue:r,returnValue:r}),A(e,t),e}function v(){return {wasConfigured:false,argsToValuesMap:new f}}function p(e){let t=v(),r=v(),o={value:void 0},n=d().createMockFn((...i)=>q(t,r,o,i,e),e);F(n,o);let s=u(n,{calledWith:(...i)=>R(t,i),mustBeCalledWith:(...i)=>R(r,i)});return s}var V={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function U(e){let t=Object.getOwnPropertyDescriptors(e);return Object.keys(t).filter(r=>r!=="constructor"&&!t[r]?.get)}var W=new WeakMap;function L(e){let t=W.get(e);if(t)return t;let r=new Set,o=e;for(;o;){let s=Object.getPrototypeOf(o);s&&U(o).forEach(i=>r.add(i)),o=s;}let n=[...r];return W.set(e,n),n}function J(e){return e?Array.isArray(e)?{...V,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...V}}function X(e,t){let{methodsToSpyOn:r,observablePropsToSpyOn:o,settersToSpyOn:n,gettersToSpyOn:s}=J(t),i=r.length>0?r:L(e.prototype),c={};return o.forEach(l=>{c[l]=C().createPropSpy();}),T(c,s,n),i.forEach(l=>{c[l]=p(l);}),c}function Y(e={}){let t=new Map;for(let o of Reflect.ownKeys(e))t.set(o,Reflect.get(e,o));let r={get(o,n){if(t.has(n))return t.get(n);if(typeof n=="symbol"||n==="then"||n==="constructor")return;let s=p(String(n));return t.set(n,s),s},set(o,n,s){return t.set(n,s),true},has(o,n){return t.has(n)},ownKeys(){return [...t.keys()]},getOwnPropertyDescriptor(o,n){if(t.has(n))return {configurable:true,enumerable:true,value:t.get(n),writable:true}}};return new Proxy({},r)}M(w({mock:bun_test.mock}));exports.createAutoMock=Y;exports.createFunctionSpy=p;exports.createSpyFromClass=X;exports.errorHandler=m;
|
package/dist/bun.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf, S as Spy, F as Func, i as AddSpyMethodsByReturnTypes } from './types-
|
|
2
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, b as CompleteValueConfig, E as ErrorValueConfig, N as NextValueConfig, j as OnlyObservablePropsOf, k as OnlyPropsOf, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
import { C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf, S as Spy, F as Func, i as AddSpyMethodsByReturnTypes } from './types-Cv3L71P0.cjs';
|
|
2
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, b as CompleteValueConfig, E as ErrorValueConfig, N as NextValueConfig, j as OnlyObservablePropsOf, k as OnlyPropsOf, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.cjs';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
|
5
5
|
|
package/dist/bun.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf, S as Spy, F as Func, i as AddSpyMethodsByReturnTypes } from './types-
|
|
2
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, b as CompleteValueConfig, E as ErrorValueConfig, N as NextValueConfig, j as OnlyObservablePropsOf, k as OnlyPropsOf, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
import { C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf, S as Spy, F as Func, i as AddSpyMethodsByReturnTypes } from './types-Cv3L71P0.js';
|
|
2
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, b as CompleteValueConfig, E as ErrorValueConfig, N as NextValueConfig, j as OnlyObservablePropsOf, k as OnlyPropsOf, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.js';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
|
5
5
|
|
package/dist/bun.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-IPBQZ4JC.js';export{a as createAutoMock}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-IPBQZ4JC.js';export{a as createAutoMock}from'./chunk-HVN6A3AX.js';export{a as createSpyFromClass}from'./chunk-WP2TFS53.js';import {a}from'./chunk-MQCVIN2A.js';export{e as createFunctionSpy,d as errorHandler}from'./chunk-MQCVIN2A.js';import'./chunk-7IUYJ6ZW.js';import {mock}from'bun:test';function r(k){return a$1({createMockFn:(o,n)=>{let e=k.mock(o??(()=>{}));return n!==void 0&&e.mockName&&e.mockName(n),e},getCalls:o=>o.mock.calls,reset:o=>o.mockReset()})}a(r({mock:mock}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e}from'./chunk-
|
|
1
|
+
import {e}from'./chunk-MQCVIN2A.js';function s(u={}){let r=new Map;for(let t of Reflect.ownKeys(u))r.set(t,Reflect.get(u,t));let a={get(t,e$1){if(r.has(e$1))return r.get(e$1);if(typeof e$1=="symbol"||e$1==="then"||e$1==="constructor")return;let n=e(String(e$1));return r.set(e$1,n),n},set(t,e,n){return r.set(e,n),true},has(t,e){return r.has(e)},ownKeys(){return [...r.keys()]},getOwnPropertyDescriptor(t,e){if(r.has(e))return {configurable:true,enumerable:true,value:r.get(e),writable:true}}};return new Proxy({},a)}export{s as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b as b$1,d as d$1}from'./chunk-7IUYJ6ZW.js';var c;function W(e){c=e;}function x(){return c!==void 0}var b="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function d(){if(!c)throw new Error(b);return c}function j(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function M(e,t){return Object.entries(e).map(([n,r])=>`${n}:${o(r,t)}`).join(",")}function T(e,t){return `new Map([${[...e.entries()].map(([r,i])=>`[${o(r,t)},${o(i,t)}]`).join(",")}])`}function S(e,t){if(t.has(e))return "[Circular]";t.add(e);let n;return e instanceof Date?n=`new Date(${e.getTime()})`:e instanceof Map?n=T(e,t):e instanceof Set?n=`new Set([${[...e].map(r=>o(r,t)).join(",")}])`:Array.isArray(e)?n=`[${e.map(r=>o(r,t)).join(",")}]`:n=`{${M(e,t)}}`,t.delete(e),n}function o(e,t=new WeakSet){return typeof e=="string"?j(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?S(e,t):Object.is(e,-0)?"-0":String(e)}var V=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,F="But the function was called without any arguments.",P=e=>{let t=o(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},f={throwArgumentsError(e,t){let n=e.length===0?F:P(e);throw new Error(V(t)+n)}};var l=class{#e={};set(t,n){this.#e[this.#t(t)]=n;}get(t){return this.#e[this.#t(t)]}#t(t){return o(t)}};function
|
|
1
|
+
import {b as b$1,d as d$1}from'./chunk-7IUYJ6ZW.js';var c;function W(e){c=e;}function x(){return c!==void 0}var b="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function d(){if(!c)throw new Error(b);return c}function j(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function M(e,t){return Object.entries(e).map(([n,r])=>`${n}:${o(r,t)}`).join(",")}function T(e,t){return `new Map([${[...e.entries()].map(([r,i])=>`[${o(r,t)},${o(i,t)}]`).join(",")}])`}function S(e,t){if(t.has(e))return "[Circular]";t.add(e);let n;return e instanceof Date?n=`new Date(${e.getTime()})`:e instanceof Map?n=T(e,t):e instanceof Set?n=`new Set([${[...e].map(r=>o(r,t)).join(",")}])`:Array.isArray(e)?n=`[${e.map(r=>o(r,t)).join(",")}]`:n=`{${M(e,t)}}`,t.delete(e),n}function o(e,t=new WeakSet){return typeof e=="string"?j(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?S(e,t):Object.is(e,-0)?"-0":String(e)}var V=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,F="But the function was called without any arguments.",P=e=>{let t=o(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},f={throwArgumentsError(e,t){let n=e.length===0?F:P(e);throw new Error(V(t)+n)}};var l=class{#e={};set(t,n){this.#e[this.#t(t)]=n;}get(t){return this.#e[this.#t(t)]}#t(t){return o(t)}};function R(e){return e.map(t=>({wrappedValue:t.delay===void 0?Promise.resolve(t.value):new Promise(n=>setTimeout(()=>n(t.value),t.delay))}))}function m(e,t){d$1(e,{resolveWith:n=>{t({value:Promise.resolve(n)});},rejectWith:n=>{t({value:n,_isRejectedPromise:true});},resolveWithPerCall:n=>{n.length!==0&&t({value:void 0,valuesPerCalls:R(n)});}});}function g(e,t){m(e,n=>{t.value=n.value,t._isRejectedPromise=n._isRejectedPromise??false,t.valuesPerCalls=n.valuesPerCalls??[];});}function y(e,t){m(e,n=>{e.argsToValuesMap.set(t,n);});}function A(e){return typeof e=="object"&&e!==null&&"value"in e}function h(e){if(e._isRejectedPromise)return Promise.reject(e.value);let t=e.valuesPerCalls?.shift();return t?t.wrappedValue:e.value}function k(e,t){let n=e.argsToValuesMap.get(t);return A(n)?{found:true,value:h(n)}:{found:false,value:void 0}}function O(e,t,n,r,i){if(e.wasConfigured){let u=k(e,r);if(u.found)return u.value}if(t.wasConfigured){let u=k(t,r);if(u.found)return u.value;f.throwArgumentsError(r,i);}return h(n)}function w(e,t){e.wasConfigured=true;let n=r=>{e.argsToValuesMap.set(t,{value:r});};return d$1(e,{mockReturnValue:n,returnValue:n}),y(e,t),b$1()?.addToCalledWithObject(e,t),e}function C(){return {wasConfigured:false,argsToValuesMap:new l}}function K(e){let t=C(),n=C(),r={value:void 0},i=d().createMockFn((...a)=>O(t,n,r,a,e),e);g(i,r),b$1()?.addToFunctionSpy(i,r);let u=d$1(i,{calledWith:(...a)=>w(t,a),mustBeCalledWith:(...a)=>w(n,a)});return u}export{W as a,x as b,d as c,f as d,K as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {e,c as c$1}from'./chunk-MQCVIN2A.js';import {c}from'./chunk-7IUYJ6ZW.js';function u(e,t){Object.defineProperty(e,t,{get(){},set(r){},configurable:true});}function f(e,t,r){let s=c$1();return r==="setter"?s.spyOnSetter(e,t):s.spyOnGetter(e,t)}function l(e,t,r){let s={getters:{},setters:{}};e.accessorSpies=s,t.forEach(o=>{u(e,o),s.getters[o]=f(e,o,"getter");}),r.forEach(o=>{Object.prototype.hasOwnProperty.call(e,o)||u(e,o),s.setters[o]=f(e,o,"setter");});}var d={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function S(e){let t=Object.getOwnPropertyDescriptors(e);return Object.keys(t).filter(r=>r!=="constructor"&&!t[r]?.get)}var O=new WeakMap;function T(e){let t=O.get(e);if(t)return t;let r=new Set,s=e;for(;s;){let n=Object.getPrototypeOf(s);n&&S(s).forEach(p=>r.add(p)),s=n;}let o=[...r];return O.set(e,o),o}function b(e){return e?Array.isArray(e)?{...d,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...d}}function M(e$1,t){let{methodsToSpyOn:r,observablePropsToSpyOn:s,settersToSpyOn:o,gettersToSpyOn:n}=b(t),p=r.length>0?r:T(e$1.prototype),c$1={};return s.forEach(i=>{c$1[i]=c().createPropSpy();}),l(c$1,n,o),p.forEach(i=>{c$1[i]=e(i);}),c$1}export{M as a};
|
package/dist/console.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var vitest=require('vitest');function
|
|
1
|
+
'use strict';var vitest=require('vitest');function A(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function W(e,o){return Object.entries(e).map(([t,n])=>`${t}:${r(n,o)}`).join(",")}function P(e,o){return `new Map([${[...e.entries()].map(([n,s])=>`[${r(n,o)},${r(s,o)}]`).join(",")}])`}function E(e,o){if(o.has(e))return "[Circular]";o.add(e);let t;return e instanceof Date?t=`new Date(${e.getTime()})`:e instanceof Map?t=P(e,o):e instanceof Set?t=`new Set([${[...e].map(n=>r(n,o)).join(",")}])`:Array.isArray(e)?t=`[${e.map(n=>r(n,o)).join(",")}]`:t=`{${W(e,o)}}`,o.delete(e),t}function r(e,o=new WeakSet){return typeof e=="string"?A(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?E(e,o):Object.is(e,-0)?"-0":String(e)}var l=class{#e={};set(o,t){this.#e[this.#o(o)]=t;}get(o){return this.#e[this.#o(o)]}#o(o){return r(o)}};var $=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,_="But the function was called without any arguments.",H=e=>{let o=r(e);return `But the actual arguments were: ${o.substring(1,o.length-1)}`},M={throwArgumentsError(e,o){let t=e.length===0?_:H(e);throw new Error($(o)+t)}};var d;function k(e){d=e;}function b(){return d!==void 0}var B="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function f(){if(!d)throw new Error(B);return d}function u(e,o){return Object.assign(e,o)}function I(e){return e.map(o=>({wrappedValue:o.delay===void 0?Promise.resolve(o.value):new Promise(t=>setTimeout(()=>t(o.value),o.delay))}))}function h(e,o){u(e,{resolveWith:t=>{o({value:Promise.resolve(t)});},rejectWith:t=>{o({value:t,_isRejectedPromise:true});},resolveWithPerCall:t=>{t.length!==0&&o({value:void 0,valuesPerCalls:I(t)});}});}function w(e,o){h(e,t=>{o.value=t.value,o._isRejectedPromise=t._isRejectedPromise??false,o.valuesPerCalls=t.valuesPerCalls??[];});}function j(e,o){h(e,t=>{e.argsToValuesMap.set(o,t);});}function D(e){return typeof e=="object"&&e!==null&&"value"in e}function O(e){if(e._isRejectedPromise)return Promise.reject(e.value);let o=e.valuesPerCalls?.shift();return o?o.wrappedValue:e.value}function T(e,o){let t=e.argsToValuesMap.get(o);return D(t)?{found:true,value:O(t)}:{found:false,value:void 0}}function G(e,o,t,n,s){if(e.wasConfigured){let p=T(e,n);if(p.found)return p.value}if(o.wasConfigured){let p=T(o,n);if(p.found)return p.value;M.throwArgumentsError(n,s);}return O(t)}function F(e,o){e.wasConfigured=true;let t=n=>{e.argsToValuesMap.set(o,{value:n});};return u(e,{mockReturnValue:t,returnValue:t}),j(e,o),e}function v(){return {wasConfigured:false,argsToValuesMap:new l}}function x(e){let o=v(),t=v(),n={value:void 0},s=f().createMockFn((...a)=>G(o,t,n,a,e),e);w(s,n);let p=u(s,{calledWith:(...a)=>F(o,a),mustBeCalledWith:(...a)=>F(t,a)});return p}var S=new Map,C=new Map,c;function L(e){return console[e]}function R(e,o){console[e]=o;}function i(e){S.set(e,L(e));let o=x(`console.${e}`);return R(e,o),C.set(e,o),o}function g(){return c||(c={consoleDebugSpy:i("debug"),consoleErrorSpy:i("error"),consoleInfoSpy:i("info"),consoleLogSpy:i("log"),consoleTimeEndSpy:i("timeEnd"),consoleTimeSpy:i("time"),consoleTraceSpy:i("trace"),consoleWarnSpy:i("warn")},c)}function N(){let e=f();for(let o of C.values())e.reset(o);}function q(){for(let[e,o]of S)R(e,o);S.clear(),C.clear(),c=void 0;}var V={createMockFn(e,o){let t=e?vitest.vi.fn(e):vitest.vi.fn();return o!==void 0&&t.mockName(o),t},spyOnGetter(e,o){return vitest.vi.spyOn(e,o,"get")},spyOnSetter(e,o){return vitest.vi.spyOn(e,o,"set")},getCalls(e){return e.mock.calls},reset(e){e.mockReset();}};b()||k(V);var {consoleDebugSpy:ge,consoleErrorSpy:Me,consoleInfoSpy:ke,consoleLogSpy:be,consoleTimeEndSpy:he,consoleTimeSpy:we,consoleTraceSpy:je,consoleWarnSpy:Te}=g();exports.consoleDebugSpy=ge;exports.consoleErrorSpy=Me;exports.consoleInfoSpy=ke;exports.consoleLogSpy=be;exports.consoleTimeEndSpy=he;exports.consoleTimeSpy=we;exports.consoleTraceSpy=je;exports.consoleWarnSpy=Te;exports.installConsoleSpies=g;exports.resetConsoleSpies=N;exports.restoreConsole=q;
|
package/dist/console.d.cts
CHANGED
package/dist/console.d.ts
CHANGED
package/dist/console.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-6LFQMHSX.js';import {b as b$1,a as a$1,e,c}from'./chunk-
|
|
1
|
+
import {a as a$2}from'./chunk-6LFQMHSX.js';import {b as b$1,a as a$1,e,c}from'./chunk-MQCVIN2A.js';import'./chunk-7IUYJ6ZW.js';var t=new Map,p=new Map,s;function a(o){return console[o]}function y(o,e){console[o]=e;}function n(o){t.set(o,a(o));let e$1=e(`console.${o}`);return y(o,e$1),p.set(o,e$1),e$1}function l(){return s||(s={consoleDebugSpy:n("debug"),consoleErrorSpy:n("error"),consoleInfoSpy:n("info"),consoleLogSpy:n("log"),consoleTimeEndSpy:n("timeEnd"),consoleTimeSpy:n("time"),consoleTraceSpy:n("trace"),consoleWarnSpy:n("warn")},s)}function C(){let o=c();for(let e of p.values())o.reset(e);}function M(){for(let[o,e]of t)y(o,e);t.clear(),p.clear(),s=void 0;}b$1()||a$1(a$2);var {consoleDebugSpy:x,consoleErrorSpy:E,consoleInfoSpy:F,consoleLogSpy:v,consoleTimeEndSpy:b,consoleTimeSpy:A,consoleTraceSpy:k,consoleWarnSpy:w}=l();export{x as consoleDebugSpy,E as consoleErrorSpy,F as consoleInfoSpy,v as consoleLogSpy,b as consoleTimeEndSpy,A as consoleTimeSpy,k as consoleTraceSpy,w as consoleWarnSpy,l as installConsoleSpies,C as resetConsoleSpies,M as restoreConsole};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var vitest=require('vitest');var g;function S(e){g=e;}var
|
|
1
|
+
'use strict';var vitest=require('vitest');var g;function S(e){g=e;}var W="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function d(){if(!g)throw new Error(W);return g}var w={createMockFn(e,t){let r=e?vitest.vi.fn(e):vitest.vi.fn();return t!==void 0&&r.mockName(t),r},spyOnGetter(e,t){return vitest.vi.spyOn(e,t,"get")},spyOnSetter(e,t){return vitest.vi.spyOn(e,t,"set")},getCalls(e){return e.mock.calls},reset(e){e.mockReset();}};function h(e,t){Object.defineProperty(e,t,{get(){},set(r){},configurable:true});}function O(e,t,r){let n=d();return r==="setter"?n.spyOnSetter(e,t):n.spyOnGetter(e,t)}function T(e,t,r){let n={getters:{},setters:{}};e.accessorSpies=n,t.forEach(o=>{h(e,o),n.getters[o]=O(e,o,"getter");}),r.forEach(o=>{Object.prototype.hasOwnProperty.call(e,o)||h(e,o),n.setters[o]=O(e,o,"setter");});}function E(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function _(e,t){return Object.entries(e).map(([r,n])=>`${r}:${u(n,t)}`).join(",")}function H(e,t){return `new Map([${[...e.entries()].map(([n,o])=>`[${u(n,t)},${u(o,t)}]`).join(",")}])`}function $(e,t){if(t.has(e))return "[Circular]";t.add(e);let r;return e instanceof Date?r=`new Date(${e.getTime()})`:e instanceof Map?r=H(e,t):e instanceof Set?r=`new Set([${[...e].map(n=>u(n,t)).join(",")}])`:Array.isArray(e)?r=`[${e.map(n=>u(n,t)).join(",")}]`:r=`{${_(e,t)}}`,t.delete(e),r}function u(e,t=new WeakSet){return typeof e=="string"?E(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?$(e,t):Object.is(e,-0)?"-0":String(e)}var y=class{#e={};set(t,r){this.#e[this.#t(t)]=r;}get(t){return this.#e[this.#t(t)]}#t(t){return u(t)}};var z=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,B="But the function was called without any arguments.",I=e=>{let t=u(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},m={throwArgumentsError(e,t){let r=e.length===0?B:I(e);throw new Error(z(t)+r)}};var G="Observable spies require rxjs. Import 'vitest-auto-spy/rxjs' once (e.g. in your test setup) to enable observablePropsToSpyOn / nextWith / nextWithValues / throwWith / complete / returnSubject.";function M(){throw new Error(G);}function c(e,t){return Object.assign(e,t)}function K(e){return e.map(t=>({wrappedValue:t.delay===void 0?Promise.resolve(t.value):new Promise(r=>setTimeout(()=>r(t.value),t.delay))}))}function j(e,t){c(e,{resolveWith:r=>{t({value:Promise.resolve(r)});},rejectWith:r=>{t({value:r,_isRejectedPromise:true});},resolveWithPerCall:r=>{r.length!==0&&t({value:void 0,valuesPerCalls:K(r)});}});}function C(e,t){j(e,r=>{t.value=r.value,t._isRejectedPromise=r._isRejectedPromise??false,t.valuesPerCalls=r.valuesPerCalls??[];});}function v(e,t){j(e,r=>{e.argsToValuesMap.set(t,r);});}function D(e){return typeof e=="object"&&e!==null&&"value"in e}function A(e){if(e._isRejectedPromise)return Promise.reject(e.value);let t=e.valuesPerCalls?.shift();return t?t.wrappedValue:e.value}function F(e,t){let r=e.argsToValuesMap.get(t);return D(r)?{found:true,value:A(r)}:{found:false,value:void 0}}function q(e,t,r,n,o){if(e.wasConfigured){let s=F(e,n);if(s.found)return s.value}if(t.wasConfigured){let s=F(t,n);if(s.found)return s.value;m.throwArgumentsError(n,o);}return A(r)}function P(e,t){e.wasConfigured=true;let r=n=>{e.argsToValuesMap.set(t,{value:n});};return c(e,{mockReturnValue:r,returnValue:r}),v(e,t),e}function R(){return {wasConfigured:false,argsToValuesMap:new y}}function a(e){let t=R(),r=R(),n={value:void 0},o=d().createMockFn((...i)=>q(t,r,n,i,e),e);C(o,n);let s=c(o,{calledWith:(...i)=>P(t,i),mustBeCalledWith:(...i)=>P(r,i)});return s}var x={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function N(e){let t=Object.getOwnPropertyDescriptors(e);return Object.keys(t).filter(r=>r!=="constructor"&&!t[r]?.get)}var V=new WeakMap;function U(e){let t=V.get(e);if(t)return t;let r=new Set,n=e;for(;n;){let s=Object.getPrototypeOf(n);s&&N(n).forEach(i=>r.add(i)),n=s;}let o=[...r];return V.set(e,o),o}function L(e){return e?Array.isArray(e)?{...x,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...x}}function J(e,t){let{methodsToSpyOn:r,observablePropsToSpyOn:n,settersToSpyOn:o,gettersToSpyOn:s}=L(t),i=r.length>0?r:U(e.prototype),p={};return n.forEach(l=>{p[l]=M().createPropSpy();}),T(p,s,o),i.forEach(l=>{p[l]=a(l);}),p}function X(e={}){let t=new Map;for(let n of Reflect.ownKeys(e))t.set(n,Reflect.get(e,n));let r={get(n,o){if(t.has(o))return t.get(o);if(typeof o=="symbol"||o==="then"||o==="constructor")return;let s=a(String(o));return t.set(o,s),s},set(n,o,s){return t.set(o,s),true},has(n,o){return t.has(o)},ownKeys(){return [...t.keys()]},getOwnPropertyDescriptor(n,o){if(t.has(o))return {configurable:true,enumerable:true,value:t.get(o),writable:true}}};return new Proxy({},r)}S(w);exports.createAutoMock=X;exports.createFunctionSpy=a;exports.createSpyFromClass=J;exports.errorHandler=m;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.cjs';
|
|
2
2
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.cjs';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.js';
|
|
2
2
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.js';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-6LFQMHSX.js';export{a as createAutoMock}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-6LFQMHSX.js';export{a as createAutoMock}from'./chunk-HVN6A3AX.js';export{a as createSpyFromClass}from'./chunk-WP2TFS53.js';import {a}from'./chunk-MQCVIN2A.js';export{e as createFunctionSpy,d as errorHandler}from'./chunk-MQCVIN2A.js';import'./chunk-7IUYJ6ZW.js';a(a$1);
|
package/dist/nestjs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var vitest=require('vitest');var y;function b(e){y=e;}var
|
|
1
|
+
'use strict';var vitest=require('vitest');var y;function b(e){y=e;}var E="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function l(){if(!y)throw new Error(E);return y}var k={createMockFn(e,t){let r=e?vitest.vi.fn(e):vitest.vi.fn();return t!==void 0&&r.mockName(t),r},spyOnGetter(e,t){return vitest.vi.spyOn(e,t,"get")},spyOnSetter(e,t){return vitest.vi.spyOn(e,t,"set")},getCalls(e){return e.mock.calls},reset(e){e.mockReset();}};function S(e,t){Object.defineProperty(e,t,{get(){},set(r){},configurable:true});}function T(e,t,r){let n=l();return r==="setter"?n.spyOnSetter(e,t):n.spyOnGetter(e,t)}function O(e,t,r){let n={getters:{},setters:{}};e.accessorSpies=n,t.forEach(o=>{S(e,o),n.getters[o]=T(e,o,"getter");}),r.forEach(o=>{Object.prototype.hasOwnProperty.call(e,o)||S(e,o),n.setters[o]=T(e,o,"setter");});}function _(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function $(e,t){return Object.entries(e).map(([r,n])=>`${r}:${u(n,t)}`).join(",")}function H(e,t){return `new Map([${[...e.entries()].map(([n,o])=>`[${u(n,t)},${u(o,t)}]`).join(",")}])`}function z(e,t){if(t.has(e))return "[Circular]";t.add(e);let r;return e instanceof Date?r=`new Date(${e.getTime()})`:e instanceof Map?r=H(e,t):e instanceof Set?r=`new Set([${[...e].map(n=>u(n,t)).join(",")}])`:Array.isArray(e)?r=`[${e.map(n=>u(n,t)).join(",")}]`:r=`{${$(e,t)}}`,t.delete(e),r}function u(e,t=new WeakSet){return typeof e=="string"?_(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?z(e,t):Object.is(e,-0)?"-0":String(e)}var f=class{#e={};set(t,r){this.#e[this.#t(t)]=r;}get(t){return this.#e[this.#t(t)]}#t(t){return u(t)}};var N=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,B="But the function was called without any arguments.",I=e=>{let t=u(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},C={throwArgumentsError(e,t){let r=e.length===0?B:I(e);throw new Error(N(t)+r)}};var G="Observable spies require rxjs. Import 'vitest-auto-spy/rxjs' once (e.g. in your test setup) to enable observablePropsToSpyOn / nextWith / nextWithValues / throwWith / complete / returnSubject.";function h(){throw new Error(G);}function a(e,t){return Object.assign(e,t)}function K(e){return e.map(t=>({wrappedValue:t.delay===void 0?Promise.resolve(t.value):new Promise(r=>setTimeout(()=>r(t.value),t.delay))}))}function w(e,t){a(e,{resolveWith:r=>{t({value:Promise.resolve(r)});},rejectWith:r=>{t({value:r,_isRejectedPromise:true});},resolveWithPerCall:r=>{r.length!==0&&t({value:void 0,valuesPerCalls:K(r)});}});}function j(e,t){w(e,r=>{t.value=r.value,t._isRejectedPromise=r._isRejectedPromise??false,t.valuesPerCalls=r.valuesPerCalls??[];});}function M(e,t){w(e,r=>{e.argsToValuesMap.set(t,r);});}function D(e){return typeof e=="object"&&e!==null&&"value"in e}function A(e){if(e._isRejectedPromise)return Promise.reject(e.value);let t=e.valuesPerCalls?.shift();return t?t.wrappedValue:e.value}function v(e,t){let r=e.argsToValuesMap.get(t);return D(r)?{found:true,value:A(r)}:{found:false,value:void 0}}function q(e,t,r,n,o){if(e.wasConfigured){let s=v(e,n);if(s.found)return s.value}if(t.wasConfigured){let s=v(t,n);if(s.found)return s.value;C.throwArgumentsError(n,o);}return A(r)}function F(e,t){e.wasConfigured=true;let r=n=>{e.argsToValuesMap.set(t,{value:n});};return a(e,{mockReturnValue:r,returnValue:r}),M(e,t),e}function R(){return {wasConfigured:false,argsToValuesMap:new f}}function P(e){let t=R(),r=R(),n={value:void 0},o=l().createMockFn((...i)=>q(t,r,n,i,e),e);j(o,n);let s=a(o,{calledWith:(...i)=>F(t,i),mustBeCalledWith:(...i)=>F(r,i)});return s}var V={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function U(e){let t=Object.getOwnPropertyDescriptors(e);return Object.keys(t).filter(r=>r!=="constructor"&&!t[r]?.get)}var x=new WeakMap;function L(e){let t=x.get(e);if(t)return t;let r=new Set,n=e;for(;n;){let s=Object.getPrototypeOf(n);s&&U(n).forEach(i=>r.add(i)),n=s;}let o=[...r];return x.set(e,o),o}function J(e){return e?Array.isArray(e)?{...V,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...V}}function W(e,t){let{methodsToSpyOn:r,observablePropsToSpyOn:n,settersToSpyOn:o,gettersToSpyOn:s}=J(t),i=r.length>0?r:L(e.prototype),c={};return n.forEach(p=>{c[p]=h().createPropSpy();}),O(c,s,o),i.forEach(p=>{c[p]=P(p);}),c}function X(e,t){return {provide:e,useValue:W(e,t)}}function Y(e,t){return e.get(t)}b(k);exports.injectSpy=Y;exports.provideAutoSpy=X;
|
package/dist/nestjs.d.cts
CHANGED
package/dist/nestjs.d.ts
CHANGED
package/dist/nestjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-6LFQMHSX.js';import {a as a$2}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-6LFQMHSX.js';import {a as a$2}from'./chunk-WP2TFS53.js';import {a}from'./chunk-MQCVIN2A.js';import'./chunk-7IUYJ6ZW.js';function s(e,t){return {provide:e,useValue:a$2(e,t)}}function n(e,t){return e.get(t)}a(a$1);export{n as injectSpy,s as provideAutoSpy};
|
package/dist/node.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var node_test=require('node:test');var y;function k(e){y=e;}var
|
|
1
|
+
'use strict';var node_test=require('node:test');var y;function k(e){y=e;}var E="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function d(){if(!y)throw new Error(E);return y}function w({createMockFn:e,getCalls:t,reset:r}){return {createMockFn:e,spyOnGetter:(o,n)=>S(e,o,n,"get"),spyOnSetter:(o,n)=>S(e,o,n,"set"),getCalls:t,reset:r}}function S(e,t,r,o){let n=Object.getOwnPropertyDescriptor(t,r),s=o==="get"?n?.get:n?.set,i=e(s),c={configurable:true,enumerable:n?.enumerable??true};return n?.get&&(c.get=n.get),n?.set&&(c.set=n.set),o==="get"?c.get=i:c.set=i,Object.defineProperty(t,r,c),i}function M(e){return w({createMockFn:t=>e.fn(t??(()=>{})),getCalls:t=>t.mock.calls.map(r=>r.arguments),reset:t=>t.mock.resetCalls()})}function h(e,t){Object.defineProperty(e,t,{get(){},set(r){},configurable:true});}function O(e,t,r){let o=d();return r==="setter"?o.spyOnSetter(e,t):o.spyOnGetter(e,t)}function T(e,t,r){let o={getters:{},setters:{}};e.accessorSpies=o,t.forEach(n=>{h(e,n),o.getters[n]=O(e,n,"getter");}),r.forEach(n=>{Object.prototype.hasOwnProperty.call(e,n)||h(e,n),o.setters[n]=O(e,n,"setter");});}function _(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function H(e,t){return Object.entries(e).map(([r,o])=>`${r}:${a(o,t)}`).join(",")}function $(e,t){return `new Map([${[...e.entries()].map(([o,n])=>`[${a(o,t)},${a(n,t)}]`).join(",")}])`}function N(e,t){if(t.has(e))return "[Circular]";t.add(e);let r;return e instanceof Date?r=`new Date(${e.getTime()})`:e instanceof Map?r=$(e,t):e instanceof Set?r=`new Set([${[...e].map(o=>a(o,t)).join(",")}])`:Array.isArray(e)?r=`[${e.map(o=>a(o,t)).join(",")}]`:r=`{${H(e,t)}}`,t.delete(e),r}function a(e,t=new WeakSet){return typeof e=="string"?_(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?N(e,t):Object.is(e,-0)?"-0":String(e)}var f=class{#e={};set(t,r){this.#e[this.#t(t)]=r;}get(t){return this.#e[this.#t(t)]}#t(t){return a(t)}};var z=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,B="But the function was called without any arguments.",D=e=>{let t=a(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},g={throwArgumentsError(e,t){let r=e.length===0?B:D(e);throw new Error(z(t)+r)}};var I="Observable spies require rxjs. Import 'vitest-auto-spy/rxjs' once (e.g. in your test setup) to enable observablePropsToSpyOn / nextWith / nextWithValues / throwWith / complete / returnSubject.";function C(){throw new Error(I);}function u(e,t){return Object.assign(e,t)}function G(e){return e.map(t=>({wrappedValue:t.delay===void 0?Promise.resolve(t.value):new Promise(r=>setTimeout(()=>r(t.value),t.delay))}))}function j(e,t){u(e,{resolveWith:r=>{t({value:Promise.resolve(r)});},rejectWith:r=>{t({value:r,_isRejectedPromise:true});},resolveWithPerCall:r=>{r.length!==0&&t({value:void 0,valuesPerCalls:G(r)});}});}function F(e,t){j(e,r=>{t.value=r.value,t._isRejectedPromise=r._isRejectedPromise??false,t.valuesPerCalls=r.valuesPerCalls??[];});}function A(e,t){j(e,r=>{e.argsToValuesMap.set(t,r);});}function K(e){return typeof e=="object"&&e!==null&&"value"in e}function x(e){if(e._isRejectedPromise)return Promise.reject(e.value);let t=e.valuesPerCalls?.shift();return t?t.wrappedValue:e.value}function P(e,t){let r=e.argsToValuesMap.get(t);return K(r)?{found:true,value:x(r)}:{found:false,value:void 0}}function q(e,t,r,o,n){if(e.wasConfigured){let s=P(e,o);if(s.found)return s.value}if(t.wasConfigured){let s=P(t,o);if(s.found)return s.value;g.throwArgumentsError(o,n);}return x(r)}function v(e,t){e.wasConfigured=true;let r=o=>{e.argsToValuesMap.set(t,{value:o});};return u(e,{mockReturnValue:r,returnValue:r}),A(e,t),e}function R(){return {wasConfigured:false,argsToValuesMap:new f}}function p(e){let t=R(),r=R(),o={value:void 0},n=d().createMockFn((...i)=>q(t,r,o,i,e),e);F(n,o);let s=u(n,{calledWith:(...i)=>v(t,i),mustBeCalledWith:(...i)=>v(r,i)});return s}var V={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function U(e){let t=Object.getOwnPropertyDescriptors(e);return Object.keys(t).filter(r=>r!=="constructor"&&!t[r]?.get)}var W=new WeakMap;function L(e){let t=W.get(e);if(t)return t;let r=new Set,o=e;for(;o;){let s=Object.getPrototypeOf(o);s&&U(o).forEach(i=>r.add(i)),o=s;}let n=[...r];return W.set(e,n),n}function J(e){return e?Array.isArray(e)?{...V,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...V}}function X(e,t){let{methodsToSpyOn:r,observablePropsToSpyOn:o,settersToSpyOn:n,gettersToSpyOn:s}=J(t),i=r.length>0?r:L(e.prototype),c={};return o.forEach(l=>{c[l]=C().createPropSpy();}),T(c,s,n),i.forEach(l=>{c[l]=p(l);}),c}function Y(e={}){let t=new Map;for(let o of Reflect.ownKeys(e))t.set(o,Reflect.get(e,o));let r={get(o,n){if(t.has(n))return t.get(n);if(typeof n=="symbol"||n==="then"||n==="constructor")return;let s=p(String(n));return t.set(n,s),s},set(o,n,s){return t.set(n,s),true},has(o,n){return t.has(n)},ownKeys(){return [...t.keys()]},getOwnPropertyDescriptor(o,n){if(t.has(n))return {configurable:true,enumerable:true,value:t.get(n),writable:true}}};return new Proxy({},r)}k(M(node_test.mock));exports.createAutoMock=Y;exports.createFunctionSpy=p;exports.createSpyFromClass=X;exports.errorHandler=g;
|
package/dist/node.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.cjs';
|
|
2
2
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.cjs';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.js';
|
|
2
2
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.js';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
package/dist/node.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-IPBQZ4JC.js';export{a as createAutoMock}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-IPBQZ4JC.js';export{a as createAutoMock}from'./chunk-HVN6A3AX.js';export{a as createSpyFromClass}from'./chunk-WP2TFS53.js';import {a}from'./chunk-MQCVIN2A.js';export{e as createFunctionSpy,d as errorHandler}from'./chunk-MQCVIN2A.js';import'./chunk-7IUYJ6ZW.js';import {mock}from'node:test';function t(n){return a$1({createMockFn:e=>n.fn(e??(()=>{})),getCalls:e=>e.mock.calls.map(c=>c.arguments),reset:e=>e.mock.resetCalls()})}a(t(mock));
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var vitest=require('vitest');var g;function S(e){g=e;}var
|
|
1
|
+
'use strict';var vitest=require('vitest');var g;function S(e){g=e;}var W="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function d(){if(!g)throw new Error(W);return g}var w={createMockFn(e,t){let r=e?vitest.vi.fn(e):vitest.vi.fn();return t!==void 0&&r.mockName(t),r},spyOnGetter(e,t){return vitest.vi.spyOn(e,t,"get")},spyOnSetter(e,t){return vitest.vi.spyOn(e,t,"set")},getCalls(e){return e.mock.calls},reset(e){e.mockReset();}};function h(e,t){Object.defineProperty(e,t,{get(){},set(r){},configurable:true});}function O(e,t,r){let n=d();return r==="setter"?n.spyOnSetter(e,t):n.spyOnGetter(e,t)}function T(e,t,r){let n={getters:{},setters:{}};e.accessorSpies=n,t.forEach(o=>{h(e,o),n.getters[o]=O(e,o,"getter");}),r.forEach(o=>{Object.prototype.hasOwnProperty.call(e,o)||h(e,o),n.setters[o]=O(e,o,"setter");});}function E(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function _(e,t){return Object.entries(e).map(([r,n])=>`${r}:${u(n,t)}`).join(",")}function H(e,t){return `new Map([${[...e.entries()].map(([n,o])=>`[${u(n,t)},${u(o,t)}]`).join(",")}])`}function $(e,t){if(t.has(e))return "[Circular]";t.add(e);let r;return e instanceof Date?r=`new Date(${e.getTime()})`:e instanceof Map?r=H(e,t):e instanceof Set?r=`new Set([${[...e].map(n=>u(n,t)).join(",")}])`:Array.isArray(e)?r=`[${e.map(n=>u(n,t)).join(",")}]`:r=`{${_(e,t)}}`,t.delete(e),r}function u(e,t=new WeakSet){return typeof e=="string"?E(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?$(e,t):Object.is(e,-0)?"-0":String(e)}var y=class{#e={};set(t,r){this.#e[this.#t(t)]=r;}get(t){return this.#e[this.#t(t)]}#t(t){return u(t)}};var z=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,B="But the function was called without any arguments.",I=e=>{let t=u(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},m={throwArgumentsError(e,t){let r=e.length===0?B:I(e);throw new Error(z(t)+r)}};var G="Observable spies require rxjs. Import 'vitest-auto-spy/rxjs' once (e.g. in your test setup) to enable observablePropsToSpyOn / nextWith / nextWithValues / throwWith / complete / returnSubject.";function M(){throw new Error(G);}function c(e,t){return Object.assign(e,t)}function K(e){return e.map(t=>({wrappedValue:t.delay===void 0?Promise.resolve(t.value):new Promise(r=>setTimeout(()=>r(t.value),t.delay))}))}function j(e,t){c(e,{resolveWith:r=>{t({value:Promise.resolve(r)});},rejectWith:r=>{t({value:r,_isRejectedPromise:true});},resolveWithPerCall:r=>{r.length!==0&&t({value:void 0,valuesPerCalls:K(r)});}});}function C(e,t){j(e,r=>{t.value=r.value,t._isRejectedPromise=r._isRejectedPromise??false,t.valuesPerCalls=r.valuesPerCalls??[];});}function v(e,t){j(e,r=>{e.argsToValuesMap.set(t,r);});}function D(e){return typeof e=="object"&&e!==null&&"value"in e}function A(e){if(e._isRejectedPromise)return Promise.reject(e.value);let t=e.valuesPerCalls?.shift();return t?t.wrappedValue:e.value}function F(e,t){let r=e.argsToValuesMap.get(t);return D(r)?{found:true,value:A(r)}:{found:false,value:void 0}}function q(e,t,r,n,o){if(e.wasConfigured){let s=F(e,n);if(s.found)return s.value}if(t.wasConfigured){let s=F(t,n);if(s.found)return s.value;m.throwArgumentsError(n,o);}return A(r)}function P(e,t){e.wasConfigured=true;let r=n=>{e.argsToValuesMap.set(t,{value:n});};return c(e,{mockReturnValue:r,returnValue:r}),v(e,t),e}function R(){return {wasConfigured:false,argsToValuesMap:new y}}function a(e){let t=R(),r=R(),n={value:void 0},o=d().createMockFn((...i)=>q(t,r,n,i,e),e);C(o,n);let s=c(o,{calledWith:(...i)=>P(t,i),mustBeCalledWith:(...i)=>P(r,i)});return s}var x={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function N(e){let t=Object.getOwnPropertyDescriptors(e);return Object.keys(t).filter(r=>r!=="constructor"&&!t[r]?.get)}var V=new WeakMap;function U(e){let t=V.get(e);if(t)return t;let r=new Set,n=e;for(;n;){let s=Object.getPrototypeOf(n);s&&N(n).forEach(i=>r.add(i)),n=s;}let o=[...r];return V.set(e,o),o}function L(e){return e?Array.isArray(e)?{...x,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...x}}function J(e,t){let{methodsToSpyOn:r,observablePropsToSpyOn:n,settersToSpyOn:o,gettersToSpyOn:s}=L(t),i=r.length>0?r:U(e.prototype),p={};return n.forEach(l=>{p[l]=M().createPropSpy();}),T(p,s,o),i.forEach(l=>{p[l]=a(l);}),p}function X(e={}){let t=new Map;for(let n of Reflect.ownKeys(e))t.set(n,Reflect.get(e,n));let r={get(n,o){if(t.has(o))return t.get(o);if(typeof o=="symbol"||o==="then"||o==="constructor")return;let s=a(String(o));return t.set(o,s),s},set(n,o,s){return t.set(o,s),true},has(n,o){return t.has(o)},ownKeys(){return [...t.keys()]},getOwnPropertyDescriptor(n,o){if(t.has(o))return {configurable:true,enumerable:true,value:t.get(o),writable:true}}};return new Proxy({},r)}S(w);exports.createAutoMock=X;exports.createFunctionSpy=a;exports.createSpyFromClass=J;exports.errorHandler=m;
|
package/dist/react.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.cjs';
|
|
2
2
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.cjs';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.js';
|
|
2
2
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.js';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-6LFQMHSX.js';export{a as createAutoMock}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-6LFQMHSX.js';export{a as createAutoMock}from'./chunk-HVN6A3AX.js';export{a as createSpyFromClass}from'./chunk-WP2TFS53.js';import {a}from'./chunk-MQCVIN2A.js';export{e as createFunctionSpy,d as errorHandler}from'./chunk-MQCVIN2A.js';import'./chunk-7IUYJ6ZW.js';a(a$1);
|
package/dist/rxjs.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable, ReplaySubject } from 'rxjs';
|
|
2
|
-
import { V as ValueConfig } from './types-
|
|
3
|
-
export { A as AddObservableSpyMethods, b as CompleteValueConfig, E as ErrorValueConfig, N as NextValueConfig, c as ValueConfigPerCall } from './types-
|
|
2
|
+
import { V as ValueConfig } from './types-Cv3L71P0.cjs';
|
|
3
|
+
export { A as AddObservableSpyMethods, b as CompleteValueConfig, E as ErrorValueConfig, N as NextValueConfig, c as ValueConfigPerCall } from './types-Cv3L71P0.cjs';
|
|
4
4
|
import 'vitest';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/rxjs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable, ReplaySubject } from 'rxjs';
|
|
2
|
-
import { V as ValueConfig } from './types-
|
|
3
|
-
export { A as AddObservableSpyMethods, b as CompleteValueConfig, E as ErrorValueConfig, N as NextValueConfig, c as ValueConfigPerCall } from './types-
|
|
2
|
+
import { V as ValueConfig } from './types-Cv3L71P0.js';
|
|
3
|
+
export { A as AddObservableSpyMethods, b as CompleteValueConfig, E as ErrorValueConfig, N as NextValueConfig, c as ValueConfigPerCall } from './types-Cv3L71P0.js';
|
|
4
4
|
import 'vitest';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/svelte.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var vitest=require('vitest');var g;function S(e){g=e;}var
|
|
1
|
+
'use strict';var vitest=require('vitest');var g;function S(e){g=e;}var W="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function d(){if(!g)throw new Error(W);return g}var w={createMockFn(e,t){let r=e?vitest.vi.fn(e):vitest.vi.fn();return t!==void 0&&r.mockName(t),r},spyOnGetter(e,t){return vitest.vi.spyOn(e,t,"get")},spyOnSetter(e,t){return vitest.vi.spyOn(e,t,"set")},getCalls(e){return e.mock.calls},reset(e){e.mockReset();}};function h(e,t){Object.defineProperty(e,t,{get(){},set(r){},configurable:true});}function O(e,t,r){let n=d();return r==="setter"?n.spyOnSetter(e,t):n.spyOnGetter(e,t)}function T(e,t,r){let n={getters:{},setters:{}};e.accessorSpies=n,t.forEach(o=>{h(e,o),n.getters[o]=O(e,o,"getter");}),r.forEach(o=>{Object.prototype.hasOwnProperty.call(e,o)||h(e,o),n.setters[o]=O(e,o,"setter");});}function E(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function _(e,t){return Object.entries(e).map(([r,n])=>`${r}:${u(n,t)}`).join(",")}function H(e,t){return `new Map([${[...e.entries()].map(([n,o])=>`[${u(n,t)},${u(o,t)}]`).join(",")}])`}function $(e,t){if(t.has(e))return "[Circular]";t.add(e);let r;return e instanceof Date?r=`new Date(${e.getTime()})`:e instanceof Map?r=H(e,t):e instanceof Set?r=`new Set([${[...e].map(n=>u(n,t)).join(",")}])`:Array.isArray(e)?r=`[${e.map(n=>u(n,t)).join(",")}]`:r=`{${_(e,t)}}`,t.delete(e),r}function u(e,t=new WeakSet){return typeof e=="string"?E(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?$(e,t):Object.is(e,-0)?"-0":String(e)}var y=class{#e={};set(t,r){this.#e[this.#t(t)]=r;}get(t){return this.#e[this.#t(t)]}#t(t){return u(t)}};var z=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,B="But the function was called without any arguments.",I=e=>{let t=u(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},m={throwArgumentsError(e,t){let r=e.length===0?B:I(e);throw new Error(z(t)+r)}};var G="Observable spies require rxjs. Import 'vitest-auto-spy/rxjs' once (e.g. in your test setup) to enable observablePropsToSpyOn / nextWith / nextWithValues / throwWith / complete / returnSubject.";function M(){throw new Error(G);}function c(e,t){return Object.assign(e,t)}function K(e){return e.map(t=>({wrappedValue:t.delay===void 0?Promise.resolve(t.value):new Promise(r=>setTimeout(()=>r(t.value),t.delay))}))}function j(e,t){c(e,{resolveWith:r=>{t({value:Promise.resolve(r)});},rejectWith:r=>{t({value:r,_isRejectedPromise:true});},resolveWithPerCall:r=>{r.length!==0&&t({value:void 0,valuesPerCalls:K(r)});}});}function C(e,t){j(e,r=>{t.value=r.value,t._isRejectedPromise=r._isRejectedPromise??false,t.valuesPerCalls=r.valuesPerCalls??[];});}function v(e,t){j(e,r=>{e.argsToValuesMap.set(t,r);});}function D(e){return typeof e=="object"&&e!==null&&"value"in e}function A(e){if(e._isRejectedPromise)return Promise.reject(e.value);let t=e.valuesPerCalls?.shift();return t?t.wrappedValue:e.value}function F(e,t){let r=e.argsToValuesMap.get(t);return D(r)?{found:true,value:A(r)}:{found:false,value:void 0}}function q(e,t,r,n,o){if(e.wasConfigured){let s=F(e,n);if(s.found)return s.value}if(t.wasConfigured){let s=F(t,n);if(s.found)return s.value;m.throwArgumentsError(n,o);}return A(r)}function P(e,t){e.wasConfigured=true;let r=n=>{e.argsToValuesMap.set(t,{value:n});};return c(e,{mockReturnValue:r,returnValue:r}),v(e,t),e}function R(){return {wasConfigured:false,argsToValuesMap:new y}}function a(e){let t=R(),r=R(),n={value:void 0},o=d().createMockFn((...i)=>q(t,r,n,i,e),e);C(o,n);let s=c(o,{calledWith:(...i)=>P(t,i),mustBeCalledWith:(...i)=>P(r,i)});return s}var x={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function N(e){let t=Object.getOwnPropertyDescriptors(e);return Object.keys(t).filter(r=>r!=="constructor"&&!t[r]?.get)}var V=new WeakMap;function U(e){let t=V.get(e);if(t)return t;let r=new Set,n=e;for(;n;){let s=Object.getPrototypeOf(n);s&&N(n).forEach(i=>r.add(i)),n=s;}let o=[...r];return V.set(e,o),o}function L(e){return e?Array.isArray(e)?{...x,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...x}}function J(e,t){let{methodsToSpyOn:r,observablePropsToSpyOn:n,settersToSpyOn:o,gettersToSpyOn:s}=L(t),i=r.length>0?r:U(e.prototype),p={};return n.forEach(l=>{p[l]=M().createPropSpy();}),T(p,s,o),i.forEach(l=>{p[l]=a(l);}),p}function X(e={}){let t=new Map;for(let n of Reflect.ownKeys(e))t.set(n,Reflect.get(e,n));let r={get(n,o){if(t.has(o))return t.get(o);if(typeof o=="symbol"||o==="then"||o==="constructor")return;let s=a(String(o));return t.set(o,s),s},set(n,o,s){return t.set(o,s),true},has(n,o){return t.has(o)},ownKeys(){return [...t.keys()]},getOwnPropertyDescriptor(n,o){if(t.has(o))return {configurable:true,enumerable:true,value:t.get(o),writable:true}}};return new Proxy({},r)}S(w);exports.createAutoMock=X;exports.createFunctionSpy=a;exports.createSpyFromClass=J;exports.errorHandler=m;
|
package/dist/svelte.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.cjs';
|
|
2
2
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.cjs';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
package/dist/svelte.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, a as ClassSpyConfiguration, C as ClassType, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, O as OnlyMethodKeysOf, j as OnlyObservablePropsOf, k as OnlyPropsOf, S as Spy, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.js';
|
|
2
2
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.js';
|
|
3
3
|
import 'rxjs';
|
|
4
4
|
import 'vitest';
|
package/dist/svelte.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-6LFQMHSX.js';export{a as createAutoMock}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-6LFQMHSX.js';export{a as createAutoMock}from'./chunk-HVN6A3AX.js';export{a as createSpyFromClass}from'./chunk-WP2TFS53.js';import {a}from'./chunk-MQCVIN2A.js';export{e as createFunctionSpy,d as errorHandler}from'./chunk-MQCVIN2A.js';import'./chunk-7IUYJ6ZW.js';a(a$1);
|
|
@@ -67,9 +67,14 @@ interface AddPromiseSpyMethods<T> {
|
|
|
67
67
|
rejectWith(value?: unknown): void;
|
|
68
68
|
resolveWithPerCall(valuesPerCall: ValueConfigPerCall<T>[]): void;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* A configured return-value continuation for a `calledWith`/`mustBeCalledWith`
|
|
72
|
+
* chain. `mockReturnValue` is the native name; `returnValue` is the
|
|
73
|
+
* `jest-auto-spies` alias, kept so migrating tests are a pure import swap.
|
|
74
|
+
*/
|
|
71
75
|
type WithMockReturnValue<Method extends Func> = {
|
|
72
76
|
mockReturnValue: (value: ReturnType<Method>) => void;
|
|
77
|
+
returnValue: (value: ReturnType<Method>) => void;
|
|
73
78
|
};
|
|
74
79
|
/** Argument-matching helpers attached to a plain (sync) spy. */
|
|
75
80
|
interface AddCalledWithSpyMethods<Method extends Func> {
|
|
@@ -67,9 +67,14 @@ interface AddPromiseSpyMethods<T> {
|
|
|
67
67
|
rejectWith(value?: unknown): void;
|
|
68
68
|
resolveWithPerCall(valuesPerCall: ValueConfigPerCall<T>[]): void;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* A configured return-value continuation for a `calledWith`/`mustBeCalledWith`
|
|
72
|
+
* chain. `mockReturnValue` is the native name; `returnValue` is the
|
|
73
|
+
* `jest-auto-spies` alias, kept so migrating tests are a pure import swap.
|
|
74
|
+
*/
|
|
71
75
|
type WithMockReturnValue<Method extends Func> = {
|
|
72
76
|
mockReturnValue: (value: ReturnType<Method>) => void;
|
|
77
|
+
returnValue: (value: ReturnType<Method>) => void;
|
|
73
78
|
};
|
|
74
79
|
/** Argument-matching helpers attached to a plain (sync) spy. */
|
|
75
80
|
interface AddCalledWithSpyMethods<Method extends Func> {
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var vitest=require('vitest');var g;function T(e){g=e;}var
|
|
1
|
+
'use strict';var vitest=require('vitest');var g;function T(e){g=e;}var E="No mock adapter registered. Import a runtime entry once before creating spies \u2014 'vitest-auto-spy' (default, Vitest) or a runtime variant such as 'vitest-auto-spy/bun'.";function d(){if(!g)throw new Error(E);return g}var h={createMockFn(e,t){let r=e?vitest.vi.fn(e):vitest.vi.fn();return t!==void 0&&r.mockName(t),r},spyOnGetter(e,t){return vitest.vi.spyOn(e,t,"get")},spyOnSetter(e,t){return vitest.vi.spyOn(e,t,"set")},getCalls(e){return e.mock.calls},reset(e){e.mockReset();}};function w(e,t){Object.defineProperty(e,t,{get(){},set(r){},configurable:true});}function O(e,t,r){let n=d();return r==="setter"?n.spyOnSetter(e,t):n.spyOnGetter(e,t)}function C(e,t,r){let n={getters:{},setters:{}};e.accessorSpies=n,t.forEach(o=>{w(e,o),n.getters[o]=O(e,o,"getter");}),r.forEach(o=>{Object.prototype.hasOwnProperty.call(e,o)||w(e,o),n.setters[o]=O(e,o,"setter");});}function _(e){return `'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function H(e,t){return Object.entries(e).map(([r,n])=>`${r}:${u(n,t)}`).join(",")}function $(e,t){return `new Map([${[...e.entries()].map(([n,o])=>`[${u(n,t)},${u(o,t)}]`).join(",")}])`}function I(e,t){if(t.has(e))return "[Circular]";t.add(e);let r;return e instanceof Date?r=`new Date(${e.getTime()})`:e instanceof Map?r=$(e,t):e instanceof Set?r=`new Set([${[...e].map(n=>u(n,t)).join(",")}])`:Array.isArray(e)?r=`[${e.map(n=>u(n,t)).join(",")}]`:r=`{${H(e,t)}}`,t.delete(e),r}function u(e,t=new WeakSet){return typeof e=="string"?_(e):typeof e=="bigint"?`${e}n`:typeof e=="symbol"?e.toString():typeof e=="function"?`[Function: ${e.name}]`:typeof e=="object"&&e!==null?I(e,t):Object.is(e,-0)?"-0":String(e)}var y=class{#e={};set(t,r){this.#e[this.#t(t)]=r;}get(t){return this.#e[this.#t(t)]}#t(t){return u(t)}};var z=e=>`The function '${e}' was configured with 'mustBeCalledWith' and expects to be called with specific arguments. `,K="But the function was called without any arguments.",B=e=>{let t=u(e);return `But the actual arguments were: ${t.substring(1,t.length-1)}`},m={throwArgumentsError(e,t){let r=e.length===0?K:B(e);throw new Error(z(t)+r)}};var G="Observable spies require rxjs. Import 'vitest-auto-spy/rxjs' once (e.g. in your test setup) to enable observablePropsToSpyOn / nextWith / nextWithValues / throwWith / complete / returnSubject.";function j(){throw new Error(G);}function a(e,t){return Object.assign(e,t)}function D(e){return e.map(t=>({wrappedValue:t.delay===void 0?Promise.resolve(t.value):new Promise(r=>setTimeout(()=>r(t.value),t.delay))}))}function M(e,t){a(e,{resolveWith:r=>{t({value:Promise.resolve(r)});},rejectWith:r=>{t({value:r,_isRejectedPromise:true});},resolveWithPerCall:r=>{r.length!==0&&t({value:void 0,valuesPerCalls:D(r)});}});}function v(e,t){M(e,r=>{t.value=r.value,t._isRejectedPromise=r._isRejectedPromise??false,t.valuesPerCalls=r.valuesPerCalls??[];});}function F(e,t){M(e,r=>{e.argsToValuesMap.set(t,r);});}function q(e){return typeof e=="object"&&e!==null&&"value"in e}function A(e){if(e._isRejectedPromise)return Promise.reject(e.value);let t=e.valuesPerCalls?.shift();return t?t.wrappedValue:e.value}function P(e,t){let r=e.argsToValuesMap.get(t);return q(r)?{found:true,value:A(r)}:{found:false,value:void 0}}function N(e,t,r,n,o){if(e.wasConfigured){let s=P(e,n);if(s.found)return s.value}if(t.wasConfigured){let s=P(t,n);if(s.found)return s.value;m.throwArgumentsError(n,o);}return A(r)}function x(e,t){e.wasConfigured=true;let r=n=>{e.argsToValuesMap.set(t,{value:n});};return a(e,{mockReturnValue:r,returnValue:r}),F(e,t),e}function R(){return {wasConfigured:false,argsToValuesMap:new y}}function c(e){let t=R(),r=R(),n={value:void 0},o=d().createMockFn((...i)=>N(t,r,n,i,e),e);v(o,n);let s=a(o,{calledWith:(...i)=>x(t,i),mustBeCalledWith:(...i)=>x(r,i)});return s}var V={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function U(e){let t=Object.getOwnPropertyDescriptors(e);return Object.keys(t).filter(r=>r!=="constructor"&&!t[r]?.get)}var W=new WeakMap;function L(e){let t=W.get(e);if(t)return t;let r=new Set,n=e;for(;n;){let s=Object.getPrototypeOf(n);s&&U(n).forEach(i=>r.add(i)),n=s;}let o=[...r];return W.set(e,o),o}function J(e){return e?Array.isArray(e)?{...V,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...V}}function S(e,t){let{methodsToSpyOn:r,observablePropsToSpyOn:n,settersToSpyOn:o,gettersToSpyOn:s}=J(t),i=r.length>0?r:L(e.prototype),p={};return n.forEach(l=>{p[l]=j().createPropSpy();}),C(p,s,o),i.forEach(l=>{p[l]=c(l);}),p}function X(e,t,r){return {[e]:S(t,r)}}function Y(e={}){let t=new Map;for(let n of Reflect.ownKeys(e))t.set(n,Reflect.get(e,n));let r={get(n,o){if(t.has(o))return t.get(o);if(typeof o=="symbol"||o==="then"||o==="constructor")return;let s=c(String(o));return t.set(o,s),s},set(n,o,s){return t.set(o,s),true},has(n,o){return t.has(o)},ownKeys(){return [...t.keys()]},getOwnPropertyDescriptor(n,o){if(t.has(o))return {configurable:true,enumerable:true,value:t.get(o),writable:true}}};return new Proxy({},r)}T(h);exports.createAutoMock=Y;exports.createFunctionSpy=c;exports.createSpyFromClass=S;exports.errorHandler=m;exports.provideAutoSpy=X;
|
package/dist/vue.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Spy, C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf } from './types-
|
|
2
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, j as OnlyObservablePropsOf, k as OnlyPropsOf, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
import { S as Spy, C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf } from './types-Cv3L71P0.cjs';
|
|
2
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, j as OnlyObservablePropsOf, k as OnlyPropsOf, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.cjs';
|
|
3
3
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.cjs';
|
|
4
4
|
import 'rxjs';
|
|
5
5
|
import 'vitest';
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Spy, C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf } from './types-
|
|
2
|
-
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, j as OnlyObservablePropsOf, k as OnlyPropsOf, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-
|
|
1
|
+
import { S as Spy, C as ClassType, a as ClassSpyConfiguration, O as OnlyMethodKeysOf } from './types-Cv3L71P0.js';
|
|
2
|
+
export { d as AddAccessorsSpies, e as AddCalledWithObservable, f as AddCalledWithPromise, g as AddCalledWithSpyMethods, A as AddObservableSpyMethods, h as AddPromiseSpyMethods, i as AddSpyMethodsByReturnTypes, b as CompleteValueConfig, E as ErrorValueConfig, F as Func, N as NextValueConfig, j as OnlyObservablePropsOf, k as OnlyPropsOf, V as ValueConfig, c as ValueConfigPerCall, W as WithMockReturnValue } from './types-Cv3L71P0.js';
|
|
3
3
|
export { createAutoMock, createFunctionSpy, createSpyFromClass, errorHandler } from './bun.js';
|
|
4
4
|
import 'rxjs';
|
|
5
5
|
import 'vitest';
|
package/dist/vue.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-6LFQMHSX.js';export{a as createAutoMock}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-6LFQMHSX.js';export{a as createAutoMock}from'./chunk-HVN6A3AX.js';import {a as a$2}from'./chunk-WP2TFS53.js';export{a as createSpyFromClass}from'./chunk-WP2TFS53.js';import {a}from'./chunk-MQCVIN2A.js';export{e as createFunctionSpy,d as errorHandler}from'./chunk-MQCVIN2A.js';import'./chunk-7IUYJ6ZW.js';function y(r,p,n){return {[r]:a$2(p,n)}}a(a$1);export{y as provideAutoSpy};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-auto-spy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Auto-generate fully-typed test spies from a class — across Vitest, Bun and node:test, with NestJS/React/Vue/Svelte/Angular recipes. Drop-in replacement for jest-auto-spies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auto-mock",
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"files": [
|
|
102
102
|
"dist",
|
|
103
|
+
"assets",
|
|
103
104
|
"README.md",
|
|
104
105
|
"LICENSE"
|
|
105
106
|
],
|
|
@@ -137,6 +138,7 @@
|
|
|
137
138
|
"test": "vitest run",
|
|
138
139
|
"test:watch": "vitest",
|
|
139
140
|
"test:coverage": "vitest run --coverage",
|
|
141
|
+
"bench": "vitest bench --run --config vitest.bench.config.mts",
|
|
140
142
|
"lint": "eslint . --ext .ts",
|
|
141
143
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
142
144
|
"format": "prettier -w \"src/**/*.ts\"",
|
package/dist/chunk-CUVWIHH5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {e,c as c$1}from'./chunk-PEAFUJBQ.js';import {c}from'./chunk-7IUYJ6ZW.js';function g(e,r){Object.defineProperty(e,r,{get(){},set(t){},configurable:true});}function u(e,r,t){let o=c$1();return t==="setter"?o.spyOnSetter(e,r):o.spyOnGetter(e,r)}function a(e,r,t){let o={getters:{},setters:{}};e.accessorSpies=o,r.forEach(s=>{g(e,s),o.getters[s]=u(e,s,"getter");}),t.forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||g(e,s),o.setters[s]=u(e,s,"setter");});}var f={methodsToSpyOn:[],observablePropsToSpyOn:[],settersToSpyOn:[],gettersToSpyOn:[]};function S(e){let r=Object.getOwnPropertyDescriptors(e);return Object.keys(r).filter(t=>t!=="constructor"&&!r[t]?.get)}function T(e){let r=new Set,t=e;for(;t;){let o=Object.getPrototypeOf(t);o&&S(t).forEach(s=>r.add(s)),t=o;}return [...r]}function d(e){return e?Array.isArray(e)?{...f,methodsToSpyOn:e}:{methodsToSpyOn:e.methodsToSpyOn??[],observablePropsToSpyOn:e.observablePropsToSpyOn??[],settersToSpyOn:e.settersToSpyOn??[],gettersToSpyOn:e.gettersToSpyOn??[]}:{...f}}function k(e$1,r){let{methodsToSpyOn:t,observablePropsToSpyOn:o,settersToSpyOn:s,gettersToSpyOn:l}=d(r),O=t.length>0?t:T(e$1.prototype),n={};return o.forEach(c$1=>{n[c$1]=c().createPropSpy();}),a(n,l,s),O.forEach(c=>{n[c]=e(c);}),n}export{k as a};
|