init: TS 版 dacli v0.7 baseline (8 父命令/26+ 子命令, 0.4MB, .claude/skills/dacli-ts)
参考 boot/ 仓库结构初始化, 同步到 gitea:3000/ssw/dacli (private). 包括: - src/ 8 父命令 (form/menu/dm/dict/di/apis/doc/workflow + login/status) + core (client/crypto/help/log/types/config) - src/schema/ FieldBuilder (从 JNPF web 源码提取, 避免 53 个手写 builder) - tests/ vitest 单元 + playwright E2E (含 workSystem/developSystem baseline regression) - scripts/ extract-all.mjs (从 jnpf-web 源码生成 schema) + seed-tds-baseline.ts - doc/ architecture/plan/api/extractors/baseline/RESUME/help-system + v0.6/v0.7 changelog - .claude/skills/dacli-ts/ Claude 集成 skill (SKILL.md + 5 references + 7 examples + 3 baseline) - CLAUDE.md (项目说明) + README.md + prompt.md (开发任务说明书) - 配置文件: package.json/lock, tsconfig, vitest.config, playwright.config
This commit is contained in:
commit
c98ad4f425
93 files changed
+12718
No files matched your search
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* tests/e2e/baseline/developSystem/regression.spec.ts
|
||||
*
|
||||
* developSystem baseline 回归测试 (API 层 0 错):
|
||||
* - switch-app 切到 developSystem
|
||||
* - 拿 form list
|
||||
* - 对每张表单跑 info 验证 schema 完整
|
||||
* - 汇总 PASS / FAIL
|
||||
*
|
||||
* 跑法:
|
||||
* npx playwright test tests/e2e/baseline/developSystem/regression.spec.ts
|
||||
*/
|
||||
import { test, expect } from '@playwright/test'
|
||||
import { execSync } from 'node:child_process'
|
||||
|
||||
const APP_CODE = 'developSystem'
|
||||
|
||||
interface FormRow { id: string; enCode: string; fullName: string; type: number; webType?: string }
|
||||
|
||||
function dacli(args: string): string {
|
||||
return execSync(`npx tsx src/cli.ts ${args}`, {
|
||||
encoding: 'utf-8',
|
||||
cwd: process.cwd(),
|
||||
})
|
||||
}
|
||||
|
||||
test.describe.configure({ mode: 'serial' })
|
||||
|
||||
test(`switch-app ${APP_CODE} 成功`, () => {
|
||||
// switch-app --force 在 client.ts:fromToken 里被读 forceLogin
|
||||
dacli(`switch-app --appCode=${APP_CODE}`)
|
||||
const st = dacli(`status`)
|
||||
expect(st).toContain(APP_CODE)
|
||||
})
|
||||
|
||||
test('developSystem form list 返回 25+ 张 (v0.6 真总数 29)', () => {
|
||||
const out = dacli(`form list --limit=200 --json`)
|
||||
const json = JSON.parse(out) as { list: FormRow[] }
|
||||
// v0.6 修 dacli list bug 后真总数 29 (vs v0.5 误报 20 — 旧版走 /list 强制 enableFlow=1)
|
||||
expect(json.list.length, `developSystem form 真总数应 ≥25, 实际 ${json.list.length}`).toBeGreaterThanOrEqual(25)
|
||||
})
|
||||
|
||||
test('每张 form info 都能拿到完整 schema', () => {
|
||||
const out = dacli(`form list --limit=200 --json`)
|
||||
const json = JSON.parse(out) as { list: FormRow[] }
|
||||
const forms = json.list || []
|
||||
|
||||
const results: { enCode: string; ok: boolean; err?: string }[] = []
|
||||
for (const f of forms) {
|
||||
try {
|
||||
const infoOut = dacli(`form info ${f.id}`)
|
||||
const info = JSON.parse(infoOut) as { fullName: string; formData: string | null; tables?: string }
|
||||
if (!info.fullName) throw new Error('fullName 缺失')
|
||||
// formData 可能是 null (视图) / 对象 (新格式) / 数组 (旧格式) — 都接受
|
||||
if (info.formData) {
|
||||
const formData = JSON.parse(info.formData) as { fields?: unknown[] } | unknown[]
|
||||
if (Array.isArray(formData)) {
|
||||
// 接受
|
||||
} else if (formData && typeof formData === 'object') {
|
||||
const fields = (formData as { fields?: unknown[] }).fields
|
||||
if (fields !== undefined && !Array.isArray(fields)) {
|
||||
throw new Error('formData.fields 非数组')
|
||||
}
|
||||
} else {
|
||||
throw new Error('formData 既非对象也非数组')
|
||||
}
|
||||
}
|
||||
results.push({ enCode: f.enCode, ok: true })
|
||||
} catch (e) {
|
||||
results.push({ enCode: f.enCode, ok: false, err: (e as Error).message })
|
||||
}
|
||||
}
|
||||
|
||||
const okCount = results.filter((r) => r.ok).length
|
||||
const failCount = results.length - okCount
|
||||
console.log(` ✓ PASS: ${okCount}/${results.length}`)
|
||||
if (failCount > 0) {
|
||||
console.log(' ✗ FAIL:')
|
||||
for (const r of results.filter((x) => !x.ok)) console.log(` - ${r.enCode}: ${r.err}`)
|
||||
}
|
||||
expect(failCount, `${failCount} 张表单 info 失败`).toBe(0)
|
||||
})
|
||||
|
||||
test('workSystem form list 同样通 (真总数 85)', () => {
|
||||
dacli(`switch-app --appCode=workSystem`)
|
||||
const out = dacli(`form list --limit=200 --json`)
|
||||
const json = JSON.parse(out) as { list: FormRow[] }
|
||||
expect(json.list.length).toBeGreaterThanOrEqual(80)
|
||||
})
|
||||
Reference in new issue
Block a user