-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_mapreduce_load.js
More file actions
35 lines (26 loc) · 1.15 KB
/
test_mapreduce_load.js
File metadata and controls
35 lines (26 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 测试 Map-Reduce 脚本加载
const path = require('path');
console.log('[Test] 开始测试 Map-Reduce 脚本加载...');
const SCRIPTS_DIR = path.resolve(__dirname, 'scripts');
const MAPREDUCE_SCRIPT = path.join(SCRIPTS_DIR, 'mapreduce-refactor.js');
console.log('[Test] 脚本路径:', MAPREDUCE_SCRIPT);
console.log('[Test] 文件存在:', require('fs').existsSync(MAPREDUCE_SCRIPT));
try {
// 清除缓存
delete require.cache[require.resolve(MAPREDUCE_SCRIPT)];
// 加载模块
const module = require(MAPREDUCE_SCRIPT);
console.log('[Test] ✅ 模块加载成功');
console.log('[Test] 导出函数:', Object.keys(module));
// 检查必需函数
const requiredFunctions = ['calculateTasks', 'generateFFmpegCommand', 'generateReduceCommand'];
const missingFunctions = requiredFunctions.filter(fn => typeof module[fn] !== 'function');
if (missingFunctions.length > 0) {
console.log('[Test] ❌ 缺少函数:', missingFunctions);
} else {
console.log('[Test] ✅ 所有必需函数都存在');
}
} catch (error) {
console.log('[Test] ❌ 加载失败:', error.message);
console.log('[Test] 错误堆栈:', error.stack);
}