工程化:增加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:
1 parent
91479fd13f
commit
3743d687e7
59 files changed
+2625
-57
No files matched your search
@@ -51,7 +51,7 @@ test('旧状态和旧打印页不能覆盖新记录,重试幂等,失败事
|
||||
});
|
||||
test('HTTP打印页自动登记且无人工确认入口,接口鉴权、账号切换和重试正常',async t=>{
|
||||
const f=fixture(t),dir=fs.mkdtempSync(path.join(os.tmpdir(),'print-status-http-')),app=createApp({mode:'trial',ledger:f.l,dataDir:dir,networkAccess:{header:'',trustedProxies:[]},feishuConfig:{enabled:false}});
|
||||
await new Promise(done=>app.server.listen(0,'127.0.0.1',done));t.after(async()=>{await new Promise(done=>app.server.close(done));fs.rmSync(dir,{recursive:true,force:true});});
|
||||
await new Promise(done=>app.server.listen(0,'127.0.0.1',done));t.after(async()=>{await new Promise(done=>{app.server.closeAllConnections();app.server.close(done);});fs.rmSync(dir,{recursive:true,force:true});});
|
||||
const base='http://127.0.0.1:'+app.server.address().port;
|
||||
const login=await fetch(base+'/api/login',{method:'POST',headers:{'Content-Type':'application/json','X-Requested-With':'maimai-ledger',Origin:base},body:JSON.stringify({name:f.actors.assistant.name,password:'synthetic-print-password'})});assert.equal(login.status,200);
|
||||
const headers={Cookie:login.headers.get('set-cookie').split(';')[0],'X-Ledger-User':f.actors.assistant.id},url=base+'/api/print-status/order/'+f.order;
|
||||
|
||||
Reference in new issue
Block a user