feat(test-utils): Add vitest entry + tape backward compat by chrisgervang · Pull Request #10061 · visgl/deck.gl

cursor[bot]

cursor[bot]

cursor[bot]

chrisgervang

cursor[bot]

cursor[bot]

cursor[bot]

cursor[bot]

- Add @deck.gl/test-utils/vitest entry point with vi.spyOn as default spy factory
- Add @deck.gl/test-utils/tape entry point with probe.gl makeSpy default (with deprecation warning)
- Extract SpyFactory abstraction in lifecycle-test.ts for spy provider flexibility
- Add tape-compat and vitest-entry smoke tests to verify both paths work
- Update package.json exports to support both entry points
- Add vitest 4.0.18 as optional peer dependency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The eslint-plugin-import namespace rule fails parsing vite module internals.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The index.ts was exporting directly from lifecycle-test.ts which requires
createSpy, breaking existing tests. Now exports from tape.ts which provides
a default spy factory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Restore JSDoc comments that were stripped from lifecycle-test.ts
- Add 'called' property to Spy type for TypeScript compatibility with probe.gl spies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Restore original lifecycle-test.ts and reapply minimal SpyFactory
abstraction changes to avoid unintended formatting modifications.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…py cleanup

- Remove vitest-specific restoreSpy from core lifecycle-test.ts
- Add ResetSpy type and resetSpy option to TestLayerOptions
- tape.ts: default resetSpy calls spy.reset() (preserves original behavior)
- vitest.ts: default resetSpy calls spy.mockRestore()

This keeps the core library framework-agnostic by letting each entry
point define its own spy cleanup behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both createSpy and resetSpy now warn users to explicitly pass them,
guiding migration to framework-specific spy handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Avoids triggering deprecation warning during CI by explicitly
passing resetSpy alongside createSpy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tions

Add cleanupAfterLayerTestsAsync() that yields to the event loop before
destroying WebGL resources. This prevents "getProgramInfoLog" errors from
luma.gl's async shader error reporting trying to access already-destroyed
WebGLProgram handles.

Also removes unused imports from setup-gl.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

felixpalmer

@chrisgervang @claude

- Use master versions for all dependencies
- Keep shared getResourceCountDelta() helper to avoid duplication
- Include timeout duration in test-runner error messages
- Remove redundant tape-compat.ts (covered by master's tape-compat.spec.ts)
- Accept master's full vitest.config.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

cursor[bot]

@chrisgervang