home / skills / shotaiuchi / dotclaude / migration-test

migration-test skill

/dotclaude/skills/migration-test

This skill helps assess and preserve test coverage during migration by updating tests, mocks, and assertions for a migrated codebase.

npx playbooks add skill shotaiuchi/dotclaude --skill migration-test

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.7 KB
---
name: migration-test
description: >-
  Test migration and adaptation. Apply when updating test code, test utilities,
  mocks, assertions, test frameworks, and ensuring test coverage is maintained
  through migration.
user-invocable: false
---

# Test Migration

Update and adapt tests to work with the migrated codebase.

## Migration Checklist

### Test Framework Updates
- Update test runner configuration for new framework version
- Migrate deprecated test lifecycle hooks and annotations
- Replace removed assertion methods with new equivalents
- Verify test discovery and execution still works correctly

### Mock & Stub Adaptation
- Update mock library calls to match new API signatures
- Replace deprecated mocking patterns with current idioms
- Verify mock setup and teardown follows new conventions
- Check that spy and capture APIs are updated

### Assertion Updates
- Replace deprecated assertion syntax with modern equivalents
- Update custom matchers to comply with new interfaces
- Verify error message formatting in assertion failures
- Check for changed equality semantics in assertions

### Coverage Preservation
- Compare test coverage before and after migration
- Identify tests that were skipped or broken by migration
- Ensure critical paths retain full test coverage
- Add missing tests for newly introduced migration code

## Output Format

Report findings with risk ratings:

| Risk | Description |
|------|-------------|
| Critical | Tests silently pass but no longer verify behavior |
| High | Significant test coverage lost, gaps in verification |
| Medium | Some tests need updating but coverage is adequate |
| Low | Minor test syntax changes, coverage is maintained |

Overview

This skill helps teams test migration and adaptation of test suites when codebases, frameworks, or testing libraries change. It guides updating test runners, mocks, assertions, and preserving coverage so tests continue to verify behavior after migration. Use it to produce a focused migration report with risk ratings and actionable fixes.

How this skill works

The skill inspects test runner configuration, lifecycle hooks, assertion code, mock/stub usage, and coverage metrics to identify migration breakages. It highlights deprecated APIs, mismatched mock signatures, changed assertion semantics, and coverage regressions, then classifies findings by risk. The output is a concise report with prioritized remediation steps and risk labels (Critical, High, Medium, Low).

When to use it

  • When upgrading test frameworks or test runner versions
  • When migrating mocking libraries or changing mock APIs
  • When refactoring test utilities, custom matchers, or assertion styles
  • When CI shows unexpected test passes or coverage drops after changes
  • Before merging large refactors that affect test surface area

Best practices

  • Capture baseline test coverage before migration to compare after changes
  • Run tests in isolated environments to detect hidden false positives
  • Update one testing concern at a time (runner, mocks, assertions) to limit scope
  • Add or update tests for critical paths affected by migration to avoid silent regressions
  • Prefer automated scripts for bulk replacements and follow with targeted manual review

Example use cases

  • Migrating from one test runner version to another and updating its config and lifecycle hooks
  • Adapting mocks and spies after replacing a mocking library or changing its API
  • Refactoring custom matchers to conform to a new assertion interface and updating assertions
  • Detecting and fixing tests that now pass but no longer assert meaningful behavior
  • Verifying coverage parity and adding tests where migration removed test assertions

FAQ

What does a Critical risk mean?

Critical means tests may still pass but no longer verify behavior; immediate attention required.

How do I measure coverage impact?

Capture coverage reports before and after migration, compare uncovered files and critical paths, and flag regressions for remediation.