vitest-auto-spy 1.4.0 → 1.5.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.
Files changed (2) hide show
  1. package/README.md +25 -26
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
  **Auto-generate fully-typed test spies from a class — across any Vitest-compatible runtime and framework.**
6
6
 
7
7
  The only auto-spy library that reads a **class** and gives a **fully-typed** spy of every method
8
- with **return-type-aware** helpers (`resolveWith` / `nextWith` / `calledWith`). Available today for
9
- **Vitest** (with **RxJS** and **Angular** helpers); **Bun**, **node:test**, and NestJS / React /
10
- Vue·Pinia / Svelte recipes land in the next release ([availability](#availability)). A drop-in
8
+ with **return-type-aware** helpers (`resolveWith` / `nextWith` / `calledWith`). Runs on **Vitest**,
9
+ **Bun** (`bun:test`) and **`node:test`** behind one identical API, with **RxJS** spies and
10
+ **Angular / NestJS / React / Vue·Pinia / Svelte** recipes ([availability](#availability)). A drop-in
11
11
  replacement for [`jest-auto-spies`](https://www.npmjs.com/package/jest-auto-spies) — same API.
12
12
 
13
13
  [![npm version](https://img.shields.io/npm/v/vitest-auto-spy?color=cb3837&logo=npm)](https://www.npmjs.com/package/vitest-auto-spy)
@@ -19,8 +19,8 @@ replacement for [`jest-auto-spies`](https://www.npmjs.com/package/jest-auto-spie
19
19
  [![license](https://img.shields.io/npm/l/vitest-auto-spy?color=blue)](./LICENSE)
20
20
 
21
21
  [![Vitest](https://img.shields.io/badge/Vitest-✓-6E9F18?logo=vitest&logoColor=white)](#runtimes)
22
- [![Bun](https://img.shields.io/badge/Bun-next-yellow?logo=bun&logoColor=white)](#availability)
23
- [![node:test](https://img.shields.io/badge/node%3Atest-next-yellow?logo=node.js&logoColor=white)](#availability)
22
+ [![Bun](https://img.shields.io/badge/Bun-✓-6E9F18?logo=bun&logoColor=white)](#availability)
23
+ [![node:test](https://img.shields.io/badge/node%3Atest-✓-6E9F18?logo=node.js&logoColor=white)](#availability)
24
24
  [![runtime deps](https://img.shields.io/badge/runtime%20deps-0-brightgreen)](#install)
25
25
 
26
26
  📦 [**npm**](https://www.npmjs.com/package/vitest-auto-spy) · 🐙 [**GitHub**](https://github.com/ASDAlexey/vitest-auto-spy) · 🔖 [**Changelog**](./CHANGELOG.md)
@@ -31,8 +31,8 @@ replacement for [`jest-auto-spies`](https://www.npmjs.com/package/jest-auto-spie
31
31
 
32
32
  - 🧪 Reads a class and generates a typed spy for **every** method — no hand-written `vi.fn()` lists
33
33
  - 🧬 Or mock from a **type/interface** alone — `createAutoMock<T>()`, no class required
34
- - 🌐 One `MockAdapter` core — **Vitest** today; **Bun** and **`node:test`** next release, identical API on each
35
- - 🧩 Framework recipes: **Angular** today; **NestJS, React, Vue/Pinia, Svelte** next release
34
+ - 🌐 One `MockAdapter` core — **Vitest**, **Bun** and **`node:test`**, identical API on each
35
+ - 🧩 Framework recipes: **Angular**, **NestJS**, **React**, **Vue/Pinia** and **Svelte**
36
36
  - 🎯 Return-type-aware helpers — sync, `Promise`, and `Observable` all get the right API
37
37
  - 🔀 `calledWith` / `mustBeCalledWith` argument dispatch
38
38
  - 📡 First-class RxJS `Observable` spying (`nextWith`, `nextWithValues`, `throwWith`, …)
@@ -97,16 +97,15 @@ them only for the matching entry point. The package itself has **zero runtime de
97
97
 
98
98
  ## Availability
99
99
 
100
- > **On npm today vs. shipping next.** `vitest-auto-spy@1.3.0` publishes the **Vitest core** plus the
101
- > **RxJS** and **Angular** layers. The Bun / `node:test` runtimes and the NestJS / React / Vue /
102
- > Svelte recipes are implemented and tested in the repo but **not yet published as entry points** —
103
- > they land in the next release. Snippets that use them are marked _next release_ below.
100
+ > **All entry points are published.** As of `vitest-auto-spy@1.4.0`, the **Vitest / Bun / `node:test`**
101
+ > runtimes, the **RxJS** layer, and the **Angular / NestJS / React / Vue·Pinia / Svelte** recipes all
102
+ > ship as importable entry points — one identical API across every runner and framework.
104
103
 
105
104
  | Entry point | Status |
106
105
  | --- | --- |
107
- | `vitest-auto-spy` · `vitest-auto-spy/rxjs` · `vitest-auto-spy/angular` | ✅ **Published** (1.3.0) |
108
- | `vitest-auto-spy/bun` · `vitest-auto-spy/node` | 🔜 next release |
109
- | `vitest-auto-spy/nestjs` · `/react` · `/vue` · `/svelte` | 🔜 next release |
106
+ | `vitest-auto-spy` · `vitest-auto-spy/rxjs` · `vitest-auto-spy/angular` | ✅ **Published** (1.4.0) |
107
+ | `vitest-auto-spy/bun` · `vitest-auto-spy/node` | ✅ **Published** (1.4.0) |
108
+ | `vitest-auto-spy/nestjs` · `/react` · `/vue` · `/svelte` | ✅ **Published** (1.4.0) |
110
109
 
111
110
  ## Quick start
112
111
 
@@ -205,14 +204,14 @@ Node / Bun / React / Vue project pulls **neither rxjs nor Angular into its runti
205
204
  | `vitest-auto-spy` | `createSpyFromClass`, `createAutoMock`, `createFunctionSpy`, sync + promise + accessor spies, `errorHandler`, types | `vitest` | ✅ |
206
205
  | `vitest-auto-spy/rxjs` | observable spies (`nextWith`, `nextWithValues`, `observablePropsToSpyOn`, …) + `createObservableWithValues` | `rxjs` | ✅ |
207
206
  | `vitest-auto-spy/angular` | `provideAutoSpy`, `injectSpy`, `mockReadonlyProp*`, `mockAccessorsProp` | `@angular/core` | ✅ |
208
- | `vitest-auto-spy/bun` | the same core, driven by Bun's `bun:test` mocks | `bun:test` | 🔜 |
209
- | `vitest-auto-spy/node` | the same core, driven by `node:test`'s `mock.fn()` | `node:test` | 🔜 |
210
- | `vitest-auto-spy/nestjs` | `provideAutoSpy`, `injectSpy` for `Test.createTestingModule` | — (your `@nestjs/*`) | 🔜 |
211
- | `vitest-auto-spy/react` | the core, with a natural import for React Testing Library suites | — (your `react`) | 🔜 |
212
- | `vitest-auto-spy/vue` | `provideAutoSpy` for `global.provide` + Pinia store spying | — (your `vue`/`pinia`) | 🔜 |
213
- | `vitest-auto-spy/svelte` | the core, with a natural import for Svelte suites | — (your `svelte`) | 🔜 |
207
+ | `vitest-auto-spy/bun` | the same core, driven by Bun's `bun:test` mocks | `bun:test` | ✅ |
208
+ | `vitest-auto-spy/node` | the same core, driven by `node:test`'s `mock.fn()` | `node:test` | ✅ |
209
+ | `vitest-auto-spy/nestjs` | `provideAutoSpy`, `injectSpy` for `Test.createTestingModule` | — (your `@nestjs/*`) | ✅ |
210
+ | `vitest-auto-spy/react` | the core, with a natural import for React Testing Library suites | — (your `react`) | ✅ |
211
+ | `vitest-auto-spy/vue` | `provideAutoSpy` for `global.provide` + Pinia store spying | — (your `vue`/`pinia`) | ✅ |
212
+ | `vitest-auto-spy/svelte` | the core, with a natural import for Svelte suites | — (your `svelte`) | ✅ |
214
213
 
215
- ✅ published in 1.3.0 · 🔜 next release (see [Availability](#availability)).
214
+ ✅ all entry points published in 1.4.0 (see [Availability](#availability)).
216
215
 
217
216
  > The framework subpaths import **nothing** from their framework — the helpers are structural, so
218
217
  > `@nestjs/*`, `react`, `vue`/`pinia` and `svelte` stay your own (already-present) dev dependencies and
@@ -232,8 +231,8 @@ identical across all three.
232
231
 
233
232
  ```ts
234
233
  import { createSpyFromClass } from 'vitest-auto-spy'; // Vitest (default, zero-config)
235
- import { createSpyFromClass } from 'vitest-auto-spy/bun'; // Bun — bun:test (next release)
236
- import { createSpyFromClass } from 'vitest-auto-spy/node'; // node:test (next release)
234
+ import { createSpyFromClass } from 'vitest-auto-spy/bun'; // Bun — bun:test
235
+ import { createSpyFromClass } from 'vitest-auto-spy/node'; // node:test
237
236
  ```
238
237
 
239
238
  > Only the auto-spy helpers are normalised across runtimes; **native** mock methods stay the
@@ -457,9 +456,9 @@ The core is framework-agnostic — `createSpyFromClass` / `createAutoMock` work
457
456
  subpaths below add a natural import and, where the framework has class DI, a tiny `provide*` helper.
458
457
  None of them pull the framework into this package; they're recipes over the same core.
459
458
 
460
- > **Angular** (`vitest-auto-spy/angular`) is published today. The **NestJS, React, Vue/Pinia and
461
- > Svelte** entry points ship in the next release ([Availability](#availability)) — until then you
462
- > can copy the recipe using the core `vitest-auto-spy` import directly.
459
+ > The **Angular**, **NestJS**, **React**, **Vue/Pinia** and **Svelte** entry points are all published
460
+ > ([Availability](#availability)). Each is a thin recipe over the same core, so you can equally copy it
461
+ > using the core `vitest-auto-spy` import directly.
463
462
 
464
463
  ### NestJS
465
464
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-auto-spy",
3
- "version": "1.4.0",
3
+ "version": "1.5.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",