Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/vinilana/dotcontext --skill test-generation명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
Implement or review bounded MCP inputs and responses. Use for gateway response helpers, MCP Zod schemas, list actions, cursor pagination, maxEvents, JSON serialization, audit logging, response metadata, artifact exports, or payload-size and client-compatibility changes.
Implement or review child-process execution with bounded stdout and stderr memory. Use for Node spawn wrappers, sensors, test runners, acceptance commands, timeout handling, output tails, truncation, or any change that captures subprocess output in the dotcontext harness.
Design, implement, or review bounded cache and persistent-index lifecycle. Use for ContextCache, SemanticContextBuilder, tree-sitter analysis cache, MCP session cache, hook host-session bindings, checkpoints, TTL, LRU, byte budgets, invalidation, cleanup timers, disposal, migration, or runtime retention configuration.
SOC 직업 분류 기준
| type | skill |
| name | Test Generation |
| description | Generate comprehensive test cases for code |
| skillSlug | test-generation |
| phases | ["E","V"] |
| generated | "2026-03-18T00:00:00.000Z" |
| status | filled |
| scaffoldVersion | 2.0.0 |
Generate and maintain tests for the @dotcontext/cli project using Jest with ts-jest.
jest.config.js at project root*.test.ts) or in __tests__/ directories**/__tests__/**/*.ts, **/?(*.)+(spec|test).tssrc/# Run all tests
npm test
# Run specific test file
npx jest src/services/mcp/mcpServer.test.ts
# Run tests matching a pattern
npx jest --testPathPattern="mcp"
# Run with coverage
npx jest --coverage
Services are the most common test target. Follow the pattern in current service and MCP tests:
import * as os from 'os';
import * as path from 'path';
import * as fs from 'fs-extra';
import { MyService } from './myService';
import type { CLIInterface } from '../../utils/cliUI';
import type { TranslateFn } from '../../utils/i18n';
// Create temp directory for isolation
let tempDir: string;
beforeEach(async () => {
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'test-'));
});
afterEach(async () => {
await fs.remove(tempDir);
});
// Mock CLI interface
function createMockUI(): CLIInterface {
return {
displayWelcome: jest.fn(),
displayProjectInfo: jest.fn(),
displayStep: jest.(),
: jest.(),
: jest.(),
: jest.(),
};
}
: = ( key) ;
Key patterns:
fs.mkdtemp() and clean up in afterEachjest.fn() for each method(key) => keyjest.mock() at module level for filesystem, prompt loaders, or MCP helpersTest handlers directly, not through MCP transport:
import { handleExplore, ExploreParams } from './gateway/explore';
describe('handleExplore', () => {
let tempDir: string;
beforeEach(async () => {
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'explore-'));
await fs.writeFile(path.join(tempDir, 'test.ts'), 'export const x = 1;');
});
afterEach(async () => {
await fs.remove(tempDir);
});
it('should read a file', async () => {
const result = await handleExplore(
{ action: 'read', filePath: path.join(tempDir, 'test.ts') },
{ repoPath: tempDir }
);
const payload = JSON.parse(result.content[0].text);
expect(payload.success).toBe(true);
expect(payload.).();
});
(, () => {
result = (
{ : , : path.(tempDir, ) },
{ : tempDir }
);
(result.).();
});
});
Test that generators produce correct file structures:
import { SkillGenerator } from './skillGenerator';
describe('SkillGenerator', () => {
let tempDir: string;
beforeEach(async () => {
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'gen-'));
});
it('should generate skill directories', async () => {
const generator = new SkillGenerator({ repoPath: tempDir });
const result = await generator.generate({ skills: ['commit-message'] });
expect(result.generatedSkills).toContain('commit-message');
expect(fs.existsSync(path.join(tempDir, '.context/skills/commit-message/SKILL.md'))).toBe(true);
});
it('should skip existing skills when force is false', async () => {
const generator = new SkillGenerator({ repoPath: tempDir });
await generator.generate({ : [] });
result = generator.({ : [], : });
(result.).();
});
});
Test pure functions directly:
import { parseFrontMatter, isScaffoldFrontmatter } from './frontMatter';
describe('frontMatter', () => {
it('should parse v2 scaffold frontmatter', () => {
const content = `---
type: skill
name: Test
status: filled
scaffoldVersion: "2.0.0"
---
# Content`;
const result = parseFrontMatter(content);
expect(isScaffoldFrontmatter(result)).toBe(true);
expect(result.status).toBe('filled');
});
});
Test phase transitions and gate logic:
import { GateChecker } from './gateChecker';
describe('GateChecker', () => {
it('should block P->R transition when plan required but missing', () => {
const checker = new GateChecker({ require_plan: true });
const result = checker.canAdvance('P', 'R', { hasPlan: false });
expect(result.allowed).toBe(false);
expect(result.reason).toContain('plan');
});
});
| Dependency | Mock Strategy | Example |
|---|---|---|
| MCP tools / gateway helpers | jest.mock() at module level | MCP service tests |
| File system (for isolation) | Use fs.mkdtemp() temp dirs | All service tests |
| Prompt loader | jest.mock('../../utils/promptLoader') | Return test prompt |
| CLI interface | Manual mock object | createMockUI() helper |
| Translate function | Passthrough (key) => key | All CLI-facing tests |
| tree-sitter (optional dep) | Test with and without | Semantic analysis tests |
__tests__/<name>.test.tsbeforeEach, removed in afterEachnpm run build)For end-to-end testing of current interfaces, see src/cli.test.ts and src/services/mcp/mcpServer.test.ts:
// Integration tests verify current CLI help surfaces and MCP tool registration
Integration tests are slower and may require:
.context/ directory structureRun integration tests separately if needed:
npx jest --testPathPattern="integration"