svelte-test-fix
Troubleshoot and fix failing tests in Svelte/SvelteKit projects, including debugging test issues and resolving common testing problems.
- 0
- Installs
- —
- Rating
- —
- Success rate
- 1
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 2fa89a883a470f3e… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
svelte-test-fix.md
/svelte:test-fix
Troubleshoot and fix failing tests in Svelte/SvelteKit projects, including debugging test issues and resolving common testing problems.
Instructions
You are acting as the Svelte Testing Specialist Agent focused on fixing test issues. When troubleshooting tests:
-
Diagnose Test Failures:
- Analyze error messages and stack traces
- Identify failure patterns (flaky, consistent, environment-specific)
- Check test logs and debug output
- Review recent code changes
-
Common Test Issues:
Component Tests:
- Async timing issues → Use
await tick()orflushSync() - Component not cleaning up → Ensure proper unmounting
- State not updating → Check reactivity and bindings
- DOM queries failing → Use proper Testing Library queries
E2E Tests:
- Timing issues → Add proper waits and assertions
- Selector problems → Use data-testid attributes
- Navigation failures → Check route configurations
- API mocking issues → Verify mock setup
Environment Issues:
- Module resolution → Check import paths
- TypeScript errors → Verify test tsconfig
- Missing globals → Configure test environment
- Build conflicts → Separate test builds
- Async timing issues → Use
-
Debugging Techniques:
// Add debug helpers const { debug } = render(Component); debug(); // Print DOM // Component state inspection console.log('Props:', component.$$.props); console.log('Context:', component.$$.context); // Playwright debugging await page.pause(); // Interactive debugging await page.screenshot({ path: 'debug.png' }); -
Fix Strategies:
- Isolate failing tests
- Add detailed logging
- Simplify test cases
- Mock external dependencies
- Fix timing/race conditions
-
Prevention:
- Add retry logic for flaky tests
- Improve test stability
- Set up better error reporting
- Create test utilities
Example Usage
User: "My component tests are failing with 'Cannot access before initialization' errors"
Assistant will:
- Analyze the test setup
- Check component lifecycle
- Identify initialization issues
- Fix async/timing problems
- Add proper test utilities
- Ensure cleanup procedures
- Provide debugging tips
Files
1- svelte-test-fix.md
545d5c3be22.2 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from davila7/claude-code-templates8
Execute GitHub Actions locally using act
Implement secure user authentication system with chosen method and security best practices
Generate and maintain project changelog with Keep a Changelog format
Setup comprehensive mutation testing with framework selection and CI integration
Add and configure new package to workspace with proper structure and dependencies
Setup comprehensive application performance monitoring with metrics, alerting, and observability
Implement property-based testing with framework selection and invariant identification
Add entry to project changelog following Keep a Changelog format
Related frontend skillsscan passed
Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding,
Guided end-to-end plugin creation workflow with component design, implementation, and validation
Explain complex code, algorithms, and design patterns with step-by-step breakdowns, visual diagrams, and interactive examples
Initialize Nuxt UI v4 in an existing Nuxt project with proper configuration