fmt + output

This commit is contained in:
shenjack 2024-03-19 20:26:17 +08:00
parent 59ddf6dda9
commit 8daaed1ef9
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -77,6 +77,7 @@ const cqd_name_list = [
'Iwn<Zo@nan', 'Iwn<Zo@nan',
'U>7D3Ol7uWKIfTC@XJ联队' 'U>7D3Ol7uWKIfTC@XJ联队'
] ]
function createJSDOMForOpponent(opponent, name, mode, testString, config, localStorageMock, path, results) { function createJSDOMForOpponent(opponent, name, mode, testString, config, localStorageMock, path, results) {
return new Promise((resolve) => { return new Promise((resolve) => {
new JSDOM(fs.readFileSync(path.join(__dirname, 'static/md5.html'), 'utf-8'), { new JSDOM(fs.readFileSync(path.join(__dirname, 'static/md5.html'), 'utf-8'), {
@ -93,11 +94,14 @@ function createJSDOMForOpponent(opponent, name, mode, testString, config, localS
results.push(args[2]); results.push(args[2]);
window.close(); window.close();
resolve(); // 解决Promise表示当前JSDOM操作完成 resolve(); // 解决Promise表示当前JSDOM操作完成
} };
window.output = (...message) => {
console.log('page:', message);
};
} }
}); });
}); });
} }
console.log(chalk`{gray child {bold ${id}} started.}`); console.log(chalk`{gray child {bold ${id}} started.}`);
process.on('message', ([mode, name]) => { process.on('message', ([mode, name]) => {
@ -123,8 +127,8 @@ process.on('message', ([mode, name]) => {
}; };
} }
}); });
}else if(mode == "CQD"){ } else if (mode == "CQD") {
var results=[]; var results = [];
(async () => { (async () => {
for (let i = 0; i < cqd_name_list.length; i++) { for (let i = 0; i < cqd_name_list.length; i++) {
var opponent = cqd_name_list[i]; var opponent = cqd_name_list[i];