tdd
Test-driven development with vertical tracer-bullet slices. Use when the user wants TDD or red-green-refactor on a vertical slice.
- License 许可
- MIT
- 最近更新
- 2026-11-01
- Stars
- ★ 4
- Forks
- 0
01 前言 Front Matter
- name
- tdd
- description
- Test-driven development with vertical tracer-bullet slices. Use when the user wants TDD or red-green-refactor on a vertical slice.
02 资源文件 1
- 参考文档PATTERNS.md3.8 KB
03 SKILL.md 正文
Test-driven development
Vertical RED→GREEN cycles — one behavior per loop, not horizontal "all tests then all code". Aligns with tracer-bullets and verify-after-each-step.
This repo
- Runner split per
docs/architecture.md§ Test matrix:bun run test— fans out to every workspace'ssrc/**/*.test.tsunit tests (core engine + framework adapter binding, with the framework module mocked or scoped). No DOM.bun run test:dom—packages/*/tests-dom/**(vitest + jsdom + each adapter's testing library) for real-renderer reactivity, outlet/render, and wrapper behavior.
- Co-locate tests next to the module (
packages/core/src/layerStack.ts→packages/core/src/layerStack.test.ts). - After each GREEN: format/lint/typecheck per
verify-after-each-step. - Mock at the framework module seam in adapter tests (stub
solid-js/@angular/core/preact/compat, or scope viaeffectScope/createRoot), never insidepackages/core/src/. SeePATTERNS.md.
Workflow
1. Planning
Confirm behaviors to test (not implementation steps) with the user. Prefer deep modules — small public surface (LayerClient.open, LayerStack, layerOptions), complex internals (phase machine, scope queue, gcTime cache, batched notify).
Done when: the behaviors under test are confirmed with the user as observable outcomes through a public seam — not implementation steps.
2. Tracer bullet (within slice)
RED: one test for first behavior → bun test <file> (or test:dom for DOM/render behavior)
GREEN: minimal code to pass → re-run
Done when: the first behavior has gone RED then GREEN on its touched test file.
3. Incremental loop
For each behavior: RED → GREEN → run affected tests. One test at a time; no speculative features.
Done when: every planned behavior has its own RED→GREEN cycle and the affected tests pass.
4. Refactor
After GREEN — look for duplication, long methods, shallow modules, feature envy. Run bun test <file> after each step. Never refactor while RED. For production polish on a completed slice, harden-pr lite may run in parallel with tracer-bullet commits.
Done when: duplication and shallow-module smells in the slice are resolved with tests green throughout.
Checklist per cycle
[ ] Test describes behavior, not implementation
[ ] Test uses the public seam only (LayerClient.open / LayerStack / layerOptions / useStack)
[ ] Test would survive an internal refactor
[ ] Code is minimal for this test
[ ] bun test (or test:dom) passes on touched file(s)
Reference
- Good/bad test patterns + mock boundaries:
PATTERNS.md - Slice cadence:
tracer-bullets· Verify:verify-after-each-step
04 同仓库更多 Skills
vue-layers
Vue adapter for @stainless-code/vue-layers; open UI from anywhere and manage ordered, named stacks with typed or fire-and-forget `open`
svelte-layers
Svelte bindings for @stainless-code/svelte-layers (runes + stores). Use to open overlay UI imperatively from anywhere, manage ordered named stacks, choose the Svelte 5.7+ runes or Svelte 3+ stores entry, and wire layer context or stack outlets.
solid-layers
SolidJS adapter for @stainless-code/solid-layers; open UI from anywhere and manage ordered, named stacks with typed or fire-and-forget `open`
react-layers
React adapter for @stainless-code/react-layers; open UI from anywhere and manage ordered, named stacks with typed or fire-and-forget `open`
preact-layers
Preact adapter for @stainless-code/preact-layers — use for awaitable confirm flows, singleton toasts, nested drawers, stack subscriptions, and custom layer hosts
lit-layers
Lit adapter for @stainless-code/lit-layers; open UI from anywhere and manage ordered, named stacks with typed or fire-and-forget `open` via Reactive Controllers and custom elements