Files
youle_cocos/server/games/erqiwang/test/run.js
T

17 lines
703 B
JavaScript

// 二七王服务端单测总运行器:逐个 spawn test_*.js(各自独立进程/全局),汇总结果
// 用法:node server/games/erqiwang/test/run.js
const fs = require('fs');
const path = require('path');
const cp = require('child_process');
const dir = __dirname;
const files = fs.readdirSync(dir).filter(f => /^test_.*\.js$/.test(f)).sort();
let allOk = true;
for (const f of files) {
console.log('\n===== ' + f + ' =====');
const r = cp.spawnSync(process.execPath, [path.join(dir, f)], { stdio: 'inherit' });
if (r.status !== 0) allOk = false;
}
console.log('\n' + (allOk ? '===== 全部单测通过 =====' : '===== 存在失败单测 ====='));
process.exit(allOk ? 0 : 1);