Files
apes-sidebar/vitest.config.ts
T
Menghuan1918 7ee0b457a3 feat: CI 挂载冒烟门禁 — npm 打包 → 真实挂载 DSH → 无头渲染防 crash
新增 plugin-mount job(pnpm test:mount):
- scripts/e2e-mount.sh:scratch profile 引导(allowBuilds/minimumReleaseAgeExclude 预写)→ 官方
  dsh plugin --profile web add file:<tarball> 挂载(dsh.profile.bundles 协调校验)→ keyless
  dsh web --port 0 → Playwright 无头渲染 → trap 清理
- tests/e2e/mount.e2e.ts:seed 工作区+会话(宿主 RPC)→ 断言 #root 与 [data-dsh-better-sidebar]
  挂载、无崩溃标记(错误条/pageerror/插件 console 错误)→ + 菜单逐个打开内置 tab 深扫
- playwright.config.ts:chromium headless、单 worker、retries 0、失败留 trace/截图/HTML 报告
- vitest exclude 与 *.e2e.ts 命名双保险隔离;exclude 整体替换默认值,须保留默认排除项
- CI 钉住 @deepseek-ai/dsh@0.1.0-rc.6;DSH_TELEMETRY_DISABLED=1;workflow_dispatch + PR 并发取消

已验证:本地端到端全绿;人为注入 tab 组件 crash → 门禁变红(错误条检出),还原后变绿;
typecheck/vitest 全绿;CI 同款 npm 安装 CLI 路径实测通过
2026-08-15 01:21:21 +08:00

37 lines
1.5 KiB
TypeScript

/**
* Vitest config: inline the npm-published `@deepseek-ai/*` packages whose
* BUILT lib bundles css side-effect imports (e.g. `dsh-client-ui-primitives`
* imports `katex/dist/katex.min.css` at the top of its `lib/index.js`).
*
* Installed from the npm registry (the default since v0.4.1) these packages
* live under `node_modules/.pnpm` and are externalized by vitest — Node then
* chokes on the `.css` import. Inlining routes them through Vite's transform,
* which stubs css imports (the default `css: false`). The previous
* `link:`-to-source-checkout install needed no such config: linked files sit
* outside `node_modules` and are transformed by default.
*/
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
server: {
deps: {
inline: [/@deepseek-ai\/dsh-client-ui-primitives/],
},
},
// The Playwright headless-render lane lives in tests/e2e (specs named
// *.e2e.ts). Keep vitest from ever collecting it, both by naming (the
// default include only matches *.test.* / *.spec.*) and by an explicit
// exclude. NOTE: `exclude` REPLACES vitest's defaults, so the standard
// node_modules/dist/etc. excludes must be restated here.
exclude: [
'tests/e2e/**',
'**/node_modules/**',
'**/dist/**',
'**/cypress/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*',
],
},
})