Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@suaveplan/test-vite - Vite + Vitest configuration factories and validators: createViteLibraryConfig/createViteAppConfig/createVitestConfig/createVitestBrowserConfig, browser-environment shims, tree-shake validator, bundle-size snapshot, port allocator, HMR tester, custom matchers, TEST_VITE_CODES error registry, and OTel self-telemetry.
Vite + Vitest configuration factories and validators for Suaveplan: createViteLibraryConfig, createViteAppConfig, createVitestConfig, createVitestBrowserConfig, setupBrowserEnvironment, tree-shake validator, bundle-size snapshot, port allocator, HMR tester, custom matchers, TEST_VITE_CODES error registry, and OTel self-telemetry.
Documentation tree
- browser-environment —
setupBrowserEnvironmentinstalls the DOM and Web-platform shims that suaveplan browser packages depend on when running…- browser-environment —
setupBrowserEnvironmentinstalls the DOM and Web-platform shims that suaveplan browser packages depend on when running…
- browser-environment —
- bundle-size-snapshot —
snapshotBundleSizecompares the byte size of an emitted bundle against a previously-recorded snapshot file and enforc…- bundle-size-snapshot —
snapshotBundleSizecompares the byte size of an emitted bundle against a previously-recorded snapshot file and enforc…
- bundle-size-snapshot —
- error-codes —
error-codesexports the canonical stable error-code registry used by every other module in@suaveplan/test-vite. Th…- error-codes —
error-codesexports the canonical stable error-code registry used by every other module in@suaveplan/test-vite. Th…
- error-codes —
- hmr-tester —
withHMRround-trips a single Vite HMR edit through an injectableHmrServerLikeadapter and asserts that the expecte…- hmr-tester —
withHMRround-trips a single Vite HMR edit through an injectableHmrServerLikeadapter and asserts that the expecte…
- hmr-tester —
- matchers —
createMatchersreturns a bundle of typedexpect.extendmatchers used across suaveplan browser-tier test suites. The m…- matchers —
createMatchersreturns a bundle of typedexpect.extendmatchers used across suaveplan browser-tier test suites. The m…
- matchers —
- port-allocator —
createPortAllocatorbuilds a deterministic port allocator over a contiguous TCP range backed by an injectable store.…- port-allocator —
createPortAllocatorbuilds a deterministic port allocator over a contiguous TCP range backed by an injectable store.…
- port-allocator —
- telemetry —
telemetryregisters the OTel meter for@suaveplan/test-viteand exposes the counters and histogram that every other…- telemetry —
telemetryregisters the OTel meter for@suaveplan/test-viteand exposes the counters and histogram that every other…
- telemetry —
- tree-shake-validator —
verifyTreeShakereads a built bundle and asserts that its set of exported symbols matches the caller-supplied allow-l…- tree-shake-validator —
verifyTreeShakereads a built bundle and asserts that its set of exported symbols matches the caller-supplied allow-l…
- tree-shake-validator —
- vite-app-config —
createViteAppConfigbuilds a ViteUserConfigtailored for consumer applications rather than library packages. It de…- vite-app-config —
createViteAppConfigbuilds a ViteUserConfigtailored for consumer applications rather than library packages. It de…
- vite-app-config —
- vite-library-config —
createViteLibraryConfigbuilds an opinionated ViteUserConfigsuitable for any@suaveplan/*library package. It e…- vite-library-config —
createViteLibraryConfigbuilds an opinionated ViteUserConfigsuitable for any@suaveplan/*library package. It e…
- vite-library-config —
- vitest-browser-config —
createVitestBrowserConfigbuilds a Vitest configuration that drives tests through Playwright in real browsers. The fa…- vitest-browser-config —
createVitestBrowserConfigbuilds a Vitest configuration that drives tests through Playwright in real browsers. The fa…
- vitest-browser-config —
- vitest-config —
createVitestConfigreturns a WSL2-safe Vitest configuration with the suaveplan enterprise contract baked in. The factor…- vitest-config —
createVitestConfigreturns a WSL2-safe Vitest configuration with the suaveplan enterprise contract baked in. The factor…
- vitest-config —
Why
Every browser-tier Suaveplan package needs the same Vite library build + WSL2-safe Vitest configuration. Inlining that copy across hundreds of packages is brittle — when the project learns a new safety default (Istanbul, pool: 'forks', fileParallelism, the external baseline), each package has to be updated by hand. @suaveplan/test-vite owns those factories in one place.
Features
- Opinionated Vite library build (
createViteLibraryConfig) withpreserveModules, dts emission, and theexternalbaseline (/^@suaveplan\//,/^node:/,'tslib'). - Vite consumer-app config (
createViteAppConfig) with hashed assets andenvPrefix. - WSL2-safe Vitest config (
createVitestConfig) —pool: 'forks', Istanbul provider, 100/100/100/100 thresholds. - Browser-mode Vitest config (
createVitestBrowserConfig) driven by Playwright. - DOM shims (
setupBrowserEnvironment) — idempotent installer forlocalStorage,matchMedia,ResizeObserver,IntersectionObserver,crypto. - Tree-shake validator (
verifyTreeShake) — guard the exported-symbol set. - Bundle-size snapshot (
snapshotBundleSize) — track build-size drift with tolerance. - Port allocator (
createPortAllocator) — coordinate parallel servers on WSL2. - HMR tester (
withHMR) — round-trip a Vite HMR cycle in tests. - Typed
expect.extendmatchers —toBeAccessibleNode,toMatchDataURL,toHaveValidCSSVars. - Stable
TEST_VITE_CODESregistry +TestViteError. - OTel self-telemetry — counters + histogram, no-op when no provider is registered.
Install
import { createViteLibraryConfig } from "@suaveplan/test-vite/vite-library-config";
import { createVitestConfig } from "@suaveplan/test-vite/vitest-config";
Every feature module is its own subpath export for tree-shake friendliness.
License
MIT