6.8 KiB
Run Full Test Suite
This workflow runs the complete test suite for BMAD-METHOD, including linting, formatting checks, and any automated tests.
Prerequisites
- Node.js v20+ installed
- Project dependencies installed (
npm install) - Clean working directory (optional, but recommended)
Workflow Steps
1. Verify Environment
Check that you're in the project root and dependencies are installed:
pwd
ls package.json
If node_modules doesn't exist:
npm install
2. Check Git Status (Optional)
See current state before running tests:
git status
Consider committing or stashing changes before running tests to isolate failures.
3. Run Linting
Execute ESLint to check code quality:
npm run lint
Expected Output: No errors or warnings
If errors occur:
- Review the errors listed
- Many can be auto-fixed with:
npm run lint -- --fix - For remaining issues, manually fix the code
- Re-run lint to verify
4. Check Code Formatting
Run Prettier to verify code formatting:
npm run format:check
Expected Output: All files properly formatted
If formatting issues occur:
- Auto-fix with:
npm run format - This will reformat all files according to
.prettierrc - Review changes before committing
5. Run Unit Tests (If Available)
If unit tests are configured:
npm test
Expected Output: All tests passing
If tests fail:
- Review test output for failures
- Fix the failing code or tests
- Re-run tests to verify
6. Run Integration Tests (If Available)
If integration tests exist:
npm run test:integration
Expected Output: All integration tests passing
7. Build Project
Verify the project builds successfully:
npm run build
If no build script exists, this step can be skipped.
Expected Output: Successful build with no errors
If build fails:
- Review build errors
- Common issues:
- Type errors (if using TypeScript)
- Missing dependencies
- Configuration issues
- Fix and rebuild
8. Test Installation (Optional)
Test the installation process in a clean environment:
# Create temporary test directory
mkdir -p /tmp/bmad-test
cd /tmp/bmad-test
# Test installation
npx /path/to/your/project/bmad-method@alpha install
# Verify installation worked
ls bmad/
# Cleanup
cd -
rm -rf /tmp/bmad-test
9. Manual Smoke Tests
Perform manual verification:
-
Agent Activation:
- Load BMad Master agent in IDE
- Verify greeting appears
- Check menu displays correctly
-
Config Loading:
- Verify
bmad/core/config.yamlloads - Check variables populate correctly
- Verify
-
Workflow Execution:
- Test a simple workflow
- Verify steps execute properly
- Check output generation
-
Customization:
- Test agent customization file
- Verify override works correctly
10. Review Results
Create a test summary:
## Test Results - [DATE]
### Linting
- [x] ESLint passed
- [ ] Issues found: [list]
### Formatting
- [x] Prettier passed
- [ ] Files need formatting: [list]
### Unit Tests
- [x] All tests passed (X/X)
- [ ] Failures: [list]
### Integration Tests
- [x] All tests passed (X/X)
- [ ] Failures: [list]
### Build
- [x] Build successful
- [ ] Build errors: [list]
### Manual Tests
- [x] Agent activation works
- [x] Config loading works
- [x] Workflows execute
- [x] Customization applies
### Overall Status
- [x] All tests passing - Ready for commit/release
- [ ] Issues to fix - See above
Automated Test Script
Save this as test-all.sh for easy execution:
#!/bin/bash
echo "🧪 Running BMAD-METHOD Full Test Suite"
echo "========================================"
# Exit on first error
set -e
echo ""
echo "📋 Step 1: Linting..."
npm run lint
echo ""
echo "✨ Step 2: Format check..."
npm run format:check
echo ""
echo "🏗️ Step 3: Build..."
if npm run build 2>/dev/null; then
echo "Build successful"
else
echo "No build script (OK)"
fi
echo ""
echo "✅ All tests passed!"
echo ""
Make it executable:
chmod +x test-all.sh
Run with:
./test-all.sh
Continuous Integration
For CI/CD pipelines, use this sequence:
# .github/workflows/test.yml
name: Test Suite
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
- name: Check formatting
run: npm run format:check
- name: Run tests
run: npm test
- name: Build project
run: npm run build
Pre-commit Hooks
BMAD-METHOD uses Husky for pre-commit hooks. These run automatically:
# Installed hooks
.husky/pre-commit
The pre-commit hook runs:
- lint-staged (lints and formats only staged files)
- Quick validation checks
If you need to skip hooks (not recommended):
git commit --no-verify -m "message"
Troubleshooting
Linting Failures
Problem: ESLint errors
Solutions:
- Auto-fix:
npm run lint -- --fix - Check specific file:
npx eslint path/to/file.js - Review ESLint config:
eslint.config.mjs
Formatting Issues
Problem: Prettier finds issues
Solutions:
- Auto-format:
npm run format - Check specific file:
npx prettier --check path/to/file - Review Prettier config:
prettier.config.mjs
Test Failures
Problem: Tests failing
Solutions:
- Run single test:
npm test -- --grep "test name" - Check test logs for details
- Verify test environment setup
- Check for dependency issues
Build Errors
Problem: Build fails
Solutions:
- Clean and reinstall:
rm -rf node_modules && npm install - Check Node version:
node --version - Review build configuration
- Check for dependency conflicts
Installation Test Fails
Problem: Test installation doesn't work
Solutions:
- Check CLI tool code in
tools/cli/ - Verify bundler output
- Test with verbose logging
- Check file permissions
Best Practices
- Run before committing: Always run tests before git commit
- Fix immediately: Don't accumulate test failures
- Clean state: Test with clean working directory
- Document: Note any skipped tests or known issues
- Automate: Use pre-commit hooks and CI/CD
- Regular runs: Run full suite daily during active development
Resources
Next Steps
After all tests pass:
- Commit changes
- Push to remote
- Create pull request (if applicable)
- Tag release (if ready)
- Deploy (if applicable)