Agent skill
Test Runner
Run Vitest tests for the Babylon.js game project. Use when the user wants to run tests, check test coverage, debug failing tests, or validate code functionality.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/test-runner
SKILL.md
Test Runner
Run and manage Vitest tests for the project.
Quick Start
Run all tests
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npm test
Run tests in watch mode
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npm run test:watch
Run tests with coverage
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npm run test:coverage
Test Commands
Run specific test file
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest run tests/state/stateManager.test.ts
Run tests matching pattern
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest run -t "StateManager"
Run tests in specific directory
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest run tests/systems/
Run with verbose output
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest run --reporter=verbose
Test Analysis
Show test summary
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest run --reporter=verbose | tail -20
Check test count
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
find tests -name "*.test.ts" -exec echo {} \; | wc -l
echo "test files found"
List all test files
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
find tests -name "*.test.ts" -o -name "*.spec.ts"
Coverage Analysis
Generate HTML coverage report
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npm run test:coverage
# Report will be in coverage/index.html
Check coverage thresholds
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest run --coverage --coverage.reporter=text-summary
Debugging Tests
Run with console output
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest run --no-coverage --reporter=verbose
Run single test file with debugging
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest run tests/systems/loopManager.test.ts --no-coverage
Check for test failures
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npm test 2>&1 | grep -E "(FAIL|✓|✗|Error)"
Test Quality Checks
Count assertions per file
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
for file in tests/**/*.test.ts; do
echo "$file: $(grep -c 'expect(' $file) assertions"
done
Find test files without assertions
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
for file in tests/**/*.test.ts; do
if ! grep -q 'expect(' "$file"; then
echo "No assertions: $file"
fi
done
Continuous Testing
Watch mode (auto-rerun on file changes)
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest watch
Watch specific tests
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
npx vitest watch tests/systems/
Test Organization
Current test structure:
tests/content/- Content loading teststests/state/- State management teststests/systems/- System tests (LoopManager, TimeSync, etc.)tests/ui/- UI component teststests/helpers/- Test utilities and mocks
Best Practices
- Run tests before committing: Ensure all tests pass
- Watch mode during development: Catch issues immediately
- Coverage tracking: Aim for >80% coverage on critical systems
- Test naming: Use descriptive test names (describe/it pattern)
- Isolated tests: Each test should be independent
- Mock external dependencies: Use test helpers from
tests/helpers/
Common Test Patterns
Testing async code
it('should handle async operations', async () => {
const result = await asyncFunction();
expect(result).toBe(expected);
});
Testing Babylon.js components
import { mockScene, mockCamera } from '../helpers/testUtils';
it('should initialize scene', () => {
const scene = mockScene();
const camera = mockCamera(scene);
expect(scene).toBeDefined();
});
Testing state changes
it('should update state', () => {
stateManager.setState({ key: 'value' });
expect(stateManager.getState('key')).toBe('value');
});
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?