Repository navigation
test(services): 包内 test 脚本对齐 vitest,修复整包测试无法运行 - #56
Merged
SudoUserReal merged 3 commits intoOct 18, 2026
Merged
SudoUserReal merged 3 commits into
SudoUserReal merged 3 commits into
Conversation
Collaborator
Author
|
说明一下两个检查的状态,供排查参考:
|
Contributor
本地验证发现:脚本形态会让部分测试因 cwd 失败在 `verify/pr56` 上把 main(3a71ce0c)合入后从包目录执行新脚本: 失败点都是路径重复(`packages/services/packages/services/...`):
原因:`vitest run --root ../..` 只改 vitest 的 root,Node 进程 cwd 仍是 `packages/services`;这两个测试用 `process.cwd()` / 裸相对路径定位仓库内文件。 对照验证(同一 head): (另外包内跑时 `atomicFileUtils.test.ts > preserves permission errors...` 也失败过一次,单独重跑通过,疑似并发 flaky,建议确认。) 建议修法(二选一)
当前形态虽然让 203 个 vitest 测试能启动,但整包仍非全绿,暂不合并。 |
--root ../.. 只改 vitest 的 root,Node 进程 cwd 仍是 packages/services: agentProxyEnv 的源码断言(process.cwd() 拼 packages/services/src/node.ts)与 tasksDatabaseMigration 的 esbuild entryPoints/alias(裸相对路径)在包内运行时 解析失败(维护者 PR ZCodium-project#56 本地验证发现)。改为 fileURLToPath(new URL("../../..", import.meta.url)) 从测试文件自身定位仓库根,包内/根目录两种运行方式等价。
yachen4ever
force-pushed
the
fix/services-vitest-test-script
branch
from
October 18, 2026 09:26
5b2cd0b to
d220daf
Compare
Collaborator
Author
|
已按你推荐的方案 2 修复并重推(分支重建到当前 main 9cd5e0e,含已合并的 #57/#58/#40):
顺带:上游 main 当前 |
yachen4ever
added a commit
to yachen4ever/ZCodium
that referenced
this pull request
Oct 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #53
改动(1 文件,+1/−1)
packages/services/package.json的 test 脚本从tsx --test test/*.test.ts test/*.test.mjs改为:为什么是这个形态
packages/services/test/205 个测试文件中 203 个import ... from "vitest",node:test 运行器下启动即崩(Vitest failed to find the runner),整包测试事实上不可运行。vitest run,packages/model-option-map用vitest run --root ../.. <路径>锚定根配置 + 路径过滤。services 的部分测试文件归属根配置的fork-isolated项目(进程隔离运行),必须经根配置解析,所以采用后一种形态。验证
pnpm --filter @zcode/services test:2093 通过 / 25 跳过(Windows 11 / node 24.14.0 / pnpm 10.33.2)。