const { execFileSync } = require('child_process'); const fs = require('fs'); const exe = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'; const shot = process.argv[2] === 'shot'; let out = ''; try { out = execFileSync(exe, ['--headless=new', '--disable-gpu', '--no-sandbox', '--hide-scrollbars', '--window-size=1680,1400', '--virtual-time-budget=12000', shot ? '--screenshot=d:/workspace/code/fms/.tmp-shot.png' : '--dump-dom', 'file:///d:/workspace/code/fms/demo.html'], { maxBuffer: 64 * 1024 * 1024 }).toString(); } catch (e) { out = String(e.stdout || ''); console.log('ERR', String(e.stderr || '').slice(0, 400)) } if (shot) { console.log('shot ok'); process.exit(0) } fs.writeFileSync('d:/workspace/code/fms/.tmp-dom.html', out, 'utf8'); console.log(JSON.stringify({ len: out.length, vueWarn: out.indexOf('[Vue warn]') > -1, hasTreeAside: out.indexOf('模块树') > -1, hasPanel: out.indexOf('敏感字段') > -1, hasUserBar: out.indexOf('授权对象') > -1, hasOverview: out.indexOf('全部模块(概览)') > -1, hasOldTable: out.indexOf('min-w-[1000px]') > -1, hasError: out.indexOf('Uncaught') > -1 }, null, 2));