Claude Code Plugins

Community-maintained marketplace

Feedback
0
0

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 Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name Test Runner
description 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.

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 tests
  • tests/state/ - State management tests
  • tests/systems/ - System tests (LoopManager, TimeSync, etc.)
  • tests/ui/ - UI component tests
  • tests/helpers/ - Test utilities and mocks

Best Practices

  1. Run tests before committing: Ensure all tests pass
  2. Watch mode during development: Catch issues immediately
  3. Coverage tracking: Aim for >80% coverage on critical systems
  4. Test naming: Use descriptive test names (describe/it pattern)
  5. Isolated tests: Each test should be independent
  6. 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');
});