Skip to content

test: unify testing strategy, CI parity, high-value coverage + gl-deprecation hardening#3779

Open
DennisSmolek wants to merge 1 commit into
v10from
testing-unification
Open

test: unify testing strategy, CI parity, high-value coverage + gl-deprecation hardening#3779
DennisSmolek wants to merge 1 commit into
v10from
testing-unification

Conversation

@DennisSmolek

Copy link
Copy Markdown
Member

Summary

Unifies and standardizes how R3F is tested, closes the biggest coverage gaps on the new v10 surfaces, and hardens one deprecation bug found along the way. Builds on the recent alpha.3 work (scheduler extraction, useTextures, the multi-canvas/HMR/background fixes).

What's here

Canonical testing guidedocs/development/TESTING.md rewritten as the single source of truth: a three-tier model (Tier 1 unit+mock in CI, Tier 2 browser/GPU pre-release gate, Tier 3 headless spike), local↔CI parity rules, test-organization conventions, coverage policy, and an open roadmap.

CI / local parity

  • verify-bundles + verify-types now run in test.yml (they were local-only via pnpm ci — CI could drift)
  • text-summary coverage reporter + coverage/ uploaded as a build artifact

High-value tests (~120 new; overall lines coverage ~78%)

  • Scheduler integration — render-phase takeover + fps end-to-end (drop: true/false), as integration with the external @pmndrs/scheduler (not its internals)
  • Canvas size control / textureColorSpace / gl deprecation warning path
  • Multi-canvas pure-JScanvasRegistry, renderer config-bag parser, ScopedStore Proxy semantics
  • EventsinteractivePriority, XR register/unregister, frame-timed edges (+ resolved a pre-existing it.todo)
  • WebGPU hook lifecycle via the WebGPUContext mock (useUniforms/useNodes/useBuffers/useGPUStorage/useRenderPipeline, now 62–90%) + useRenderTarget. GPU-only paths are left as it.todo tagged for Tier 2.
  • state.clock removal contract (v10 regression guard)

Refactor (behavior-preserving, for testability)

  • Extract the Canvas renderer config-bag parser into utils/parseRendererConfig.ts (mirrors parseBackground.ts; not re-exported)

Fix

  • Harden the state.gl deprecation heuristic (utils/isInternalRendererAccess.ts): inspect only the immediate caller frame with path-independent markers, replacing a brittle hard-coded repo-path substring that mis-fired for installed packages and any non-react-three-fiber-named checkout (R3F's own <Environment> read spuriously warned; in the canonical repo it suppressed all access).

Notes for reviewers

  • Two real source behaviors are captured as passing regression tests, not changed: NoColorSpace is unselectable via the config bag ('' || SRGBColorSpace), and the state.gl getter only lives on the initial store object.
  • 6 it.todos are all genuinely GPU-dependent (Tier 2), not skipped work.

Test plan

  • pnpm test → 43 files, 532 passed / 6 todo / 0 failed
  • pnpm typecheck, pnpm eslint, pnpm format all pass
  • pnpm build && pnpm verify-bundles && pnpm verify-types pass

Not included / follow-ups

  • Tier-2 Playwright harness (pnpm test:gpu) — strategy documented, harness not built
  • Coverage floor — deferred to stable (per roadmap)
  • Tier-3 headless-WebGPU CI spike

🤖 Generated with Claude Code

…rden gl deprecation

Canonical testing guide (docs/development/TESTING.md): three-tier model
(unit+mock / browser-GPU / headless spike), local<->CI parity rules, test
organization conventions, coverage policy, and an open roadmap.

CI / local parity:
- Run verify-bundles + verify-types in test.yml (matching the pnpm ci order)
- text-summary coverage reporter + upload coverage/ artifact

High-value tests (~120 new; lines coverage ~78%):
- scheduler integration: render-phase takeover + fps end-to-end (drop true/false),
  as integration with the external @pmndrs/scheduler package
- Canvas size control / textureColorSpace / gl deprecation warning path
- canvasRegistry / renderer config-bag parser / ScopedStore Proxy semantics
- events: interactivePriority, XR register/unregister, frame-timed edges
  (+ resolved a pre-existing it.todo)
- WebGPU hook lifecycle via the WebGPUContext mock (useUniforms/useNodes/
  useBuffers/useGPUStorage/useRenderPipeline) + useRenderTarget; GPU-only
  paths left as it.todo (Tier 2)
- v10 state.clock removal contract

Refactor (testability, behavior-preserving):
- Extract the Canvas renderer config-bag parser into utils/parseRendererConfig.ts

Fix:
- Harden the state.gl deprecation heuristic: extract utils/isInternalRendererAccess.ts
  that inspects only the immediate caller frame with path-independent markers,
  replacing a brittle hard-coded repo-path substring that mis-fired in installed
  packages and non-canonically-named checkouts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant