website-htmx-rustelo-code/justfiles/test.just
2026-07-10 03:44:13 +01:00

110 lines
3.2 KiB
Text

# Testing Commands Module
# Commands for running tests, coverage, browser testing, and quality checks
# Set shell for commands
set shell := ["bash", "-c"]
# Run all tests (default)
run:
@echo "🧪 Running all tests..."
cargo test
# Run tests with coverage
coverage:
@echo "🧪 Running tests with coverage..."
cargo tarpaulin --out html
# Run end-to-end tests
e2e:
@echo "🧪 Running end-to-end tests..."
cd end2end && npx playwright test
# Run specific test
specific test:
@echo "🧪 Running test: {{test}}..."
cargo test {{test}}
# Run tests in watch mode
watch:
@echo "🧪 Running tests in watch mode..."
cargo watch -x test
# Run expand
expand *ARGS:
@echo "🧪 Expand code ..."
cargo expand {{ARGS}}
# =============================================================================
# BROWSER TESTING COMMANDS
# =============================================================================
# Test single page in browser (page-browser-tester.sh wrapper)
page *ARGS:
@echo "🌐 Testing page in browser..."
{{justfile_directory()}}/scripts/browser-logs/page-browser-tester.sh {{ARGS}}
# Generate comprehensive browser report for all pages (all-pages-browser-report.sh wrapper)
pages-report *ARGS:
@echo "📊 Generating all pages browser report..."
{{justfile_directory()}}/scripts/wrks/all-pages-browser-report.sh {{ARGS}}
# Generate new page with interactive CLI
page-new:
@echo "🚀 Starting interactive page generator..."
cargo run --bin rustelo-manager -- --tui
# =============================================================================
# CODE QUALITY COMMANDS
# =============================================================================
# Check code with clippy
check *ARGS:
@echo "🔍 Checking code with clippy..."
cargo clippy {{ARGS}}
# Check all code with clippy
check-all:
@echo "🔍 Checking code with clippy..."
cargo clippy --all-targets --all-features
# Check code with strict clippy and rule validation
check-strict:
@echo "🔍 Checking code with strict clippy and rule validation..."
@echo "🚨 Validating Rustelo project rules..."
@scripts/rules/validate-rules.nu --strict
cargo clippy --all-targets --all-features -- -D warnings
# Format code with rule validation
format *ARGS:
@echo "✨ Formatting code..."
@echo "🚨 Pre-format rule validation..."
@scripts/rules/validate-rules.nu
cargo +nightly fmt {{ARGS}}
@echo "🚨 Post-format rule validation..."
@scripts/rules/validate-rules.nu
# Check if code is formatted
format-check *ARGS:
@echo "✨ Checking code formatting..."
cargo +nightly fmt --check {{ARGS}}
# Security audit
audit:
@echo "🔒 Running security audit..."
cargo audit
# Check for unused dependencies
unused-deps:
@echo "🔍 Checking for unused dependencies..."
cargo machete
# Run all quality checks with rule validation
quality:
@echo "🔍 Running all quality checks with rule validation..."
@echo "🚨 Validating Rustelo project rules..."
@if ! scripts/rules/validate-rules.nu --strict; then echo "❌ Rule validation failed!"; exit 1; fi
@echo "✅ Rule validation passed"
@just format-check
@just check-strict
@just audit
@just run