- 后端:Bun + Hono + Drizzle ORM + SQLite - 前端:Vue 3 + Naive UI + ECharts - 项目管理:创建项目 + 绑定 Git 仓库 - OKR 系统:目标/关键结果 CRUD + 进度追踪 - Git 同步:Gitea API 自动同步 commit/PR + 作者关联 - 数据看板:项目 OKR 进度 + KR 状态分布 + 代码活动 - 权限体系:admin/manager/developer/viewer 四级 - Docker 部署:docker-compose + nginx Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
55 lines
1.1 KiB
TypeScript
55 lines
1.1 KiB
TypeScript
/**
|
|
* Vitest setup file for Vue component tests.
|
|
*
|
|
* Provides global mocks for:
|
|
* - ECharts (avoid canvas rendering in jsdom)
|
|
* - ResizeObserver (not available in jsdom)
|
|
* - Vue Router (for components that use router-link)
|
|
*/
|
|
import { vi } from 'vitest';
|
|
|
|
// Mock ECharts to avoid canvas/WebGL errors in jsdom
|
|
vi.mock('echarts/core', () => ({
|
|
use: vi.fn(),
|
|
init: vi.fn(() => ({
|
|
setOption: vi.fn(),
|
|
resize: vi.fn(),
|
|
dispose: vi.fn(),
|
|
on: vi.fn(),
|
|
off: vi.fn(),
|
|
getWidth: vi.fn(() => 800),
|
|
getHeight: vi.fn(() => 400),
|
|
})),
|
|
}));
|
|
|
|
vi.mock('echarts/charts', () => ({
|
|
BarChart: {},
|
|
LineChart: {},
|
|
PieChart: {},
|
|
RadarChart: {},
|
|
HeatmapChart: {},
|
|
CustomChart: {},
|
|
}));
|
|
|
|
vi.mock('echarts/components', () => ({
|
|
GridComponent: {},
|
|
TooltipComponent: {},
|
|
LegendComponent: {},
|
|
TitleComponent: {},
|
|
DataZoomComponent: {},
|
|
ToolboxComponent: {},
|
|
VisualMapComponent: {},
|
|
CalendarComponent: {},
|
|
}));
|
|
|
|
vi.mock('echarts/renderers', () => ({
|
|
CanvasRenderer: {},
|
|
}));
|
|
|
|
// Mock ResizeObserver
|
|
global.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
observe: vi.fn(),
|
|
unobserve: vi.fn(),
|
|
disconnect: vi.fn(),
|
|
}));
|