Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

test(ci): 显式声明 playwright/coverage-v8 依赖并修正 L2 通道与 CI 口径

hairyf26d6a13aa7e4
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3a916ec4..bc23a21b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -68,6 +68,11 @@ jobs:
- name: Lint
run: pnpm run lint
+ # test/plugin-resource-closure.test.ts 断言部署产物 src-tauri/resources/node_modules,
+ # 该目录由 build:plugins 生成;不构建则整组用例 skipIf 跳过、在 CI 里从不执行。
+ - name: Build Plugins
+ run: pnpm build:plugins
+
- name: Unit test
run: pnpm run test:unit -- --run
@@ -88,6 +93,11 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
+ # Chromium 二进制不带在 npm 包里:runner 缺它时 chromium.launch() 会直接失败,
+ # 浏览器类用例必须真跑,不能因缺二进制而静默跳过。
+ - name: Install Playwright Chromium
+ run: pnpm exec playwright install --with-deps chromium
+
# L2 只针对构建产物运行(官方「真实入口路径」要求),未构建会直接失败。
- name: Build Plugins
run: pnpm build:plugins
diff --git a/package.json b/package.json
index cbcb55cb..32ceffb4 100644
--- a/package.json
+++ b/package.json
@@ -90,6 +90,7 @@
"@types/react-dom": "catalog:types",
"@types/semver": "catalog:types",
"@vitejs/plugin-react": "catalog:build",
+ "@vitest/coverage-v8": "catalog:testing",
"@wdio/tauri-service": "catalog:testing",
"babel-plugin-react-compiler": "catalog:build",
"bumpp": "catalog:release",
@@ -101,6 +102,7 @@
"eslint-plugin-react-refresh": "catalog:lint",
"knip": "catalog:lint",
"pathe": "catalog:utils",
+ "playwright": "catalog:testing",
"publint": "catalog:cli",
"tailwindcss": "catalog:build",
"tinyexec": "catalog:utils",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1e30b345..5f66f231 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -218,9 +218,15 @@ catalogs:
specifier: ^2.6.0
version: 2.6.0
testing:
+ '@vitest/coverage-v8':
+ specifier: ^4.1.11
+ version: 4.1.11
'@wdio/tauri-service':
specifier: ^1.4.0
version: 1.4.0
+ playwright:
+ specifier: ^1.63.0
+ version: 1.63.0
vitest:
specifier: ^4.1.11
version: 4.1.11
@@ -380,7 +386,7 @@ importers:
devDependencies:
'@antfu/eslint-config':
specifier: catalog:lint
'@deepseek-ai/cordis':
specifier: catalog:dsh
version: 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])
@@ -492,6 +498,9 @@ importers:
'@vitejs/plugin-react':
specifier: catalog:build
+ '@vitest/coverage-v8':
+ specifier: catalog:testing
+ version: 4.1.11([email protected])
'@wdio/tauri-service':
specifier: catalog:testing
@@ -525,6 +534,9 @@ importers:
pathe:
specifier: catalog:utils
version: 2.0.3
+ playwright:
+ specifier: catalog:testing
+ version: 1.63.0
publint:
specifier: catalog:cli
version: 0.3.24
@@ -545,7 +557,7 @@ importers:
vitest:
specifier: catalog:testing
webdriverio:
specifier: catalog:testing
version: 9.31.9
@@ -701,7 +713,7 @@ importers:
vitest:
specifier: catalog:testing
packages/dsh-tauri-panel-extension:
dependencies:
@@ -802,7 +814,7 @@ importers:
vitest:
specifier: catalog:testing
packages/dsh-tauri-pet:
dependencies:
@@ -1169,6 +1181,10 @@ packages:
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
engines: {node: '>=6.9.0'}
+ resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-/kr3UWNtdJfxZtPgDqUOmG2pvwlmcLGheex5yiZKdwbzZJxhV+HMNR9QNmyY5cGwTNV6LrR7Jtp+KjhUAP1qBQ==}
engines: {node: '>= 20.12.0'}
@@ -3444,6 +3460,15 @@ packages:
peerDependencies:
vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-8MVGEFnJIcdGjcbfKmeq8z0pZHH0JlVtoVZH9Q/qwUp6wyFnEJUBMrw9DCaj+ra3vShGmhavjalMIhPNxZAUcw==}
+ peerDependencies:
+ '@vitest/browser': 4.1.11
+ vitest: 4.1.11
+ peerDependenciesMeta:
+ '@vitest/browser':
+ optional: true
+
'@vitest/[email protected]':
resolution: {integrity: sha512-X1RCAfwbatG4GFbJ/1PIHP9MSZMt0JJThqbYID+vS4L783k6QGlLPe421wQE8dHXuGCcenVLsydiM4qzsYWxhg==}
engines: {node: '>=18'}
@@ -3664,6 +3689,9 @@ packages:
resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==}
engines: {node: '>=4'}
+ resolution: {integrity: sha512-fvpl29helSO2w/z7utIbrkNXILdrLwDwAMH2I/zPKlGf5244+gf+B4cyS1sANcrPY2h+hWCGSgC8N61s/+AF9A==}
+
resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==}
@@ -4701,6 +4729,9 @@ packages:
resolution: {integrity: sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==}
+ resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
+
resolution: {integrity: sha512-0zHsZJrK7S3K2aucXWL6ycoYJ/iNtIcFHC/nYQgFklPtrv5LpJctIiSCroWZWeuoXvuyFdzp6KzjJQ+OT5MfFw==}
@@ -4845,6 +4876,18 @@ packages:
resolution: {integrity: sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw==}
engines: {node: '>=20'}
+ resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
@@ -4880,6 +4923,9 @@ packages:
resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==}
hasBin: true
+ resolution: {integrity: sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==}
+
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
@@ -5082,10 +5128,17 @@ packages:
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
+ resolution: {integrity: sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==}
+
resolution: {integrity: sha512-ayF7iT+44LXdxJLTrTd3TLQpFDDvPCBxXxbv+pMUSuHA5Q8zyAfwkRP6aHHwNVFBUFWtxAHqwNJxF8vMZLAbVg==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==}
+ engines: {node: '>=10'}
+
resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==}
@@ -5541,6 +5594,16 @@ packages:
resolution: {integrity: sha512-y+ichcgc2LrADuhLNAx8DFjVfgz91pRxfZdI3UDhxHvcVEZsenLO+7XaU5vOp0u/7V/wZ+plyuQxtrDlZJ+yeg==}
+ resolution: {integrity: sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg==}
+ engines: {node: '>=20'}
+ hasBin: true
+
+ resolution: {integrity: sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg==}
+ engines: {node: '>=20'}
+ hasBin: true
+
resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
engines: {node: '>=4'}
@@ -6563,7 +6626,7 @@ snapshots:
'@jridgewell/gen-mapping': 0.3.13
'@jridgewell/trace-mapping': 0.3.31
dependencies:
'@antfu/install-pkg': 2.0.1
'@clack/prompts': 1.7.0
@@ -6573,7 +6636,7 @@ snapshots:
'@stylistic/eslint-plugin': 5.10.0([email protected]([email protected]))
'@typescript-eslint/parser': 8.67.0([email protected]([email protected]))([email protected])
ansis: 4.3.1
cac: 7.0.0
eslint: 10.8.1([email protected])
@@ -6735,6 +6798,8 @@ snapshots:
'@babel/helper-string-parser': 7.29.7
'@babel/helper-validator-identifier': 7.29.7
+ '@bcoe/[email protected]': {}
+
dependencies:
fast-wrap-ansi: 0.2.2
@@ -8833,7 +8898,21 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ '@bcoe/v8-coverage': 1.0.2
+ '@vitest/utils': 4.1.11
+ ast-v8-to-istanbul: 1.0.6
+ istanbul-lib-coverage: 3.2.2
+ istanbul-lib-report: 3.0.1
+ istanbul-reports: 3.2.0
+ magicast: 0.5.5
+ obug: 2.1.4
+ std-env: 4.2.0
+ tinyrainbow: 3.1.1
+
dependencies:
'@typescript-eslint/scope-manager': 8.67.0
'@typescript-eslint/utils': 8.67.0([email protected]([email protected]))([email protected])
@@ -8841,7 +8920,7 @@ snapshots:
optionalDependencies:
typescript: 5.8.3
transitivePeerDependencies:
- supports-color
@@ -9134,6 +9213,12 @@ snapshots:
dependencies:
tslib: 2.8.1
+ dependencies:
+ '@jridgewell/trace-mapping': 0.3.31
+ estree-walker: 3.0.3
+ js-tokens: 10.0.0
+
@@ -10310,6 +10395,8 @@ snapshots:
+
@@ -10426,6 +10513,19 @@ snapshots:
+
+ dependencies:
+ istanbul-lib-coverage: 3.2.2
+ make-dir: 4.0.0
+ supports-color: 7.2.0
+
+ dependencies:
+ html-escaper: 2.0.2
+ istanbul-lib-report: 3.0.1
+
dependencies:
'@isaacs/cliui': 8.0.2
@@ -10481,6 +10581,8 @@ snapshots:
+
@@ -10664,12 +10766,22 @@ snapshots:
dependencies:
'@jridgewell/sourcemap-codec': 1.5.5
+ dependencies:
+ '@babel/parser': 7.29.8
+ '@babel/types': 7.29.8
+ source-map-js: 1.2.1
+
dependencies:
p-event: 6.0.1
type-fest: 4.41.0
web-worker: 1.5.0
+ dependencies:
+ semver: 7.8.5
+
@@ -11345,6 +11457,12 @@ snapshots:
exsolve: 1.1.1
pathe: 2.0.3
+
+ dependencies:
+ playwright-core: 1.63.0
+
@@ -12196,7 +12314,7 @@ snapshots:
tsx: 4.23.12
yaml: 2.9.0
dependencies:
'@vitest/expect': 4.1.11
@@ -12221,6 +12339,7 @@ snapshots:
optionalDependencies:
'@opentelemetry/api': 1.9.1
'@types/node': 22.20.1
+ '@vitest/coverage-v8': 4.1.11([email protected])
transitivePeerDependencies:
- msw
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index f4e79825..972804ba 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -102,7 +102,9 @@ catalogs:
'@tauri-apps/cli': ^2.11.4
'@tauri-apps/plugin-http': ^2.6.0
testing:
+ '@vitest/coverage-v8': ^4.1.11
'@wdio/tauri-service': ^1.4.0
+ playwright: ^1.63.0
vitest: ^4.1.11
webdriverio: ^9.31.9
yaml: ^2.9.0
diff --git a/test/plugin-resource-closure.test.ts b/test/plugin-resource-closure.test.ts
index ae51f92a..e26a8c83 100644
--- a/test/plugin-resource-closure.test.ts
+++ b/test/plugin-resource-closure.test.ts
@@ -10,7 +10,9 @@ const DSH_STATIC_IMPORT = /\b(?:from|import)\s*['"]@deepseek-ai\/[^'"]+['"]|\bre
/**
* 部署产物 `src-tauri/resources/node_modules/` 由 `pnpm build:plugins` 生成,不随仓库提交。
* 未构建时整组用例跳过——否则每次干净检出都会报「文件不存在」,把缺前置误报成缺陷。
- * CI 的 Plugins E2E job 会先构建,因此那一条链路下本组用例照常执行。
+ * 本文件归 `unit` project(由 `vitest.unit.config.ts` 的 `test` 通配收集),
+ * CI 的 Unit Tests job 已加 `pnpm build:plugins` 前置,故门禁上照常执行。
+ * `plugins-e2e` job 只收 `test/e2e/plugins` 下的 `*.e2e.ts`,不会跑到本文件。
*/
const BUILT = existsSync(fileURLToPath(RESOURCE_NODE_MODULES))
diff --git a/vitest.desktop.config.ts b/vitest.desktop.config.ts
index 96a95a74..bfc32198 100644
--- a/vitest.desktop.config.ts
+++ b/vitest.desktop.config.ts
@@ -6,6 +6,10 @@ import { defineProject } from 'vitest/config'
* 用例驱动真实 Debug 二进制:`@wdio/tauri-service` 的 embedded provider 自己拉起应用
* (应用内嵌 W3C WebDriver server),vitest 负责组织用例与断言,不引入 WDIO runner。
*
+ * 驱动架构:`environment: 'node'` + **驱动库 API**(standalone WebdriverIO session)。
+ * 不采用 Vitest browser mode——该模式的 provider 会把 webview 导航到 Vitest 自己的
+ * Vite origin,导致被测应用文档被卸载(见子设计 01 §2 决策 1)。
+ *
* `fileParallelism: false`:应用固定占用 debug 端口 3081,且一次只应有一个实例;
* 串行执行让「端口空闲 / 无残留实例」的前置校验始终成立。
*/
diff --git a/vitest.plugin.config.ts b/vitest.plugin.config.ts
index 4b77f1a7..b2495fda 100644
--- a/vitest.plugin.config.ts
+++ b/vitest.plugin.config.ts
@@ -1,11 +1,16 @@
import { defineProject } from 'vitest/config'
/**
- * `plugin` project:插件 L2 E2E(真实 `dsh web` 进程)。
+ * `plugin` project:插件 L2 E2E(真实 `dsh web` 进程 + 真实 Chromium 页面)。
*
* 用例集中在 `test/e2e/plugins/`,与桌面端 L3 的 `test/e2e/desktop/` 平级;
* 共享编排(`support/dsh-host.ts`)与 `global-setup.ts` 留在 `test/e2e/` 根下。
*
+ * 驱动架构:`environment: 'node'` + **驱动库 API**。真实浏览器直接由用例
+ * `import { chromium } from 'playwright'` 后 `chromium.launch()` 拉起,
+ * 复用 globalSetup 起的宿主与已换取的 Cookie;不采用 Vitest browser mode,
+ * 也不引入 Playwright Test Runner(见 `docs/specs/plugin.test.md` §3.2)。
+ *
* `fileParallelism: false`:整个 project 共享一个真实 dsh 服务实例(由 globalSetup 起),
* 串行执行让断言有意义,也避免多个 spec 同时打同一个服务。
*/