@happyvertical/smrt-vitest 0.57.45 → 0.57.47
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 +56 -2
- package/README.md +13 -11
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +75 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +459 -71
- package/dist/index.js.map +1 -1
- package/dist/test-db.d.ts +19 -5
- package/dist/test-db.d.ts.map +1 -1
- package/dist/test-db.js +37 -13
- package/dist/test-db.js.map +1 -1
- package/package.json +3 -3
package/AGENTS.md
CHANGED
|
@@ -18,12 +18,41 @@ Without the plugin → "unregistered class" / "No field metadata found" errors.
|
|
|
18
18
|
|
|
19
19
|
## What the Plugin Does
|
|
20
20
|
|
|
21
|
-
1. Scans `src/**/*.ts` for SMRT classes via ManifestBuilder
|
|
21
|
+
1. Scans `src/**/*.ts` for SMRT classes via ManifestBuilder into this run's
|
|
22
|
+
test manifest snapshot (see below)
|
|
22
23
|
2. Discovers `@happyvertical/smrt-*` dependencies from package.json
|
|
23
24
|
3. Loads external manifests via ManifestManager
|
|
24
25
|
4. Registers all classes in ObjectRegistry
|
|
25
26
|
5. Watch mode caveat: manifest only generated at startup — restart vitest after adding new classes/fields
|
|
26
27
|
|
|
28
|
+
## Test manifest snapshot (#4128)
|
|
29
|
+
|
|
30
|
+
- Test generation is test-inclusive, so it writes only
|
|
31
|
+
`.smrt/test-runs/<pid>-<time>-<rand>/manifest.json` (`outputMode:
|
|
32
|
+
'explicit'`). `.smrt/manifest.json`, `dist/manifest.json` and paired
|
|
33
|
+
knowledge are production outputs; never write test output there, and do not
|
|
34
|
+
regenerate production knowledge from a test scan.
|
|
35
|
+
- `config()` publishes the path synchronously in
|
|
36
|
+
`__SMRT_TEST_MANIFEST_PATHS__` (keyed by root; core's
|
|
37
|
+
`test-artifacts.ts` owns the read side, parity tested) so forked workers
|
|
38
|
+
inherit it. `LocalManifestReader.loadLocal()`, the runtime manifest loader and
|
|
39
|
+
`createIsolatedTestDbFromManifest()` read it first for the registered root
|
|
40
|
+
only (a dependency's root matches only when its own run registered it).
|
|
41
|
+
- Tests inspecting generated metadata use `getTestManifestPath()`, not a
|
|
42
|
+
literal `.smrt/manifest.json`.
|
|
43
|
+
- Production consumers refuse `artifactPurpose: 'test'` manifests outside
|
|
44
|
+
their registered run (#2760), and worker bulk registration skips inline
|
|
45
|
+
`.test.`/`.spec.` entries (#2750); both are covered by nested-run regressions
|
|
46
|
+
(`issue-2760-test-then-cli-parity`, `issue-2750` fixture's
|
|
47
|
+
`inline-fixture.spec.ts`). Processes started outside the run — CLIs,
|
|
48
|
+
generated servers with a sanitized env — need a production manifest, never
|
|
49
|
+
the snapshot.
|
|
50
|
+
- The run directory is removed on process exit; startup prunes same-host
|
|
51
|
+
directories only once their owner PID is gone (any age), and directories
|
|
52
|
+
with an unprobeable owner (foreign host, missing `owner.json`) once older
|
|
53
|
+
than a day. Regression:
|
|
54
|
+
`src/__tests__/issue-4128-concurrent-build-isolation.test.ts`.
|
|
55
|
+
|
|
27
56
|
## Pool and isolation (#2897)
|
|
28
57
|
|
|
29
58
|
Measured on a 333-file, 3,259-test unit suite, 16 cores (follow-up to #2893):
|
|
@@ -49,6 +78,31 @@ Measured on a 333-file, 3,259-test unit suite, 16 cores (follow-up to #2893):
|
|
|
49
78
|
measurements. Lazy-loading `@happyvertical/ai` in core is the
|
|
50
79
|
isolation-preserving lever, tracked separately.
|
|
51
80
|
|
|
81
|
+
## Workspace source resolution (#2954)
|
|
82
|
+
|
|
83
|
+
- `getWorkspaceViteAliases()` aliases every exact JavaScript subpath each
|
|
84
|
+
workspace package exports from `dist/` to the source it is built from,
|
|
85
|
+
derived from that package's own `exports` map (`dist/<p>.js` ←
|
|
86
|
+
`src/<p>.ts`, `src/<p>.svelte.ts`, `src/<p>/index.ts`, or the same under
|
|
87
|
+
`src/lib/`). Hand-written entries in `src/index.ts` win, for layouts the
|
|
88
|
+
rule cannot infer. A new export is covered with no plugin edit;
|
|
89
|
+
`issue-2954-workspace-source-resolution.test.ts` fails if any dist export
|
|
90
|
+
has no derivable source.
|
|
91
|
+
- Workspace `setupFiles` specifiers are mapped to source too (Vitest resolves
|
|
92
|
+
them outside `resolve.alias`).
|
|
93
|
+
- The plugin is `enforce: 'pre'`, so its `resolveId` runs after Vite's alias
|
|
94
|
+
step but before Vite's own resolver. A workspace specifier the static
|
|
95
|
+
aliases did not rewrite (pattern exports such as smrt-ui `./utils/*`) is
|
|
96
|
+
mapped to its source per import; one whose exports-map target is built
|
|
97
|
+
JavaScript with no source fails the test, whether that dist file is stale
|
|
98
|
+
or missing. Exempt: packages a consumer resolves to published entries on
|
|
99
|
+
purpose (`aliasFilter` drops, or a config alias pointing at a `dist/`
|
|
100
|
+
file). Explicit file-path imports of a dist (runtime loaders under test)
|
|
101
|
+
are not specifier resolution and are left alone.
|
|
102
|
+
- Typecheck is separate: packages typechecked with their composite
|
|
103
|
+
`tsconfig.json` read sibling `.d.ts` from `dist/`; run `pnpm typecheck`
|
|
104
|
+
(Turbo builds dependencies first); source-resolving typecheck is #4556.
|
|
105
|
+
|
|
52
106
|
## Vite 8 (rolldown/oxc) normalization (#2017)
|
|
53
107
|
|
|
54
108
|
The plugin's `config` hook normalizes three vite 8 behaviors so consumers
|
|
@@ -240,4 +294,4 @@ Pattern: render → assert role/name/state → drive with user-event → prove a
|
|
|
240
294
|
- `src/svelte-setup.ts` — Svelte component-test setup (jest-dom, cleanup, dialog polyfill)
|
|
241
295
|
- `src/svelte.ts` — component-test surface (Testing Library + a11y, one import)
|
|
242
296
|
- `src/a11y.ts` — `expectNoA11yViolations` (axe-core)
|
|
243
|
-
- `src/test-db.ts` — createIsolatedTestDb, createIsolatedTestDbFromManifest, createTestDb
|
|
297
|
+
- `src/test-db.ts` — createIsolatedTestDb, createIsolatedTestDbFromManifest, createTestDb, getTestManifestPath
|
package/README.md
CHANGED
|
@@ -83,17 +83,19 @@ settings on vite 8.
|
|
|
83
83
|
|
|
84
84
|
The manifest is generated once at vitest startup. Restart vitest after adding new `@smrt()` classes or fields.
|
|
85
85
|
|
|
86
|
-
###
|
|
87
|
-
|
|
88
|
-
Test startup
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
### Test Manifest Snapshot
|
|
87
|
+
|
|
88
|
+
Test startup scans test-inclusive sources (inline `*.test.ts` fixture classes
|
|
89
|
+
need manifest metadata) and writes the result to a per-run snapshot,
|
|
90
|
+
`.smrt/test-runs/<run>/manifest.json`, never to `.smrt/manifest.json`,
|
|
91
|
+
`dist/manifest.json`, or their paired `smrt-knowledge.json` (#4128). Those
|
|
92
|
+
belong to production builds, so a build or typecheck running alongside a test
|
|
93
|
+
suite can neither replace the suite's manifest nor be replaced by it. Every
|
|
94
|
+
manifest read inside the run — worker registration, the runtime manifest
|
|
95
|
+
loader, `createIsolatedTestDbFromManifest()` — resolves the snapshot first;
|
|
96
|
+
tests that inspect generated metadata read `getTestManifestPath()`. The
|
|
97
|
+
snapshot directory is removed when the run exits, and directories left by
|
|
98
|
+
ended runs are pruned at the next startup.
|
|
97
99
|
|
|
98
100
|
### Pool and Isolation
|
|
99
101
|
|