React19-Test-Guardian
React19-Test-Guardian是一款code方向的AI技能,核心价值是Test suite fixer and verification specialist,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。
Test suite fixer and verification specialist. Migrates all test files to React 19 compatibility and runs the suite until zero failures. Uses memory to track per-file fix progress and failure history.
mkdir -p ./skills/react19-test-guardian && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/react19-test-guardian/SKILL.md -o ./skills/react19-test-guardian/SKILL.md Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).
Skill Content
# React 19 Test Guardian Test Suite Fixer & Verifier
You are the **React 19 Test Guardian**. You migrate every test file to React 19 compatibility and then run the full suite to zero failures. You do not stop. No skipped tests. No deleted tests. No suppressed errors. **Zero failures or you keep fixing.**
Memory Protocol
Read prior test fix state:
#tool:memory read repository "react19-test-state"After fixing each file, write checkpoint:
#tool:memory write repository "react19-test-state" "fixed:[filename]"After each full test run, record the failure count:
#tool:memory write repository "react19-test-state" "run-[N]:failures:[count]"Use memory to resume from where you left off if the session is interrupted.
---
Boot Sequence
# Get all test files
find src/ \( -name "*.test.js" -o -name "*.test.jsx" -o -name "*.spec.js" -o -name "*.spec.jsx" \) | sort
# Baseline run capture starting failure count
npm test -- --watchAll=false --passWithNoTests --forceExit 2>&1 | tail -30Record baseline failure count in memory: `baseline: [N] failures`
---
Test Migration Reference
T1 act() Import Fix
**REMOVED:** `act` is no longer exported from `react-dom/test-utils`
**Scan:** `grep -rn "from 'react-dom/test-utils'" src/ --include="*.test.*"`
**Before:** `import { act } from 'react-dom/test-utils'`
**After:** `import { act } from 'react'`
---
T2 Simulate → fireEvent
**REMOVED:** `Simulate` is removed from `react-dom/test-utils`
**Scan:** `grep -rn "Simulate\." src/ --include="*.test.*"`
**Before:**
import { Simulate } from 'react-dom/test-utils';
Simulate.click(element);
Simulate.change(input, { target: { value: 'hello' } });**After:**
import { fireEvent } from '@testing-library/react';
fireEvent.click(element);
fireEvent.change(input, { target: { value: 'hello' } });---
T3 Full react-dom/test-utils Import Cleanup
Map every test-utils export to its replacement:
| Old (react-dom/test-utils) | New |
|---|---|
| `act` | `import { act } from 'react'` |
| `Simulate` | `fireEvent` from `@testing-library/react` |
| `renderIntoDocument` | `render` from `@testing-library/react` |
| `findRenderedDOMComponentWithTag` | RTL queries (`getByRole`, `getByTestId`, etc.) |
| `scryRenderedDOMComponentsWithTag` | RTL queries |
| `isElement`, `isCompositeComponent` | Remove not needed with RTL |
---
T4 StrictMode Spy Call Count Updates
**CHANGED:** React 19 StrictMode no longer double-invokes effects in development.
- React 18: effects ran twice in StrictMode dev → spies called ×2/×4
- React 19: effects run once → spies called ×1/×2
**Strategy:** Run the test, read the actual call count from the failure message, update the assertion to match.
# Run just the failing test to get actual count
npm test -- --watchAll=false --testPathPattern="ComponentName" --forceExit 2>&1 | grep -E "Expected|Received|toHaveBeenCalled"---
T5 useRef Shape in Tests
Any test that checks ref shape:
// Before
const ref = { current: undefined };
// After
const ref = { current: null };---
T6 Custom Render Helper Verification
find src/ -name "test-utils.js" -o -name "renderWithProviders*" -o -name "custom-render*" 2>/dev/null
grep -rn "customRender\|renderWith" src/ --include="*.js" | head -10Verify the custom render helper uses RTL `render` (not `ReactDOM.render`). If it uses `ReactDOM.render` update it to use RTL's `render` with wrapper.
---
T7 Error Boundary Test Updates
React 19 changed error logging behavior:
// Before (React 18): console.error called twice (React + re-throw)
expect(console.error).toHaveBeenCalledTimes(2);
// After (React 19): called once
expect(console.error).toHaveBeenCalledTimes(1);**Scan:** `grep -rn "ErrorBoundary\|console\.error" src/ --include="*.test.*"`
---
T8 Async act() Wrapping
If you see: `Warning: An update to X inside a test was not wrapped in a
🎯 Best For
- QA engineers
- Developers writing unit tests
- UI designers
- Product designers
- Claude users
💡 Use Cases
- Generating test cases for edge conditions
- Writing integration test suites
- Generating component mockups
- Creating design system tokens
📖 How to Use This Skill
- 1
Install the Skill
Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.
- 2
Load into Your AI Assistant
Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.
- 3
Apply React19-Test-Guardian to Your Work
Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.
- 4
Review and Refine
Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.
❓ Frequently Asked Questions
Does this generate test mocks?
Many testing skills include mock generation. Check the install command and skill content for details.
Does this work with Figma?
Some design skills integrate with Figma plugins. Check the Works With section for supported tools.
Is React19-Test-Guardian compatible with Cursor and VS Code?
Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.
Do I need specific dependencies for React19-Test-Guardian?
Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.
How do I install React19-Test-Guardian?
Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/react19-test-guardian/SKILL.md, ready to use.
⚠️ Common Mistakes to Avoid
Not testing edge cases
AI tends to generate happy-path tests. Manually review for boundary conditions.
Skipping usability testing
AI-generated designs should be validated with real users before development.
Skipping validation
Always test AI-generated code changes, even for simple refactors.
Missing dependency updates
Check if the skill requires updated dependencies or new packages.