2.4 KiB
2.4 KiB
Add @suaveplan/testing/runner central runner subpath
Package: @suaveplan/testing
Status: PROPOSED
Type: feature
Why
~95 packages currently import describe, it, expect, vi, and
expectTypeOf directly from vitest, which means the monorepo cannot
swap, wrap, or instrument the test runner without touching ~983 files.
@suaveplan/testing-dom/runner already provides this indirection for
DOM packages, but DOM/React-specific dependencies make it unsuitable as
the universal runner barrel. This change ports the same pattern into the
universal @suaveplan/testing package so every non-DOM package can
import the runner from one stable place.
What changes
- ADDED:
@suaveplan/testing/runnersubpath export (vitest by default,bun:testunder thebunpackage.json condition) - ADDED:
src/runner/index.ts,src/runner/vitest.ts,src/runner/bun-test.ts,src/runner/mocks.tsexportingdescribe,it,test,expect,expectTypeOf,vi,beforeAll,beforeEach,afterAll,afterEach,fn<TArgs, TReturn>,spy,stub,mock,fakeClock,restoreMocks,restoreTimers, plus typesRunnerMock,SpyHandle - ADDED:
expectTypeOfshim for the bun-test path (Proxy-backed no-op chain — type assertions are erased at compile time) - ADDED:
@types/bundevDependency,tsconfig.lib.jsontypesextended withbun, and matching vite multi-entry build wiring - ADDED:
runner/mocks.test.tsandrunner/runner.spec-conformance.test.ts
Out of scope
- Migrating ~983 vitest imports to the new subpath — handled in a follow-up codemod commit (genesis branch, same PR)
- DRY-linking
@suaveplan/testing-dom/runnerto this subpath — rule 8 forbidstesting-domfrom depending on@suaveplan/testing, so the two surfaces stay duplicated by design
Verification approach
src/runner/mocks.test.ts— unit coverage forfn/spy/stub/fakeClock/restoreMocks/restoreTimerssrc/runner/runner.spec-conformance.test.ts— type-level pins viaexpectTypeOfforRunnerMock<TArgs, TReturn>andSpyHandle- 5-gate triple (
bun run check,turbo lint typecheck test,turbo test:coverage100/100/100/100, openspec-conformance,turbo build) green for@suaveplan/testing
Migration impact
Additive only. No existing exports change. Consumers continue to import
the package barrel for utilities; the new ./runner subpath is the sole
addition.