diff --git a/node_run/static/md5.js b/node_run/static/md5.js index a8fa941..5559b3c 100644 --- a/node_run/static/md5.js +++ b/node_run/static/md5.js @@ -12337,7 +12337,9 @@ async_goto = 6 break case 8: - if (C.Array.w(o, n.a(f.a[0]).e.gb2())) ++p.win_count; + if (C.Array.w(o, n.a(f.a[0]).e.gb2())) { + ++p.win_count + }; ++i; ++p.current_count async_goto = 3 @@ -12360,6 +12362,7 @@ } q = new T.aq(n, l) + // 当前场次, 目标场次, 胜率 output(p.current_count, p.target_count, p.win_count * 100 / p.current_count) //捕获胜率 if (p.current_count >= config[stage].count) { diff --git a/node_run/test.js b/node_run/test.js index 87af207..a9e799e 100644 --- a/node_run/test.js +++ b/node_run/test.js @@ -1,26 +1,28 @@ -const { JSDOM } = require('jsdom'); -const jsdom=require('jsdom'); +const { + JSDOM +} = require('jsdom'); +const jsdom = require('jsdom'); const fs = require('fs'); const path = require('path'); -async function test(str){ +async function test(str) { const localStorageMock = { setItem: function (key, value) { - this[key] = value; + this[key] = value; }, getItem: function (key) { - return this[key] || null; + return this[key] || null; }, removeItem: function (key) { - delete this[key]; + delete this[key]; }, clear: function () { - for (const key in this) { - if (this.hasOwnProperty(key) && key !== 'setItem' && key !== 'getItem' && key !== 'removeItem' && key !== 'clear') { - delete this[key]; + for (const key in this) { + if (this.hasOwnProperty(key) && key !== 'setItem' && key !== 'getItem' && key !== 'removeItem' && key !== 'clear') { + delete this[key]; + } } } - } }; // 在你的 JSDOM 初始化代码之前 let resolvePromise; @@ -32,12 +34,15 @@ async function test(str){ const virtualConsole = new jsdom.VirtualConsole(); const dom = new JSDOM(fs.readFileSync(path.join(__dirname, 'static/md5.html'), 'utf-8'), { url: 'file://' + path.join(__dirname, 'static/'), - console:virtualConsole, + console: virtualConsole, runScripts: 'dangerously', resources: 'usable', beforeParse(window) { window.FakelocalStorage = localStorageMock; - window.config =[{"count":11000,"score":10}]; + window.config = [{ + "count": 12000, + "score": 10 + }]; window.name_input = str; window.stage = 0; window.skillData = []; @@ -62,6 +67,5 @@ async function test(str){ //str="!test!\n!\n\n11@qwerb\n\n1233"; -str="!test!\n!\n\n11@qwerb\n\n1233"; -test(str) - +str = "!test!\n!\n\n11@qwerb\n\n1233"; +test(str) \ No newline at end of file