Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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

  1. Incremental migration over big-bang rewrites -- Migrate tests file by file or module by module, never all at once.
  2. Preserve coverage at every step -- Run both old and new test suites in CI until migration is complete.
  3. Automate repetitive transforms -- Use codemods and scripts for mechanical changes, save manual effort for logic updates.
  4. Validate equivalence -- Every migrated test must verify the same behavior as the original.
  5. Maintain a migration checklist -- Track progress per module with status (pending, in-progress, migrated, verified).
  6. Document breaking differences -- Each framework pair has semantic differences that require manual attention.
  7. 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:/
Полный SKILL.md на GitHub

Установить 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), без исполняемых скриптов.

Похожие скиллы

Сравнить Test Migration Framework с