UNPKG

@sun-asterisk/sunlint

Version:

ā˜€ļø SunLint - Multi-language static analysis tool for code quality and security | Sun* Engineering Standards

109 lines (91 loc) • 3.06 kB
#!/usr/bin/env node /** * šŸš€ Quick Performance Test for SunLint * Run this to validate performance optimizations are working */ const { execSync } = require('child_process'); const fs = require('fs'); const path = require('path'); console.log('šŸš€ SunLint Performance Quick Test'); console.log('=================================\n'); // Test scenarios const tests = [ { name: 'Basic Performance Test', command: 'node scripts/batch-processing-demo.js', description: 'Validate batch processing works without crashes' }, { name: 'Performance Profile Test', command: 'echo "Testing performance profiles (simulated)"', description: 'Test different performance profiles' }, { name: 'Rule Count Validation', command: 'cat config/rules/enhanced-rules-registry.json | jq ".rules | keys | length"', description: 'Confirm we have 73+ rules that need optimization' } ]; async function runQuickTest() { let passed = 0; let failed = 0; for (const test of tests) { console.log(`šŸ“Š ${test.name}`); console.log(` ${test.description}`); try { console.log(` Running: ${test.command}`); const result = execSync(test.command, { encoding: 'utf8', timeout: 30000 }); console.log(` āœ… PASSED\n`); passed++; } catch (error) { console.log(` āŒ FAILED: ${error.message}\n`); failed++; } } // Summary console.log('šŸ“Š Quick Test Summary'); console.log('===================='); console.log(`Passed: ${passed} āœ…`); console.log(`Failed: ${failed} āŒ`); if (failed === 0) { console.log('\nšŸŽ‰ All tests passed! Performance optimizations are ready.'); console.log('\nšŸš€ Next steps:'); console.log(' 1. Test with your actual codebase:'); console.log(' sunlint --all --input=src --performance-profile=balanced --verbose'); console.log(' 2. Run full performance test suite:'); console.log(' node scripts/performance-test.js'); console.log(' 3. Try batch processing demo:'); console.log(' node scripts/batch-processing-demo.js'); } else { console.log('\nāš ļø Some tests failed. Check the errors above.'); } } // Validate setup console.log('šŸ” Pre-flight Checks:'); // Check if performance files exist const requiredFiles = [ 'scripts/batch-processing-demo.js', 'scripts/performance-test.js', 'docs/PERFORMANCE_OPTIMIZATION_PLAN.md', 'docs/PERFORMANCE_MIGRATION_GUIDE.md', 'engines/optimized-heuristic-engine.js' ]; let setupOk = true; for (const file of requiredFiles) { if (fs.existsSync(file)) { console.log(` āœ… ${file}`); } else { console.log(` āŒ ${file} - MISSING`); setupOk = false; } } if (!setupOk) { console.log('\nāŒ Setup incomplete. Please ensure all performance optimization files are created.'); process.exit(1); } console.log('\nāœ… Setup validation passed!\n'); // Run tests runQuickTest().catch(error => { console.error('āŒ Quick test failed:', error.message); process.exit(1); });