fix(client): 集成测试的串行声明改用 Vitest 4 的 fileParallelism,不再是失效的 poolOptions (#5564) - #5578
Merged
Merged
Conversation
…ions` (#5564) `packages/client/vitest.integration.config.ts` 里的 `poolOptions.forks.singleFork` 在 Vitest 4 已随「Pool Rework」整体移除,vitest 只打一条 DEPRECATED 警告后忽略它 —— 注释声明的「串行执行以避免竞态」从未生效,该套件一直按默认并行度收集。 照 Vitest 4 迁移指南把声明提到顶层:`fileParallelism: false`(文档:该值会把 `maxWorkers` 覆写为 1)。迁移指南把 `singleFork` 映射为 `maxWorkers: 1, isolate: false`,其中 `isolate: false` 一半刻意不迁移 —— 它同样从未 生效,本套件不依赖跨文件共享模块注册表,关掉隔离反而会让模块状态在文件间泄漏, 正是这条串行声明要防的同一类干扰。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016FNvXhtSdnEGEfLEsMmvxh
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 14 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
baozhoutao
marked this pull request as ready for review
August 5, 2026 19:38
baozhoutao
enabled auto-merge
August 5, 2026 19:38
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.
Fixes #5564
前提复核(先证后改)
最新 main(
c11369013)上复现,警告仍在,前提成立:vitest 实际版本
4.1.10。依文档核实(不照猜)
Vitest 4 迁移指南
docs/guide/migration.md@ tagv4.1.10,「Pool Rework」一节原文:singleThreadandsingleForkare nowmaxWorkers: 1, isolate: false.poolOptionsis removed. All previouspoolOptionsare now top-level options.docs/config/fileparallelism.md@v4.1.10:booleanDefault:true—— Should all test files run in parallel. Setting this tofalsewill overridemaxWorkersoption to1.改法与一处刻意偏离
pool: 'forks'保留,poolOptions整块换成顶层fileParallelism: false。迁移指南给
singleFork的等价物有两半,这里只迁并行度那一半,isolate: false刻意不带:singleFork一样从来没生效过 —— 旧写法整块被忽略,所以没有任何现存行为依赖「跨文件共享模块注册表」;isolate与之无关;理由写在文件注释里,连同 #5564 编号,免得下一位读者以为迁移漏了一半。
验收证据
1. 警告消失,4 个用例仍被收集
无 DEPRECATED 行。
2. 串行声明实际生效 —— resolve 后的实际值
用
createVitest解析该 config,打印 project 的 resolved config(本机os.availableParallelism() === 4):poolforksforksfileParallelismundefined(即默认true,并行)falsemaxWorkersundefined1isolatetruetruepoolOptions{ forks: { singleFork: true } }原样留着当惰性数据修后
maxWorkers解析成1,正是文档说的「overridemaxWorkersto 1」,串行是 resolve 后的实际值而不是注释。3. 反向验证(方向先判后跑)
预判:还原旧写法后 DEPRECATED 警告回来,且 resolved config 里
fileParallelism/maxWorkers根本不出现(证明旧写法一次都没串行过)。实跑两条都命中 —— 见上表「修前」列;旧写法下poolOptions原封不动躺在 resolved config 里,vitest 不读它。4. 常规通道不受影响
集成套件本体需要外部活服务器,按分诊约定不真跑。
changeset
请 PM 打
skip-changeset标签:本 PR 只动一个测试运行器 config 与其注释,不改任何发布产物、公共 API 或用户可见行为 —— 与 #5546 / #5565 同类,走 skip-changeset 路径。边界
只动
packages/client/vitest.integration.config.ts。tests/integration/README.md的 17 缺 16 规划表缺口按分诊划界不在本单,未动;tsconfig.test.json/vitest.config.ts/ 任何测试文件均未动。Generated by Claude Code