il2cpp-dump-analyzer-mcp
Version:
Agentic RAG system for analyzing IL2CPP dump.cs files from Unity games
216 lines โข 8.22 kB
JavaScript
;
/**
* Comprehensive test runner for IL2CPP dump analyzer MCP system
* Runs all test suites and generates detailed reports
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = require("child_process");
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const TEST_SUITES = [
{
name: 'Unit Tests',
command: 'npm run test:unit',
description: 'Core unit tests for MCP tools and components',
timeout: 60000
},
{
name: 'Integration Tests',
command: 'npm run test:integration',
description: 'End-to-end integration tests',
timeout: 120000
},
{
name: 'Performance Tests',
command: 'npm run test:performance',
description: 'Performance and load testing',
timeout: 180000
},
{
name: 'MCP Tools Tests',
command: 'npm run test:mcp-tools',
description: 'Specific tests for MCP tool implementations',
timeout: 90000
},
{
name: 'Coverage Report',
command: 'npm run test:coverage',
description: 'Generate comprehensive test coverage report',
timeout: 120000
}
];
async function runTestSuite(suite) {
console.log(`\n๐งช Running ${suite.name}...`);
console.log(`๐ ${suite.description}`);
const startTime = Date.now();
try {
const output = (0, child_process_1.execSync)(suite.command, {
encoding: 'utf-8',
timeout: suite.timeout,
stdio: 'pipe'
});
const duration = Date.now() - startTime;
console.log(`โ
${suite.name} completed in ${duration}ms`);
return {
suite: suite.name,
passed: true,
duration,
output
};
}
catch (error) {
const duration = Date.now() - startTime;
console.log(`โ ${suite.name} failed after ${duration}ms`);
console.log(`Error: ${error.message}`);
return {
suite: suite.name,
passed: false,
duration,
output: error.stdout || '',
error: error.message
};
}
}
async function generateTestReport(results) {
const reportDir = path.join(process.cwd(), 'test-reports');
if (!fs.existsSync(reportDir)) {
fs.mkdirSync(reportDir, { recursive: true });
}
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
const reportPath = path.join(reportDir, `test-report-${timestamp}.json`);
const report = {
timestamp: new Date().toISOString(),
summary: {
total: results.length,
passed: results.filter(r => r.passed).length,
failed: results.filter(r => !r.passed).length,
totalDuration: results.reduce((sum, r) => sum + r.duration, 0)
},
results
};
fs.writeFileSync(reportPath, JSON.stringify(report, null, 2));
console.log(`\n๐ Test report saved to: ${reportPath}`);
// Generate markdown summary
const markdownPath = path.join(reportDir, `test-summary-${timestamp}.md`);
const markdown = generateMarkdownSummary(report);
fs.writeFileSync(markdownPath, markdown);
console.log(`๐ Markdown summary saved to: ${markdownPath}`);
}
function generateMarkdownSummary(report) {
const { summary, results } = report;
const successRate = ((summary.passed / summary.total) * 100).toFixed(1);
let markdown = `# IL2CPP Dump Analyzer MCP - Test Report\n\n`;
markdown += `**Generated:** ${report.timestamp}\n\n`;
markdown += `## Summary\n\n`;
markdown += `- **Total Test Suites:** ${summary.total}\n`;
markdown += `- **Passed:** ${summary.passed} โ
\n`;
markdown += `- **Failed:** ${summary.failed} โ\n`;
markdown += `- **Success Rate:** ${successRate}%\n`;
markdown += `- **Total Duration:** ${(summary.totalDuration / 1000).toFixed(2)}s\n\n`;
markdown += `## Test Suite Results\n\n`;
results.forEach((result) => {
const status = result.passed ? 'โ
PASSED' : 'โ FAILED';
const duration = (result.duration / 1000).toFixed(2);
markdown += `### ${result.suite} ${status}\n\n`;
markdown += `- **Duration:** ${duration}s\n`;
if (result.error) {
markdown += `- **Error:** ${result.error}\n`;
}
markdown += `\n`;
});
if (summary.failed > 0) {
markdown += `## Recommendations\n\n`;
markdown += `Some test suites failed. Please review the following:\n\n`;
results.filter((r) => !r.passed).forEach((result) => {
markdown += `- **${result.suite}:** Check the error details and fix any issues\n`;
});
markdown += `\n`;
markdown += `Run individual test suites for more detailed debugging:\n`;
markdown += `\`\`\`bash\n`;
markdown += `npm run test:unit\n`;
markdown += `npm run test:integration\n`;
markdown += `npm run test:performance\n`;
markdown += `\`\`\`\n`;
}
return markdown;
}
async function main() {
console.log('๐ Starting comprehensive test suite for IL2CPP Dump Analyzer MCP');
console.log('='.repeat(80));
const results = [];
for (const suite of TEST_SUITES) {
const result = await runTestSuite(suite);
results.push(result);
// Add a small delay between test suites
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log('\n' + '='.repeat(80));
console.log('๐ Test Summary:');
const passed = results.filter(r => r.passed).length;
const failed = results.filter(r => !r.passed).length;
const totalDuration = results.reduce((sum, r) => sum + r.duration, 0);
console.log(`โ
Passed: ${passed}`);
console.log(`โ Failed: ${failed}`);
console.log(`โฑ๏ธ Total Duration: ${(totalDuration / 1000).toFixed(2)}s`);
console.log(`๐ Success Rate: ${((passed / results.length) * 100).toFixed(1)}%`);
await generateTestReport(results);
if (failed > 0) {
console.log('\nโ ๏ธ Some tests failed. Please review the test report for details.');
process.exit(1);
}
else {
console.log('\n๐ All tests passed successfully!');
process.exit(0);
}
}
// Handle uncaught errors
process.on('uncaughtException', (error) => {
console.error('โ Uncaught exception:', error);
process.exit(1);
});
process.on('unhandledRejection', (reason, promise) => {
console.error('โ Unhandled rejection at:', promise, 'reason:', reason);
process.exit(1);
});
// Run the test suite
if (require.main === module) {
main().catch(error => {
console.error('โ Test runner failed:', error);
process.exit(1);
});
}
//# sourceMappingURL=run-all-tests.js.map