Skip to content

Latest commit

 

History

History
130 lines (101 loc) · 3.89 KB

File metadata and controls

130 lines (101 loc) · 3.89 KB

Automated Testing Setup

🤖 Comprehensive CI/CD Testing

Your repository now has robust automated testing that runs on every Renovate PR and code change!

🧪 What Gets Tested Automatically

1. Code Quality Checks

  • TypeScript compilation - Catches type errors
  • ESLint rules - Code style and best practices
  • Prettier formatting - Consistent code formatting

2. Unit Tests

  • Plugin structure - Ensures plugin exports correctly
  • Data parsing - Tests DataFrame processing logic
  • Custom names - Verifies service name mapping
  • Coverage reporting - Tracks test coverage

3. Build Verification

  • Successful compilation - Plugin builds without errors
  • Required files - plugin.json, module.js exist
  • Valid JSON - plugin.json is properly formatted
  • Plugin ID consistency - Matches package.json
  • Bundle size check - Warns if bundle is too large
  • Plugin structure - Contains PanelPlugin export

4. Security Scanning

  • npm audit - Checks for known vulnerabilities
  • Snyk scanning - Advanced security analysis (optional)
  • Dependency review - Reviews new dependencies in PRs

🔄 Renovate Integration

Auto-merge Conditions

Renovate will automatically merge PRs when:

  • ✅ All tests pass
  • ✅ Build succeeds
  • ✅ Security checks pass
  • ✅ No high-severity vulnerabilities
  • ✅ Package type allows auto-merge

Manual Review Required

These updates need your approval:

  • ⚠️ Grafana packages (potential breaking changes)
  • ⚠️ React ecosystem (version compatibility)
  • ⚠️ Major version updates (breaking changes likely)
  • ⚠️ Security vulnerabilities (requires attention)

Safe Auto-merge

These update automatically:

  • ESLint & Prettier (code quality tools)
  • Testing libraries (Jest, Testing Library)
  • TypeScript & @types (type definitions)
  • Minor/patch updates (bug fixes, features)

📊 Test Execution

Every PR/Push:

# 1. Quality checks
npm run typecheck
npm run lint
npm run test:ci

# 2. Build verification  
npm run build
# + artifact validation

# 3. Security scanning
npm audit
# + dependency review

Status Checks Required:

  • Test & Lint
  • Build & Verify Plugin
  • Security & Dependency Check

🎯 Benefits for You

Zero Manual Testing

  • Renovate PRs auto-merge if tests pass
  • Dependency conflicts caught automatically
  • Breaking changes blocked from auto-merge
  • Security issues flagged immediately

Confidence in Updates

  • Build artifacts verified every time
  • Plugin structure validated automatically
  • Type safety enforced
  • Performance monitored (bundle size)

Immediate Feedback

  • Failed tests prevent merging
  • Build errors caught early
  • Security alerts shown in PR
  • Coverage reports track quality

🚀 How It Works

  1. Renovate creates PR with dependency update
  2. GitHub Actions run all test suites automatically
  3. If all pass → Auto-merge ✅
  4. If any fail → Manual review required ⚠️
  5. Security issues → High priority, no auto-merge 🔒

🔧 Customization

Add More Tests:

// src/__tests__/your-feature.test.ts
describe('Your Feature', () => {
  it('should work correctly', () => {
    // Your test here
  });
});

Adjust Auto-merge Rules:

Edit renovate.json to change which packages auto-merge.

Security Tokens:

Add SNYK_TOKEN secret for enhanced security scanning.

You're All Set!

Your repository now has enterprise-grade automated testing. Every Renovate update will be thoroughly tested before merging, giving you confidence that dependency updates won't break your plugin.

No more manual testing of routine updates! 🎉