Files
everything-claude-code/tests/run-all.js
zerx-lab 970f8bf884 feat: cross-platform support with Node.js scripts
- Rewrite all bash hooks to Node.js for Windows/macOS/Linux compatibility
- Add package manager auto-detection (npm, pnpm, yarn, bun)
- Add scripts/lib/ with cross-platform utilities
- Add /setup-pm command for package manager configuration
- Add comprehensive test suite (62 tests)

Co-authored-by: zerx-lab
2026-01-22 23:08:07 -08:00

77 lines
3.1 KiB
JavaScript

#!/usr/bin/env node
/**
* Run all tests
*
* Usage: node tests/run-all.js
*/
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
const testsDir = __dirname;
const testFiles = [
'lib/utils.test.js',
'lib/package-manager.test.js',
'hooks/hooks.test.js'
];
console.log('╔══════════════════════════════════════════════════════════╗');
console.log('║ Everything Claude Code - Test Suite ║');
console.log('╚══════════════════════════════════════════════════════════╝');
console.log();
let totalPassed = 0;
let totalFailed = 0;
let totalTests = 0;
for (const testFile of testFiles) {
const testPath = path.join(testsDir, testFile);
if (!fs.existsSync(testPath)) {
console.log(`⚠ Skipping ${testFile} (file not found)`);
continue;
}
console.log(`\n━━━ Running ${testFile} ━━━`);
try {
const output = execSync(`node "${testPath}"`, {
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'pipe']
});
console.log(output);
// Parse results from output
const passedMatch = output.match(/Passed:\s*(\d+)/);
const failedMatch = output.match(/Failed:\s*(\d+)/);
if (passedMatch) totalPassed += parseInt(passedMatch[1], 10);
if (failedMatch) totalFailed += parseInt(failedMatch[1], 10);
} catch (err) {
console.log(err.stdout || '');
console.log(err.stderr || '');
// Parse results even on failure
const output = (err.stdout || '') + (err.stderr || '');
const passedMatch = output.match(/Passed:\s*(\d+)/);
const failedMatch = output.match(/Failed:\s*(\d+)/);
if (passedMatch) totalPassed += parseInt(passedMatch[1], 10);
if (failedMatch) totalFailed += parseInt(failedMatch[1], 10);
}
}
totalTests = totalPassed + totalFailed;
console.log('\n╔══════════════════════════════════════════════════════════╗');
console.log('║ Final Results ║');
console.log('╠══════════════════════════════════════════════════════════╣');
console.log(`║ Total Tests: ${String(totalTests).padStart(4)}`);
console.log(`║ Passed: ${String(totalPassed).padStart(4)} ✓ ║`);
console.log(`║ Failed: ${String(totalFailed).padStart(4)} ${totalFailed > 0 ? '✗' : ' '}`);
console.log('╚══════════════════════════════════════════════════════════╝');
process.exit(totalFailed > 0 ? 1 : 0);