From fca6a71446ad986200bb4a55b8dc049d1323e977 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 5 Aug 2026 19:36:11 +0000 Subject: [PATCH] =?UTF-8?q?fix(client):=20=E9=9B=86=E6=88=90=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=9A=84=E4=B8=B2=E8=A1=8C=E5=A3=B0=E6=98=8E=E6=94=B9?= =?UTF-8?q?=E7=94=A8=20Vitest=204=20=E7=9A=84=20`fileParallelism`,?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=98=AF=E5=A4=B1=E6=95=88=E7=9A=84=20`poolO?= =?UTF-8?q?ptions`=20(#5564)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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 Claude-Session: https://claude.ai/code/session_016FNvXhtSdnEGEfLEsMmvxh --- packages/client/vitest.integration.config.ts | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/client/vitest.integration.config.ts b/packages/client/vitest.integration.config.ts index a7a22522e1..1d03d78df6 100644 --- a/packages/client/vitest.integration.config.ts +++ b/packages/client/vitest.integration.config.ts @@ -7,12 +7,24 @@ export default defineConfig({ environment: 'node', testTimeout: 30000, // 30 seconds for integration tests hookTimeout: 30000, - // Run integration tests sequentially to avoid race conditions pool: 'forks', - poolOptions: { - forks: { - singleFork: true - } - } + // Run integration test files one at a time: they all drive the SAME live + // server and the same test data, so running files in parallel races. + // + // Vitest 4 removed `test.poolOptions` ("Pool Rework" in the migration + // guide) — the `poolOptions.forks.singleFork: true` that used to live here + // was never read, it only produced a DEPRECATED warning, so this suite has + // been running with the default parallelism all along (#5564). + // + // `fileParallelism: false` is the top-level option that actually enforces + // it: per the docs it "will override `maxWorkers` option to 1", which is + // the parallelism half of what the guide maps `singleFork` to. + // + // The guide's other half — `isolate: false` — is deliberately NOT carried + // over: it was equally inert here, nothing in this suite depends on + // sharing a module registry across files, and turning it off would let + // module state leak between files, which is the very class of cross-file + // interference this declaration exists to prevent. + fileParallelism: false } });