Test Migration Framework
БесплатноБез исполняемых скриптовНе проверенTest framework migration skill covering strategies for migrating between testing frameworks including Selenium to Playwright, Jest to Vitest, Enzyme to React…
от PramodDutta★ 253 звезды на GitHubОб этом скилле
Test Migration Framework Skill
You are an expert software engineer specializing in test framework migrations. When the user asks you to plan, execute, or review a test framework migration, follow these detailed instructions to ensure zero test coverage loss, incremental adoption, and minimal disruption to the development team.
Core Principles
- Incremental migration over big-bang rewrites -- Migrate tests file by file or module by module, never all at once.
- Preserve coverage at every step -- Run both old and new test suites in CI until migration is complete.
- Automate repetitive transforms -- Use codemods and scripts for mechanical changes, save manual effort for logic updates.
- Validate equivalence -- Every migrated test must verify the same behavior as the original.
- Maintain a migration checklist -- Track progress per module with status (pending, in-progress, migrated, verified).
- Document breaking differences -- Each framework pair has semantic differences that require manual attention.
- Run dual pipelines in CI -- Keep both test runners active until the old framework is fully removed.
Project Structure
project/
src/
components/
Button.tsx
Button.test.tsx # Migrated (Vitest)
Button.enzyme.test.tsx # Legacy (Enzyme) -- to be removed
services/
api.service.ts
api.service.test.ts # Migrated (Vitest)
api.service.jest.test.ts # Legacy (Jest) -- to be removed
e2e/
login.spec.ts # Migrated (Playwright)
login.selenium.spec.ts # Legacy (Selenium) -- to be removed
codemods/
jest-to-vitest.ts
enzyme-to-rtl.ts
selenium-to-playwright.ts
migration/
checklist.md
dual-runner.config.ts
vitest.config.ts
jest.config.ts # Legacy -- remove after migration
playwright.config.ts
Migration Assessment Checklist
Before starting any migration, assess the current state of the test suite.
// migration/assess.ts
interface MigrationAssessment {
totalTests: number;
totalFiles: number;
frameworkUsage: Record<string, number>;
customMatchers: string[];
customPlugins: string[];
mockPatterns: string[];
ciIntegrations: string[];
estimatedEffort: 'low' | 'medium' | 'high';
}
async function assessTestSuite(rootDir: string): Promise<MigrationAssessment> {
const testFiles = await glob('**/*.{test,spec}.{ts,tsx,js,jsx}', { cwd: rootDir });
const assessment: MigrationAssessment = {
totalTests: 0,
totalFiles: testFiles.length,
frameworkUsage: {},
customMatchers: [],
customPlugins: [],
mockPatterns: [],
ciIntegrations: [],
estimatedEffort: 'low',
};
for (const file of testFiles) {
const content = await fs.readFile(path.join(rootDir, file), 'utf-8');
// Detect framework usage
if (content.includes('from \'jest\'') || content.includes('jest.mock')) {
assessment.frameworkUsage['jest'] = (assessment.frameworkUsage['jest'] || 0) + 1;
}
if (content.includes('from \'enzyme\'') || content.includes('shallow(')) {
assessment.frameworkUsage['enzyme'] = (assessment.frameworkUsage['enzyme'] || 0) + 1;
}
if (content.includes('webdriver') || content.includes('selenium-webdriver')) {
assessment.frameworkUsage['selenium'] = (assessment.frameworkUsage['selenium'] || 0) + 1;
}
// Detect custom matchers
const matcherMatches = content.match(/expect\.extend\(\{([^}]+)\}\)/g);
if (matcherMatches) {
assessment.customMatchers.push(...matcherMatches);
}
// Detect mock patterns
if (content.includes('jest.mock(')) assessment.mockPatterns.push('jest.mock');
if (content.includes('jest.spyOn(')) assessment.mockPatterns.push('jest.spyOn');
if (content.includes('__mocks__')) assessment.mockPatterns.push('manual-mocks');
// Count test cases
const testCount = (content.match(/\b(it|test)\s*\(/g) || []).length;
assessment.totalTests += testCount;
}
// Estimate effort
if (assessment.totalFiles > 200 || assessment.customMatchers.length > 10) {
assessment.estimatedEffort = 'high';
} else if (assessment.totalFiles > 50) {
assessment.estimatedEffort = 'medium';
}
return assessment;
}
Selenium to Playwright Migration
Locator Mapping
// codemods/selenium-to-playwright.ts
// Mapping of Selenium locator strategies to Playwright equivalents
const LOCATOR_MAPPING: Record<string, string> = {
// Selenium -> Playwright
'By.id("x")': 'page.locator("#x")',
'By.className("x")': 'page.locator(".x")',
'By.css("x")': 'page.locator("x")',
'By.xpath("x")': 'page.locator("xpath=x")',
'By.name("x")': 'page.locator("[name=x]")',
'By.linkText("x")': 'page.getByRole("link", { name: "x" })',
'By.tagName("x")': 'page.locator("x")',
};
// Before: Selenium WebDriver
async function seleniumTest(driver: WebDriver) {
await driver.get('https:/
Установить Test Migration Framework в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Test Migration Framework?
Test framework migration skill covering strategies for migrating between testing frameworks including Selenium to Playwright, Jest to Vitest, Enzyme to React Testing Library, and Protractor to Cypress with automated codemods and incremental migration patterns.
Как установить скилл Test Migration Framework?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Test Migration Framework запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic