run-tests
Run Tests
<when_to_activate> Activate when the user:
- Says "run tests", "/run-tests", "test", "verify"
- Asks to verify recent changes
- Wants to know what tests are needed for new code
- Asks about test coverage for recent updates
Trigger phrases: "run tests", "test", "verify", "check coverage", "what tests" </when_to_activate>
Execution Steps
Step 1: Run Existing Tests
npm run test
Report results:
- Number of tests passed/failed
- Any failing test details
- Test duration
Step 2: Identify Recent Changes
Check git status and recent commits:
git diff --name-only HEAD~5
git diff --cached --name-only
git status --porcelain
Focus on:
- Modified
.tsxand.tsfiles insrc/ - New components or features
- Changes to existing components
Step 3: Analyze Test Coverage Gaps
For each changed file, determine if tests exist:
| Source File | Test File Location |
|---|---|
src/components/sections/*.tsx |
src/tests/design-system/components.test.tsx |
src/components/case-study/*.tsx |
src/tests/case-study/case-study.test.tsx |
src/components/Blog.tsx |
src/tests/blog/blog-ux-features.test.tsx |
src/lib/*.ts |
src/tests/validation/content-validation.test.ts |
| Navigation changes | src/tests/navigation/navigation.test.tsx |
| Mobile-specific | src/tests/mobile/mobile.test.tsx |
| Theme/CSS changes | src/tests/design-system/css-variables.test.ts |
Step 4: Recommend New Tests
For each uncovered change, suggest specific tests following the project patterns:
Test Pattern Template:
import { render, screen } from '@testing-library/react';
import { ThemeProvider } from '../../context/ThemeContext';
import { VariantProvider } from '../../context/VariantContext';
import { profile } from '../../lib/content';
const TestWrapper = ({ children }: { children: React.ReactNode }) => (
<VariantProvider profile={profile}>
<ThemeProvider>{children}</ThemeProvider>
</VariantProvider>
);
describe('[ComponentName]', () => {
it('should [expected behavior]', () => {
render(
<TestWrapper>
<ComponentName {...props} />
</TestWrapper>
);
expect(/* assertion */).toBe(/* expected */);
});
});
Output Format
## Test Results
**Status**: ✅ All passing | ❌ X failures
**Tests**: X passed, X failed, X total
**Duration**: Xs
### Failures (if any)
- `test name`: error message
---
## Recent Changes Analyzed
| File | Change Type | Has Tests |
|------|-------------|-----------|
| src/components/sections/ExperienceSection.tsx | Modified | ✅ Partial |
---
## Recommended New Tests
### 1. [Test Name]
**File**: `src/tests/[path]/[file].test.tsx`
**Covers**: [what it tests]
```tsx
[test code suggestion]
2. ...
## Test Categories
### Component Tests
- Render without crashing
- Uses CSS variables (not hardcoded colors)
- Correct props handling
- User interactions (clicks, hovers)
- Accessibility attributes
### Integration Tests
- Data flows correctly from content files
- Links render with correct URLs
- Conditional rendering works
### Responsive Tests
- Mobile layout differences
- Tablet breakpoints
- Desktop behavior
## Common Test Assertions
```tsx
// Element exists
expect(screen.getByText('text')).toBeInTheDocument();
// Has attribute
expect(element).toHaveAttribute('href', 'url');
// CSS variable usage
expect(element?.style.color).toContain('var(--color-');
// Link behavior
expect(link).toHaveAttribute('target', '_blank');
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
File Locations
| Purpose | Path |
|---|---|
| Run tests | npm run test |
| Watch mode | npm run test:watch |
| Design system only | npm run test:design-system |
| Test config | vitest.config.ts (if exists) or vite.config.ts |
| Test setup | src/tests/setup.ts (if exists) |
More from fotescodev/portfolio
ultrathink
Elevates thinking for complex problems with intellectual honesty. Activates deep analysis while avoiding performative contrarianism. Use when facing decisions that deserve more than the first answer, require trade-off evaluation, or benefit from rigorous self-checking before responding.
4linkedin
Create LinkedIn content using service-based authority principles. Use when drafting posts, profile sections, or comments that build trust through teaching rather than self-promotion.
3serghei-qa
Sarcastic QA Lead who audits codebases for code smells, anti-patterns, and WTF moments. Provides best-practice fixes with cutting wit. Use for code reviews and quality audits.
2sprint-sync
Multi-perspective project onboarding and sprint briefing. Simulates a cross-functional leadership team (PM, Designer, Architect, Engineer) ramping up on project status. Updates the Current Status section in PROJECT_STATE.md.
2technical-writer
User documentation technical writer focused on user and developer experience, code examples, and 2025 best practices. Use when creating README files, API docs, getting started guides, tutorials, or any technical documentation intended for developers or end users.
2generate-resume
Generate a print-optimized, ATS-friendly single-page resume PDF from portfolio content. Use when user wants to create or regenerate their resume. (project)
2