refactor(capture-kit): colocate fifteen tests with the modules they test
Summary
Colocation renames for capture-kit: 15 test files that were not beside a module they are named for. Two fixtures follow the tests that use them. No fixture export is dropped here (the remaining capture-kit fixture exports need test-kit and come later); the only package manifest edit is the new target path of the snapshot-presentation-ios-transitions-fixtures export.
The rule thread's colocation baseline and R83 list are not on main yet. This PR only shrinks what the seed will contain: capture-kit 15 → 0 colocation offenders.
Commits
refactor(tests): name capture-kit tests for the module they test— puregit mv. Content changes are import specifiers only (self-package and barrel imports become the defining module;../snapshot-freshness/and../../../ios-snapshot-engine/prefixes drop), plus references to the old paths (macOS workflow, ADR 0026, a comment inprojection.ts).oxfmtalso collapsed one import inrecovery.test.tsonto a single line.refactor(capture-kit): split the host-support checks out of the recording scripts test— the only non-move.
Renames
| Old | New | Module under test |
|---|---|---|
capture-admission/__tests__/screen-recording-boundary-faults | durable-capture-resource-boundary-faults | durable-capture-resource.ts (createDurableCaptureResource) |
ios-snapshot-engine/conformance | engine-conformance | engine.ts |
ios-snapshot-engine/eligibility-parity | engine-eligibility-parity | engine.ts |
ios-snapshot-engine/properties | engine-properties | engine.ts |
ios-snapshot-engine/mapping | semantic-index-mapping | semantic-index.ts |
ios-snapshot-engine/presentation | semantic-index-presentation | semantic-index.ts |
snapshot/__tests__/ax-digest | snapshot-evidence-ax-digest | snapshot-evidence.ts (computeAxDigest) |
snapshot/__tests__/snapshot-actions-identity | snapshot-diff-actions-identity | snapshot-diff.ts |
snapshot/snapshot-presentation/warnings | quality-warnings | quality-warnings.ts |
snapshot-sibling-sized-chrome | snapshot-occlusion-sibling-sized-chrome | snapshot-occlusion.ts (its header already calls it a family of snapshot-occlusion.test.ts) |
snapshot/__tests__/snapshot-freshness | snapshot/snapshot-freshness/android.test.ts | snapshot-freshness/android.ts |
snapshot/__tests__/snapshot-freshness-recovery | snapshot/snapshot-freshness/recovery.test.ts | snapshot-freshness/recovery.ts |
snapshot/snapshot-presentation/ios/action-shelf | ios-snapshot-engine/action-shelf.test.ts | ios-snapshot-engine/action-shelf.ts (behavior reached through buildIosInteractiveSnapshotPresentation in semantic-index.ts) |
snapshot/snapshot-presentation/ios/rows | ios-snapshot-engine/rows.test.ts | ios-snapshot-engine/rows.ts (same) |
recording/__tests__/recording-scripts | split: swift-cache-recording-scripts, overlay-host-support, contact-sheet-frames-host-support | swift-cache.ts (it locates the Swift scripts), overlay.ts, contact-sheet-frames.ts |
The engine-* tests previously imported through ios-snapshot-engine/index.ts; they now import engine.ts / types.ts directly. rows.fixtures.ts and transitions.fixtures.ts moved with their tests (the old snapshot-presentation/ios/ directory is gone); the transitions fixture is still exported for one root test and is a later test-kit candidate.
Judgment call to check: swift-cache-recording-scripts type-checks and exercises the Swift sources under apple/runner/.../RecordingScripts; swift-cache.ts is the TS module that owns that directory, so I named it for that. If you'd rather count it as a non-module test, say so and I'll leave it out of the baseline instead.
Test-count parity (vitest --reporter=json, passed/total)
| Before | After |
|---|---|
screen-recording-boundary-faults 4/4 | durable-capture-resource-boundary-faults 4/4 |
conformance 8/8 | engine-conformance 8/8 |
eligibility-parity 4/4 | engine-eligibility-parity 4/4 |
properties 5/5 | engine-properties 5/5 |
mapping 1/1 | semantic-index-mapping 1/1 |
presentation 21/21 | semantic-index-presentation 21/21 |
ax-digest 10/10 | snapshot-evidence-ax-digest 10/10 |
snapshot-actions-identity 4/4 | snapshot-diff-actions-identity 4/4 |
warnings 17/17 | quality-warnings 17/17 |
snapshot-sibling-sized-chrome 25/25 | snapshot-occlusion-sibling-sized-chrome 25/25 |
snapshot-freshness 10/10 | snapshot-freshness/android 10/10 |
snapshot-freshness-recovery 5/5 | snapshot-freshness/recovery 5/5 |
action-shelf 3/3 | action-shelf 3/3 |
rows 2/2 | rows 2/2 |
recording-scripts 8/8 | swift-cache-recording-scripts 6/6 + overlay-host-support 1/1 + contact-sheet-frames-host-support 1/1 |
| 127/127 in 15 files | 127/127 in 17 files |
Selection: all paths are under packages/*/src/**, which the unit-core include covers. Because packages/capture-kit/package.json changed, check:affected --run fell back to the full test set, so every moved file ran in context (15,485 tests passed).
vi.mock effectiveness
None of the moved files use vi.mock (the only vi.mock in the touched directories is in overlay.test.ts, which did not move).
Surface
exportscounts before → after: capture-kit 83 → 83. Thesnapshot-presentation-ios-transitions-fixturesexport keeps its key and points at the moved file; no subpath added or removed, no barrels.- Colocation offenders: capture-kit 15 → 0.
Gates
pnpm check:quick, check:layering, check:fallow, check:gate-manifest pass; pnpm format leaves a clean tree. pnpm check:affected --run ran the full set: 15,485 passed, 1 failed — scripts/__tests__/eager-closure-budgets.test.ts > no APPROVED_OVER_CEILING row is stale (packages/daemon/src/index.ts). That failure is not from this change: it fails identically on a checkout of origin/main plus only the PR #3648 renames (no daemon file touched), so it comes from the daemon single-entry work already on main (#3633). The daemon thread owns the fix.
🤖 Generated with Claude Code