import { runAllTests } from './src/testing/runTests.js';

async function analyzeFailures() {
    console.log('Running test suite...');
    const results = await runAllTests();

    console.log('\n=== DETAILED FAILURE ANALYSIS ===');

    results.suites.forEach(suite => {
        if (!suite.success && suite.result && suite.result.details) {
            console.log(`\n${suite.suiteName}:`);
            suite.result.details
                .filter(test => test.state === 'failed')
                .forEach(test => {
                    console.log(`  ❌ ${test.name}`);
                    console.log(`     Error: ${test.error?.message || 'Unknown'}`);
                    if (test.error?.stack) {
                        const stackLine = test.error.stack.split('\n')[0];
                        console.log(`     Stack: ${stackLine}`);
                    }
                });
        }
    });
}

analyzeFailures().catch(console.error);