工程化:增加package.json、Prettier与ESLint配置,修复测试连接未关闭导致挂起

- 新账系统/package.json:仅开发依赖(prettier、eslint、@eslint/js、globals),运行时仍零依赖
- Prettier 只处理 .js/.mjs/.cjs/.css;ESLint 扁平配置区分后端、浏览器脚本、测试与 e2e
- scripts/gen-browser-globals.js 生成浏览器脚本间共享的全局变量清单
- 测试 after 钩子关闭服务前先 closeAllConnections(),避免未读完的响应让 server.close() 永久等待
- 4 处读取源码文本的测试断言改为不依赖空白写法(格式化前后均通过),断言含义不变

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
黄健铭andClaude Opus 5.5 committed 2026-12-04 08:55:46 -08:00
1 parent 91479fd13f
commit 3743d687e7
59 files changed
+2625 -57

No files matched your search

@@ -105,7 +105,7 @@ test('汇总显示信用卡渠道,自动费移动端取消最小横宽且屏
const h=harness();h.context.__receipts={receipt:100000,refund:0,channels:[{channel:'wechat',name:'微信',receipt:0,refund:0},{channel:'alipay',name:'支付宝',receipt:0,refund:0},{channel:'cash',name:'现金',receipt:0,refund:0},{channel:'credit_card',name:'信用卡',receipt:100000,refund:0}]};
for(const selector of ['#order-lock-activity','#order-book-people','#order-book-summary','#order-book-scope','#order-book-count','#order-list'])h.nodes.set(selector,{innerHTML:'',textContent:'',setAttribute(){}});
h.run('validateOrderBook=book=>book;peopleCountHTML=()=>"";orderBookScope=()=>"今日";orderBookFilters={q:"",status:""};renderOrderBook({rows:[],summaryWithoutCancelled:{orderCount:0,totalCost:0,profit:0,ownerCost:0,assistantCost:0,knownCounts:{}},receiptsWithoutCancelled:__receipts},{name:"今日"})');assert.match(h.nodes.get('#order-book-summary').innerHTML,/信用卡/);
const css=fs.readFileSync(path.join(__dirname,'../public/app.css'),'utf8');assert.match(css,/@media screen\{\.credit-card-preview/);assert.match(css,/#fee-rows \.fee-row\.fee-automatic\{min-width:0/);assert.match(css,/@media screen and \(max-width:650px\)\{\.credit-card-preview/);
const css=fs.readFileSync(path.join(__dirname,'../public/app.css'),'utf8').replace(/\s+/g,' ').replace(/\s*([{}:;,>])\s*/g,'$1').replace(/;}/g,'}');assert.match(css,/@media screen\{\.credit-card-preview/);assert.match(css,/#fee-rows \.fee-row\.fee-automatic\{min-width:0/);assert.match(css,/@media screen and \(max-width:650px\)\{\.credit-card-preview/);
});
test('助理1和助理2信用卡均锁定麦麦,切回非卡恢复原归属且不改克重或金额',()=>{