UNPKG

modelmix

Version:

🧬 ModelMix - Unified API for Diverse AI LLM.

73 lines (63 loc) • 2.14 kB
#!/usr/bin/env node /** * 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', ]; 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('- āœ… 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 };