Files
everything-claude-code/tests/run-all.js
justtrance-web 912df24f4a feat: automatic project type and framework detection (#293)
Add SessionStart hook integration that auto-detects project languages
and frameworks by inspecting marker files and dependency manifests.

Supports 12 languages (Python, TypeScript, Go, Rust, Ruby, Java, C#,
Swift, Kotlin, Elixir, PHP, JavaScript) and 25+ frameworks (Next.js,
React, Django, FastAPI, Rails, Laravel, Spring, etc.).

Detection output is injected into Claude's context as JSON, enabling
context-aware recommendations without loading irrelevant rules.

- New: scripts/lib/project-detect.js (cross-platform detection library)
- Modified: scripts/hooks/session-start.js (integration)
- New: tests/lib/project-detect.test.js (28 tests, all passing)

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-02 22:07:10 -08:00

83 lines
2.4 KiB
JavaScript

#!/usr/bin/env node
/**
* Run all tests
*
* Usage: node tests/run-all.js
*/
const { spawnSync } = 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',
'lib/session-manager.test.js',
'lib/session-aliases.test.js',
'lib/project-detect.test.js',
'hooks/hooks.test.js',
'hooks/evaluate-session.test.js',
'hooks/suggest-compact.test.js',
'integration/hooks.test.js',
'ci/validators.test.js',
'scripts/claw.test.js',
'scripts/setup-package-manager.test.js',
'scripts/skill-create-output.test.js'
];
const BOX_W = 58; // inner width between ║ delimiters
const boxLine = (s) => `${s.padEnd(BOX_W)}`;
console.log('╔' + '═'.repeat(BOX_W) + '╗');
console.log(boxLine(' Everything Claude Code - Test Suite'));
console.log('╚' + '═'.repeat(BOX_W) + '╝');
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} ━━━`);
const result = spawnSync('node', [testPath], {
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'pipe']
});
const stdout = result.stdout || '';
const stderr = result.stderr || '';
// Show both stdout and stderr so hook warnings are visible
if (stdout) console.log(stdout);
if (stderr) console.log(stderr);
// Parse results from combined output
const combined = stdout + stderr;
const passedMatch = combined.match(/Passed:\s*(\d+)/);
const failedMatch = combined.match(/Failed:\s*(\d+)/);
if (passedMatch) totalPassed += parseInt(passedMatch[1], 10);
if (failedMatch) totalFailed += parseInt(failedMatch[1], 10);
}
totalTests = totalPassed + totalFailed;
console.log('\n╔' + '═'.repeat(BOX_W) + '╗');
console.log(boxLine(' Final Results'));
console.log('╠' + '═'.repeat(BOX_W) + '╣');
console.log(boxLine(` Total Tests: ${String(totalTests).padStart(4)}`));
console.log(boxLine(` Passed: ${String(totalPassed).padStart(4)}`));
console.log(boxLine(` Failed: ${String(totalFailed).padStart(4)} ${totalFailed > 0 ? '✗' : ' '}`));
console.log('╚' + '═'.repeat(BOX_W) + '╝');
process.exit(totalFailed > 0 ? 1 : 0);