تخطَّ إلى المحتوى
أمرمستورد

svelte-test-fix

Troubleshoot and fix failing tests in Svelte/SvelteKit projects, including debugging test issues and resolving common testing problems.

وصف مستورد لم يراجعه محرر بعد

جاء هذا العنصر من مستودعه الأصلي وفحصناه آلياً فقط، ولم يكتب له محرر وصفاً عربياً بعد. اقرأ محتواه بنفسك قبل أن تعتمد عليه. ولا تُفهرس هذه الصفحة في محركات البحث حتى تُراجَع.

التنزيل

الملفات: 1 · الحجم: 3.5 ك.ب

نزّل ملف ZIP

يحمل الملف ترخيص المصدر الأصلي.

التثبيت

بعد التنزيل، شغّل الأمر في الطرفية. يسأل unzip قبل أن يستبدل أي ملف موجود.

  • لهذا المشروع

    يوضع في: .claude/commands/

    mkdir -p .claude/commands && unzip ~/Downloads/svelte-test-fix.zip -d .claude/commands

  • لحسابك على الجهاز كله

    يوضع في: ~/.claude/commands/

    mkdir -p ~/.claude/commands && unzip ~/Downloads/svelte-test-fix.zip -d ~/.claude/commands

التعليمات

/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:

  1. 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
  2. Common Test Issues:

    Component Tests:

    • Async timing issues → Use await tick() or flushSync()
    • 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
  3. 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' });
    
  4. Fix Strategies:

    • Isolate failing tests
    • Add detailed logging
    • Simplify test cases
    • Mock external dependencies
    • Fix timing/race conditions
  5. 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

الملفات

  • LICENSE1 ك.ب
  • svelte-test-fix.md2.4 ك.ب

التعليقات (0)

لا تعليقات بعد. كن أول من يعلّق.

سجّل الدخول لتعلّق. التعليق من المستوى 1 (عضو).

أبلغ

عناصر مشابهة

  • أمرمستورد

    add-mutation-testing

    Setup comprehensive mutation testing with framework selection and CI integration

    MITالملفات: 1

  • أمرمستورد

    add-property-based-testing

    Implement property-based testing with framework selection and invariant identification

    MITالملفات: 1

  • أمرمستورد

    ai-review

    Run an AI-assisted code review that combines static analysis tools with AI review of security, performance, and architecture

    MITالملفات: 1

  • أمرمستورد

    code-permutation-tester

    Test multiple code variations through simulation before implementation with quality gates and performance prediction.

    MITالملفات: 1

  • أمرمستورد

    create-feature

    Scaffold new feature with boilerplate code, tests, and documentation

    MITالملفات: 1

  • أمرمستورد

    decision-quality-analyzer

    Analyze team decision quality with bias detection, scenario testing, and process improvement recommendations

    MITالملفات: 1