lili b6c1d4a02c test(studio): E6/U6 创作流单测——vitest + store 编排 + Create.vue(plan 命名件 Create.spec.ts)
补 plan 002 U6 命名交付件 + 回归保护我 U6 重构(此前仅 build+HTTP+CDP,无单测):
- 引入 vitest 3.2.6 + @vue/test-utils + happy-dom(Vite8 标准测试栈)+ vitest.config.ts(独立于 vite.config 避 mock 中间件)+ `npm test` 脚本
- src/store/create.spec.ts(8 测):vi.mock studioApi 验编排——loadTemplates/create/pollTask 终态停轮询(fake timers)/modify/extend/regenerate/reset
- src/views/create/Create.spec.ts(4 测):mount + 填 Prompt 启用提交 + 提交调 createGame(一步式)+ router.push 进度页带 gameId;验不走旧两步

验证:`npm test` 12/12 绿;`npm run build`(vue-tsc -b)仍绿(spec 经 import 取 vitest 类型,不污染产物 bundle)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 16:36:42 -07:00

17 lines
553 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* vitest 配置(独立于 vite.config.ts避开本地 mock 中间件插件——单测不需要 dev/preview 的 mock server)。
* 环境 happy-dom供 @vue/test-utils 组件测试 + store 测试(轻量 DOM)。
* 用途U6 创作流单测(plan 002 U6 Create.spec.ts + store 编排);跑 `npm test`。
*/
import { defineConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
test: {
environment: 'happy-dom',
globals: true,
include: ['src/**/*.spec.ts'],
},
})