modelmix
Version:
𧬠ModelMix - Unified API for Diverse AI LLM.
75 lines (65 loc) ⢠2.21 kB
JavaScript
/**
* ModelMix Test Runner
*
* This is the main entry point for running the comprehensive test suite.
* It includes tests for:
* - JSON schema generation and structured outputs
* - Provider fallback chains
* - Different providers (OpenAI, Anthropic, Google, etc.)
* - File operations and template system
* - Image processing and multimodal support
* - MCP (Model Context Protocol) integration
* - Rate limiting with Bottleneck
* - Integration tests and edge cases
*/
const { spawn } = require('child_process');
const path = require('path');
const testFiles = [
'json.test.js',
'fallback.test.js',
'templates.test.js',
'images.test.js',
'live.mcp.js',
];
console.log('𧬠ModelMix Test Suite Runner');
console.log('==============================');
console.log(`Running ${testFiles.length} test suites...\n`);
function runTests() {
const args = [
'--timeout', '10000',
'--recursive',
'test/**/*.test.js'
];
const child = spawn('npx', ['mocha', ...args], {
cwd: process.cwd(),
stdio: 'inherit'
});
child.on('close', (code) => {
if (code === 0) {
console.log('\nā
All tests passed!');
console.log('\nTest Coverage:');
console.log('- ā
JSON Schema Generation');
console.log('- ā
Provider Fallback Chains');
console.log('- ā
Multiple Providers (OpenAI, Anthropic, Google, etc.)');
console.log('- ā
File Operations & Templates');
console.log('- ā
Image Processing & Multimodal');
console.log('- ā
MCP Integration');
console.log('- ā
Live MCP Tools Testing');
console.log('- ā
Rate Limiting with Bottleneck');
console.log('- ā
Integration & Edge Cases');
} else {
console.error(`\nā Tests failed with exit code ${code}`);
process.exit(code);
}
});
child.on('error', (err) => {
console.error('ā Failed to start test runner:', err);
process.exit(1);
});
}
// Run the tests
if (require.main === module) {
runTests();
}
module.exports = { runTests, testFiles };