askill
run-tests

run-testsSafety 95Repository

Commands to execute tests in this project with various options and configurations

13 stars
1.2k downloads
Updated 1/29/2026

Package Files

Loading files...
SKILL.md

Skill: Run Tests

When to Use This Skill

This skill activates when you need to:

  • Run tests in an already-configured project
  • Execute tests with specific options (coverage, verbose, specific files)
  • Run tests in CI/CD or locally
  • Understand test execution commands for this project

Prerequisites

This skill assumes tests are already configured. If not, use the pytest-setup or jest-setup skill first.

Step-by-Step Workflow

Step 1: Detect Test Framework and Command

Check for configured test command:

Look in project configuration files:

  • package.jsonscripts.test
  • pyproject.toml[tool.pytest] or custom scripts
  • Makefiletest target
  • .github/workflows/ → CI test commands
  • tox.ini → test commands

If {{test_command}} is defined:

{{test_command}}

Step 2: Run Tests by Tech Stack

Python (pytest)

Basic test run:

pytest

Verbose output:

pytest -v

With coverage:

pytest --cov=src --cov-report=html --cov-report=term

Specific file:

pytest tests/test_example.py

Specific test:

pytest tests/test_example.py::test_function_name

Pattern matching:

pytest -k "test_user"  # Run tests matching pattern

Markers:

pytest -m "not slow"  # Skip slow tests
pytest -m "integration"  # Only integration tests

Parallel execution:

pytest -n auto  # Requires pytest-xdist

Stop on first failure:

pytest -x

Show print output:

pytest -s

JavaScript/TypeScript (Jest)

Basic test run:

npm test
# or
yarn test

Watch mode:

npm test -- --watch

Coverage:

npm test -- --coverage

Specific file:

npm test -- tests/example.test.js

Pattern matching:

npm test -- --testNamePattern="user"

Update snapshots:

npm test -- --updateSnapshot

Verbose:

npm test -- --verbose

JavaScript/TypeScript (Vitest)

Run tests:

npm run test
# or
vitest

Watch mode:

vitest --watch

Coverage:

vitest --coverage

UI mode:

vitest --ui

Go

Run all tests:

go test ./...

Verbose:

go test -v ./...

Coverage:

go test -cover ./...
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out

Specific package:

go test ./pkg/mypackage

Run specific test:

go test -run TestFunctionName

Parallel:

go test -parallel 4 ./...

Benchmarks:

go test -bench=. ./...

Rust

Run all tests:

cargo test

Verbose:

cargo test -- --nocapture

Specific test:

cargo test test_name

Documentation tests:

cargo test --doc

Integration tests:

cargo test --test integration_test_name

Ruby (RSpec)

Run all tests:

rspec

Specific file:

rspec spec/models/user_spec.rb

Specific test:

rspec spec/models/user_spec.rb:42

Format:

rspec --format documentation

Java (Maven)

Run tests:

mvn test

Skip tests:

mvn install -DskipTests

Specific test:

mvn test -Dtest=TestClassName

Java (Gradle)

Run tests:

./gradlew test

Continuous:

./gradlew test --continuous

Specific test:

./gradlew test --tests TestClassName

Step 3: Common Test Execution Patterns

Run tests before commit:

# Add to pre-commit hook
git add -A
{{test_command}}
git commit -m "message"

Run tests with timeout:

# Python
pytest --timeout=300

# JavaScript
npm test -- --testTimeout=5000

Run failed tests only:

# Python
pytest --lf  # last failed
pytest --ff  # failed first

# Jest
npm test -- --onlyFailures

Generate coverage report:

# Python
pytest --cov=src --cov-report=html
open htmlcov/index.html

# JavaScript
npm test -- --coverage
open coverage/lcov-report/index.html

Common Issues and Solutions

Issue: Tests not found or not running

Solutions:

  1. Verify you're in the project root directory
  2. Check test file naming conventions match framework expectations
  3. Ensure test dependencies are installed: pip install -r requirements.txt or npm install
  4. Check test configuration files (pytest.ini, jest.config.js)

Issue: Tests failing locally but pass in CI

Solutions:

  1. Check environment variables (.env files)
  2. Verify Python/Node version matches CI
  3. Clear caches: pytest --cache-clear or jest --clearCache
  4. Check for local-only fixtures or data
  5. Review CI logs for differences in test execution

Issue: Tests timing out

Solutions:

  1. Increase timeout: pytest --timeout=600 or jest testTimeout
  2. Check for infinite loops or blocking operations
  3. Use async/await properly in async tests
  4. Mock external API calls
  5. Use fixtures to avoid expensive setup

Issue: Import/module errors

Solutions:

  1. Install in development mode: pip install -e . or npm install
  2. Check PYTHONPATH or NODE_PATH
  3. Verify package.json "type" field for ES modules
  4. Check tsconfig.json paths configuration

Issue: Coverage not accurate

Solutions:

  1. Ensure all source files are included in coverage config
  2. Check .coveragerc or jest.config.js coverage settings
  3. Run with coverage flags: --cov=src or --coverage
  4. Clear coverage cache and re-run

Success Criteria

  • ✅ Tests execute without errors
  • ✅ Test results are displayed clearly
  • ✅ Failed tests show helpful error messages
  • ✅ Coverage reports generated (if requested)
  • ✅ Test execution time is reasonable

Quick Reference

Common Commands by Framework

FrameworkRun TestsCoverageSpecific Test
pytestpytest -vpytest --cov=srcpytest tests/test_file.py::test_name
Jestnpm testnpm test -- --coveragenpm test -- file.test.js
Vitestvitestvitest --coveragevitest file.test.ts
Gogo test ./...go test -cover ./...go test -run TestName
Rustcargo testcargo tarpaulincargo test test_name
RSpecrspecrspec --coveragerspec spec/file_spec.rb:42

Related Skills

  • pytest-setup - Set up pytest from scratch
  • debug-test-failures - Debug failing tests
  • ci-pipeline - Configure CI/CD test execution

Documentation References

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

92/100Analyzed 4/4/2026

High-quality, comprehensive testing skill template covering 8+ frameworks with excellent structure, actionable commands, troubleshooting guidance, and template variables for customization. Well-organized with quick reference tables and clear sections. Located in skill-templates folder suggesting it's a reusable template rather than internal-only config.

95
92
90
90
95

Metadata

Licenseunknown
Version-
Updated1/29/2026
Publisherjonlwowski012

Tags

apici-cdgithubgithub-actionstesting