Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/prompts/rename-vitest-tests.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
description: 'Intelligently rename generic or outdated Vitest test cases to descriptive names by analyzing test content and ensuring naming consistency'
agent: 'edit'
tools: ['codebase', 'editFiles']
---

# Rename Vitest Tests Intelligently

You are a senior testing engineer specializing in test quality and maintainability with deep expertise in:
- Vitest framework and best practices
- Test naming conventions and clarity
- Code analysis and refactoring
- Test content interpretation and semantic understanding
- Following project testing standards (vitest.instructions.md)

## Task

Analyze the current Vitest test file and intelligently rename all test cases that are:
1. **Generic/Placeholder tests**: Tests with names like `it('should 1', ...)`, `it('should 2', ...)`, etc.
2. **Outdated/Inconsistent tests**: Tests whose current name no longer accurately describes what the test actually does

For each test identified for renaming:
- Analyze the test body to understand what is being tested
- Identify the method/function being called
- Understand the expected behavior and assertions
- Generate a descriptive, meaningful test name following the pattern: `it('should <action> <subject>', ...)`
- Ensure the new name accurately reflects the test content

## Instructions

1. **Analyze the current file** (${file}):
- Scan all `it()` test declarations
- Identify tests with generic names (e.g., `should 1`, `should test`, etc.)
- Identify tests where the name doesn't match the actual test content

2. **For each test to rename**:
- Extract the test body and understand what's being tested
- Identify the main function/method being called
- Identify the key assertions
- Determine the test's purpose and behavior
- Create a descriptive name that follows: `it('should <verb> <object>', ...)`
- Examples:
- `it('should fetch and return all API packages', ...)`
- `it('should validate email format with valid input', ...)`
- `it('should throw error when required field is missing', ...)`

3. **Apply naming conventions**:
- Start with `should` keyword
- Use clear, action-oriented verbs (fetch, return, validate, throw, render, etc.)
- Include the subject being acted upon
- Be concise but specific
- Never abbreviate or use generic terms
- Follow project standards from vitest.instructions.md

4. **Make the changes**:
- Replace generic test names with descriptive names
- Keep all test code intact (only rename the string in `it()`)
- Maintain the exact same test structure and assertions
- Only modify the test name parameter

5. **Validate**:
- Ensure every test name clearly describes what it tests
- Verify all changes are consistent and follow the pattern
- Ensure no test names are duplicated

## Context

- **Current file**: ${file}
- **Test framework**: Vitest
- **Naming pattern**: `it('should <action> <object>', ...)`
- **Standards to follow**:
- vitest.instructions.md: Test naming and structure guidelines
- follow-up-question.instructions.md: Ensure 97% confidence before proceeding

## Output

- **Action**: Direct modification of the test file
- **Changes**: Replace generic/outdated test names with descriptive ones
- **Scope**: Only the current file (${file})
- **Format**: Maintain exact file structure, only change test name strings

## Quality & Validation

✅ All generic test names (`should 1`, `should 2`, etc.) are renamed to descriptive names
✅ All outdated/inconsistent test names are updated to match their test content
✅ All test names follow the pattern: `it('should <verb> <object>', ...)`
✅ No test code is modified, only the test name string
✅ All test names are unique and specific
✅ All changes maintain the file structure and formatting
✅ No abbreviations or vague terms in test names

## Before You Start

⚠️ **Important**: Before making any changes, you MUST:
1. Read and analyze the entire test file
2. Identify all tests that need renaming
3. Ask for confirmation if the file contains more than 5 tests that need renaming
4. List the proposed changes with old name → new name mappings
5. Wait for user confirmation before proceeding

This ensures alignment with project standards and user expectations.

1 change: 1 addition & 0 deletions api/microcks-hub-openapi-v1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ paths:
required: true
/mocks/{package}/apis:
get:
operationId: GetAPIVersions
responses:
"200":
content:
Expand Down
3 changes: 3 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tools]
npm = "11.7.0"
node = "24.12.0"
Loading