modelmix 3.8.0 ā 3.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +5 -1
- package/README.md +5 -3
- package/demo/demo.mjs +8 -8
- package/demo/images.mjs +9 -0
- package/demo/img.png +0 -0
- package/demo/json.mjs +4 -2
- package/index.js +143 -28
- package/package.json +20 -6
- package/test/README.md +158 -0
- package/test/bottleneck.test.js +483 -0
- package/test/fallback.test.js +387 -0
- package/test/fixtures/data.json +36 -0
- package/test/fixtures/img.png +0 -0
- package/test/fixtures/template.txt +15 -0
- package/test/images.test.js +87 -0
- package/test/json.test.js +295 -0
- package/test/live.test.js +356 -0
- package/test/mocha.opts +5 -0
- package/test/setup.js +176 -0
- package/test/templates.test.js +473 -0
- package/test/test-runner.js +73 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ModelMix Test Runner
|
|
5
|
+
*
|
|
6
|
+
* This is the main entry point for running the comprehensive test suite.
|
|
7
|
+
* It includes tests for:
|
|
8
|
+
* - JSON schema generation and structured outputs
|
|
9
|
+
* - Provider fallback chains
|
|
10
|
+
* - Different providers (OpenAI, Anthropic, Google, etc.)
|
|
11
|
+
* - File operations and template system
|
|
12
|
+
* - Image processing and multimodal support
|
|
13
|
+
* - MCP (Model Context Protocol) integration
|
|
14
|
+
* - Rate limiting with Bottleneck
|
|
15
|
+
* - Integration tests and edge cases
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const { spawn } = require('child_process');
|
|
19
|
+
const path = require('path');
|
|
20
|
+
|
|
21
|
+
const testFiles = [
|
|
22
|
+
'json.test.js',
|
|
23
|
+
'fallback.test.js',
|
|
24
|
+
'templates.test.js',
|
|
25
|
+
'images.test.js',
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
console.log('𧬠ModelMix Test Suite Runner');
|
|
29
|
+
console.log('==============================');
|
|
30
|
+
console.log(`Running ${testFiles.length} test suites...\n`);
|
|
31
|
+
|
|
32
|
+
function runTests() {
|
|
33
|
+
const args = [
|
|
34
|
+
'--timeout', '10000',
|
|
35
|
+
'--recursive',
|
|
36
|
+
'test/**/*.test.js'
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
const child = spawn('npx', ['mocha', ...args], {
|
|
40
|
+
cwd: process.cwd(),
|
|
41
|
+
stdio: 'inherit'
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
child.on('close', (code) => {
|
|
45
|
+
if (code === 0) {
|
|
46
|
+
console.log('\nā
All tests passed!');
|
|
47
|
+
console.log('\nTest Coverage:');
|
|
48
|
+
console.log('- ā
JSON Schema Generation');
|
|
49
|
+
console.log('- ā
Provider Fallback Chains');
|
|
50
|
+
console.log('- ā
Multiple Providers (OpenAI, Anthropic, Google, etc.)');
|
|
51
|
+
console.log('- ā
File Operations & Templates');
|
|
52
|
+
console.log('- ā
Image Processing & Multimodal');
|
|
53
|
+
console.log('- ā
MCP Integration');
|
|
54
|
+
console.log('- ā
Rate Limiting with Bottleneck');
|
|
55
|
+
console.log('- ā
Integration & Edge Cases');
|
|
56
|
+
} else {
|
|
57
|
+
console.error(`\nā Tests failed with exit code ${code}`);
|
|
58
|
+
process.exit(code);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
child.on('error', (err) => {
|
|
63
|
+
console.error('ā Failed to start test runner:', err);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Run the tests
|
|
69
|
+
if (require.main === module) {
|
|
70
|
+
runTests();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = { runTests, testFiles };
|