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

generate-tests

Generate a complete test file for a specified source file or component. Use when the user explicitly asks to write, create, or generate tests for a specific file.

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

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

التنزيل

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

نزّل ملف ZIP

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

التثبيت

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

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

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

    mkdir -p .claude/commands && unzip ~/Downloads/generate-tests.zip -d .claude/commands

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

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

    mkdir -p ~/.claude/commands && unzip ~/Downloads/generate-tests.zip -d ~/.claude/commands

التعليمات

Generate Tests

Generate comprehensive test suite for: $ARGUMENTS

Current Testing Setup

  • Test framework: !cat package.json 2>/dev/null | grep -E '"jest"|"vitest"|"mocha"|"jasmine"' | head -3 || cat jest.config.* vitest.config.* 2>/dev/null | head -5 || echo "Framework not detected"
  • Existing tests: !find . -name "*.test.*" -o -name "*.spec.*" | head -5
  • Test coverage: !npm run test:coverage 2>/dev/null || echo "No coverage script"
  • Target: if $ARGUMENTS is a file path, read it with @$ARGUMENTS; if it is a component name, search for it with Grep before writing tests

Test Generation Framework

  1. Analyze the target file/component structure — identify all exported functions, classes, methods, and their signatures
  2. Strategy — examine existing test patterns in the project; choose unit vs integration scope; identify critical paths and error scenarios
  3. Mock Design — map all external dependencies (I/O, APIs, timers, dates); create factories for test data; plan cleanup for async operations
  4. Unit Tests — write isolated tests per function/method covering happy path, edge cases, and error conditions; follow AAA pattern (Arrange, Act, Assert)
  5. Integration Tests — test component interactions, API layers with mocked responses, and end-to-end user workflows where applicable
  6. Quality Check — verify naming describes behavior not implementation; confirm 80%+ coverage on critical business logic; ensure test isolation

Framework-Specific Guidance

  • React: Component testing with React Testing Library; test user interactions and rendering
  • Vue: Component testing with Vue Test Utils; test props, events, and slots
  • Angular: Component and service testing with TestBed; test dependency injection
  • Node.js: API endpoint and middleware testing; test request/response cycles
  • Python: pytest with fixtures, unittest.mock for patching, pytest-cov for coverage
  • Go: Table-driven tests in _test.go files, testify/assert for assertions, subtests via t.Run()
  • Rust: #[cfg(test)] modules, #[test] attributes, mockall for mocking

Best Practices

  • Follow AAA pattern (Arrange, Act, Assert)
  • 80%+ coverage; prioritize critical business logic and error paths
  • Mock external I/O; use factories for test data
  • Naming: describe what the function does, not implementation details

الملفات

  • LICENSE1 ك.ب
  • generate-tests.md2.6 ك.ب

ما وجده الفحص الآلي

فحصنا الملفات آلياً وقت الاستيراد. هذا ما نبّه إليه الفحص، ولا يعني أن العنصر ضار ولا أنه سليم: اقرأه بنفسك.

  • يحتاج مراجعةأدوات مسموحة بلا حدود

    في الملف cli-tool/components/commands/testing/generate-tests.md

التعليقات (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