vitest-auto-spy 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +12 -5
- package/README.md +16 -6
- package/dist/cli.js +1 -1
- package/dist/eslint-plugin.cjs +1 -1
- package/package.json +1 -1
- package/skills/vitest-auto-spy/SKILL.md +8 -2
package/AGENTS.md
CHANGED
|
@@ -2485,17 +2485,24 @@ blanket downgrade so those keep their severity; do not copy the two names into a
|
|
|
2485
2485
|
| `no-dead-schemas` | `error` | — | `schemas` on a testing module with no `declarations` — the schema applies to nothing; the file decides, so a `declarations` in another `configureTestingModule` call silences it |
|
|
2486
2486
|
| `no-import-time-spread` | `error` | suggest | `export const x = [...Imported]` at module scope → a `TypeError` while the bundle loads |
|
|
2487
2487
|
| `no-unregistered-inject-spy` | `error` | — | `injectSpy(X)` for a token this file never registered → the real instance, whose spy helpers exist only for the compiler |
|
|
2488
|
-
| `prefer-render-shallow` | `
|
|
2488
|
+
| `prefer-render-shallow` | `warn` | suggest | `TestBed.createComponent` in a file that never reads the template → `renderShallow(X)`; 0.24× the per-test cycle at 100 children |
|
|
2489
2489
|
| `prefer-observer-stub` | `error` | — | a hand-rolled observer global → `stubIntersectionObserver()` / `stubResizeObserver()` / `stubMutationObserver()`; the manual save-and-restore goes too, `restoreMockedProps()` runs the undo |
|
|
2490
2490
|
| `jasmine-namespace-without-entry` | `error` | — | `.and` / `.calls` / `.withArgs` on a library spy in a file that installs the compat layer nowhere — option: `{ setupModules: […] }` |
|
|
2491
2491
|
| `no-jasmine-globals` | `error` | — | `jasmine.*`, bare `spyOn(` / `spyOnProperty(` / `spyOnAllFunctions(` / `fail(` / `pending(`, `.withContext(` |
|
|
2492
2492
|
| `no-save-arguments-by-value` | `error` | — | `spy.calls.saveArgumentsByValue()` — a no-op here, so the spec silently asserts on post-mutation state |
|
|
2493
2493
|
| `prefer-native-spy-api` | `error` | `--fix` / suggest | `.and` / `.calls` where the spy's own API says the same thing — turn it on for the last mile off the jasmine shim |
|
|
2494
2494
|
|
|
2495
|
-
Twenty-three rules, **every one an `error` since 4.0.0
|
|
2496
|
-
suggestions. Twenty-two are syntactic; `no-private-member-access` is the one
|
|
2497
|
-
reports nothing at all without `parserOptions.project` / `projectService`
|
|
2498
|
-
|
|
2495
|
+
Twenty-three rules, **every one an `error` since 4.0.0 except `prefer-render-shallow`**; three fix on
|
|
2496
|
+
their own, eight offer suggestions. Twenty-two are syntactic; `no-private-member-access` is the one
|
|
2497
|
+
that reads types, and it reports nothing at all without `parserOptions.project` / `projectService`
|
|
2498
|
+
rather than guessing. The config used to be a graded mix of `error` / `warn` / `off`, which decided for the
|
|
2499
|
+
consumer how much each finding mattered — a `warn` nothing reads is `off` with extra output. The one
|
|
2500
|
+
`warn` left is not a judgement about how much that finding matters but about what kind of finding it
|
|
2501
|
+
is: every other rule names something wrong or dead, while `prefer-render-shallow` names a file that
|
|
2502
|
+
could render more cheaply, and `renderShallow` is a migration a suite either takes or does not. At
|
|
2503
|
+
`error` the plugin would gate that migration — 491 findings across 398 of one consumer's 1759 spec
|
|
2504
|
+
files — so `recommended` would exist to be overridden. Set it to `'error'` once the project has decided
|
|
2505
|
+
to make the move. Three of
|
|
2499
2506
|
them can report on a _correct_ project, and only one has an option:
|
|
2500
2507
|
`jasmine-namespace-without-entry` takes `['error', { setupModules: ['./test-setup'] }]`, naming the
|
|
2501
2508
|
file where `enableJasmineCompat()` is called; `prefer-native-spy-api` goes `'off'` for as long as a
|
package/README.md
CHANGED
|
@@ -3026,11 +3026,11 @@ import autoSpy from 'vitest-auto-spy/eslint-plugin';
|
|
|
3026
3026
|
export default [{ files: ['**/*.spec.ts'], ...autoSpy.configs.recommended }];
|
|
3027
3027
|
```
|
|
3028
3028
|
|
|
3029
|
-
**Every rule is an `error` since 4.0.0.** The config used to grade them `error` / `warn` /
|
|
3030
|
-
which chose for you how much each finding mattered; a `warn` in a repository that does not read
|
|
3031
|
-
output is `off` with extra noise, and which findings block a merge is one line of config either
|
|
3032
|
-
To turn one down, spread the rule map as well — a bare `rules` key beside the spread config
|
|
3033
|
-
it rather than merging, silently:
|
|
3029
|
+
**Every rule is an `error` since 4.0.0, bar one.** The config used to grade them `error` / `warn` /
|
|
3030
|
+
`off`, which chose for you how much each finding mattered; a `warn` in a repository that does not read
|
|
3031
|
+
lint output is `off` with extra noise, and which findings block a merge is one line of config either
|
|
3032
|
+
way. To turn one down, spread the rule map as well — a bare `rules` key beside the spread config
|
|
3033
|
+
replaces it rather than merging, silently:
|
|
3034
3034
|
|
|
3035
3035
|
```js
|
|
3036
3036
|
export default [
|
|
@@ -3042,6 +3042,16 @@ export default [
|
|
|
3042
3042
|
];
|
|
3043
3043
|
```
|
|
3044
3044
|
|
|
3045
|
+
The one exception is `prefer-render-shallow`, which ships as a **`warn`**, and the reason is the kind
|
|
3046
|
+
of thing it says rather than how much it matters. Every other rule here names something wrong or dead
|
|
3047
|
+
— a double that drifts from its class, an assertion that never runs, a provider the container already
|
|
3048
|
+
dropped, a schema guarding nothing. That one names a file that could render more cheaply, which is a
|
|
3049
|
+
choice a suite makes and not a defect in the file: moving onto `renderShallow` is a migration a
|
|
3050
|
+
project either takes or does not, and at `error` the plugin would be gating it. On the 1759-file suite
|
|
3051
|
+
it was measured against the rule reports 491 times across 398 files — a first run every consumer would
|
|
3052
|
+
have to answer with a project-wide `warn` of its own. A project that has decided to make the move sets
|
|
3053
|
+
it to `'error'` in the same one line that turns the others down.
|
|
3054
|
+
|
|
3045
3055
|
A second config, `autoSpy.configs.typeErrors`, holds the subset whose findings are compile errors
|
|
3046
3056
|
(`prefer-as-spy` is `TS2352`, `no-mocked-for-spy` is `TS2322`). Spread it **after** a blanket
|
|
3047
3057
|
downgrade so those keep their severity — the recipe is a spread rather than rule names copied into
|
|
@@ -3075,7 +3085,7 @@ export can never be.
|
|
|
3075
3085
|
| `no-dead-schemas` | `error` | — | `schemas` on a testing module that declares nothing — a charm protecting nobody, and one that starts working the day `declarations` arrive |
|
|
3076
3086
|
| `no-import-time-spread` | `error` | suggest | `export const x = [...Imported]` at module scope → a `TypeError` while the bundle loads |
|
|
3077
3087
|
| `no-unregistered-inject-spy` | `error` | — | `injectSpy(X)` for a token this file never registered → the real instance, whose spy helpers exist only for the compiler |
|
|
3078
|
-
| `prefer-render-shallow` | `
|
|
3088
|
+
| `prefer-render-shallow` | `warn` | suggest | `TestBed.createComponent` in a file that never reads the template → `renderShallow(X)`; 0.24× the per-test cycle at 100 children |
|
|
3079
3089
|
| `prefer-observer-stub` | `error` | — | a hand-rolled `IntersectionObserver` / `ResizeObserver` / `MutationObserver` written into a global → `stubIntersectionObserver()` and friends, whose undo `restoreMockedProps()` already runs |
|
|
3080
3090
|
| `jasmine-namespace-without-entry` | `error` | — | `.and` / `.calls` / `.withArgs` on a library spy in a file that installs the compatibility layer nowhere |
|
|
3081
3091
|
| `no-jasmine-globals` | `error` | — | `jasmine.*`, `spyOn(` / `spyOnProperty(` / `spyOnAllFunctions(` / `fail(` / `pending(`, `.withContext(` — none of them exist under Vitest |
|
package/dist/cli.js
CHANGED
|
@@ -2421,7 +2421,7 @@ function checkForeignPragma(graph) {
|
|
|
2421
2421
|
}
|
|
2422
2422
|
|
|
2423
2423
|
// src/cli/checks/export-map.generated.ts
|
|
2424
|
-
var EXPORT_MAP_VERSION = "5.
|
|
2424
|
+
var EXPORT_MAP_VERSION = "5.3.0";
|
|
2425
2425
|
var ENTRY_SPECIFIERS = "vitest-auto-spy vitest-auto-spy/bun vitest-auto-spy/bun-angular vitest-auto-spy/node vitest-auto-spy/rstest vitest-auto-spy/rxjs vitest-auto-spy/console vitest-auto-spy/dom-stubs vitest-auto-spy/diagnostics vitest-auto-spy/jasmine vitest-auto-spy/jasmine-compat vitest-auto-spy/observer-spy vitest-auto-spy/angular vitest-auto-spy/angular-http vitest-auto-spy/nestjs vitest-auto-spy/react vitest-auto-spy/vue vitest-auto-spy/svelte vitest-auto-spy/setup vitest-auto-spy/zone vitest-auto-spy/eslint-plugin";
|
|
2426
2426
|
var EXPORTED_BY = {
|
|
2427
2427
|
AccessorImplementations: "0 1 2 3 4 12 15 16 17",
|
package/dist/eslint-plugin.cjs
CHANGED
|
@@ -1968,7 +1968,7 @@ var recommendedRules = {
|
|
|
1968
1968
|
[`${PLUGIN_NAME}/no-dead-schemas`]: "error",
|
|
1969
1969
|
[`${PLUGIN_NAME}/no-import-time-spread`]: "error",
|
|
1970
1970
|
[`${PLUGIN_NAME}/no-unregistered-inject-spy`]: "error",
|
|
1971
|
-
[`${PLUGIN_NAME}/prefer-render-shallow`]: "
|
|
1971
|
+
[`${PLUGIN_NAME}/prefer-render-shallow`]: "warn",
|
|
1972
1972
|
[`${PLUGIN_NAME}/prefer-observer-stub`]: "error",
|
|
1973
1973
|
[`${PLUGIN_NAME}/jasmine-namespace-without-entry`]: "error",
|
|
1974
1974
|
[`${PLUGIN_NAME}/no-jasmine-globals`]: "error",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-auto-spy",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Auto-generate fully-typed test spies from a class — across Vitest, Bun, node:test and Rstest, with Angular/NestJS/React/Vue/Svelte recipes. Drop-in replacement for jest-auto-spies and jasmine-auto-spies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auto-mock",
|
|
@@ -370,8 +370,14 @@ forgot one is silent about it.
|
|
|
370
370
|
|
|
371
371
|
Four of those rules are for a suite mid-migration off `jasmine-auto-spies`:
|
|
372
372
|
`jasmine-namespace-without-entry`, `no-jasmine-globals`, `no-save-arguments-by-value`, and
|
|
373
|
-
`prefer-native-spy-api` — the last one
|
|
374
|
-
|
|
373
|
+
`prefer-native-spy-api` — the last one ships at `error` like the rest, and it is the one rule to set
|
|
374
|
+
to **`'off'`** yourself while the migration lasts, because it reports working bridge code. Turn it
|
|
375
|
+
back on for the last mile, once the suite is green, and not before.
|
|
376
|
+
|
|
377
|
+
**`prefer-render-shallow` is the only `warn` in `recommended`**, and the reason is what it reports:
|
|
378
|
+
every other rule names something wrong or dead, while this one names a spec that could render more
|
|
379
|
+
cheaply. Moving onto `renderShallow` is a suite's decision, not a repair, so it shows up in the output
|
|
380
|
+
without holding a build — set it to `'error'` once the project has taken that decision.
|
|
375
381
|
|
|
376
382
|
`doctor` is read-only. It reports what neither the runner nor the compiler can: a `tsconfig`
|
|
377
383
|
`include` pattern that matches no file, a production module importing a spec, a spec importing
|