补 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>
17 lines
553 B
TypeScript
17 lines
553 B
TypeScript
/**
|
||
* 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'],
|
||
},
|
||
})
|