use _internals DI seam pattern for test-injectable functions
Trigger
- (no explicit trigger metadata; cluster derived from category/tags)
Required Procedure
- use _internals DI seam pattern for test-injectable functions
- spread real module exports when mocking node built-ins (import * as real from 'node:module'; mock.module('node:module', () => ({ ...real, targetFn: mockFn })))
- verify mock isolation by running test files in combined mode, not individually
Forbidden Shortcuts
- rely on mock.module() isolation between test files in bun:test
- declare a test passing based solely on individual file execution
Delegation Template
When delegating a task affected by this skill, include:
SKILLS: file:.opencode/skills/generated/use-internals-di-seam-pattern-for-test-injectable-functions/SKILL.md
Reviewer Checks
- Verify each required action above appears in the diff.
Test Engineer Checks
- Add or update tests covering the trigger condition and the forbidden shortcut.
Source Knowledge IDs
- 8a374ec6-734e-4b34-9119-1b6148db3a1e — In Bun's shared test-runner process, mock.module() leaks across test files. Always use _internals DI seams or spread-real-exports for node:fs/child_process mocks instead of bare mock.module().