test(desktop): 前端单元 + 关键组件测试(Vitest + RTL,31 例)
测试基建:vite.config.ts 加 test 配置(jsdom + setup),package.json 加 test/test:watch 脚本,src/test/setup.ts 引 jest-dom;tsconfig 把测试文件 exclude, 使 CI 现有 tsc --noEmit 不检查测试文件(仍绿),测试由 Vitest 自跑(先不接 CI)。 覆盖(31 例 / 4 文件): - dsl:exportDsl 节点/边映射 + config 兜底 + branch 真假边 sourceHandle 条件; validate 空画布/孤立节点/必填项缺失。 - version:isNewer 版本比较矩阵;checkUpdate 有更新/同版/旧版/404限流/离线异常; openExternal Wails / 浏览器双路径。 - run:deriveNodes start→running、end→done+耗时、error、error 不被 start 覆盖、 info 累计 notes、首现顺序、label 更新。 - UpdateBanner(RTL):无更新不渲染、有更新显版本+点下载调 openExternal、点忽略消失。 小改:version.ts 导出 isNewer(原私有)以便直接测版本判定矩阵。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,9 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@xyflow/react": "^12.3.0",
|
||||
@@ -16,13 +18,18 @@
|
||||
"react-force-graph-2d": "^1.29.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"@vitejs/plugin-react": "^4.3.0",
|
||||
"autoprefixer": "^10.4.0",
|
||||
"jsdom": "^29.1.1",
|
||||
"postcss": "^8.4.0",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"typescript": "^5.6.0",
|
||||
"vite": "^5.4.0"
|
||||
"vite": "^5.4.0",
|
||||
"vitest": "^4.1.9"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user