# Use Internals Di Seam Pattern For Test Injectable Functions

> use _internals DI seam pattern for test-injectable functions

- Skill: `zaxbysauce/use-internals-di-seam-pattern-for-test-injectable-functions` (Agent Skill)
- Install (CLI): `npx skillmds@latest add zaxbysauce/use-internals-di-seam-pattern-for-test-injectable-functions`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zaxbysauce/use-internals-di-seam-pattern-for-test-injectable-functions/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: zaxbysauce (https://skillmd.com/u/zaxbysauce)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zaxbysauce/use-internals-di-seam-pattern-for-test-injectable-functions

---


<!-- generated by opencode-swarm skill-generator. Do not edit by hand; edits will be preserved on regeneration only with controlled update mode. -->

# 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().

