docs: 入门文档改教仓根跑法,不再推荐会假绿的 pnpm --filter PKG test - #3443
Merged
Conversation
QUICK_REFERENCE.md 和 skills/objectui/guides/project-setup.md 两处入门文档, 把 #3378 那条会静默假绿的调用当推荐用法写着。按该机制,vitest 的 root 落在包 目录,根级 unit/dom/dom-heavy 三个 project 的 include 相对它匹配不到任何文件, 只有以绝对路径引入的 apps/console project 仍解析成功 —— 跑的是 console 的 22 个文件、报绿,注释声称的那个包一个都没跑。 PR #3437 合并后 vitest.config.mts 的 invocation guard 会让这些命令直接非零退出, 所以文档教的命令现在不只是误导,而是根本跑不通。三处全部换成仓根跑法,并把 guard 实际打印的正确跑法摘录进来,便于读者在别处撞见该错误框时认得出。 - QUICK_REFERENCE.md: --filter console test / --filter core test 两行 → pnpm exec vitest run packages/core/ | apps/console/ | packages/core/src/<file>.test.ts - project-setup.md: --filter core test 一行 → 同上(单独拆出 Scoped tests 段, 因为它和同块的 --filter build / --filter dev 不同,不能用 --filter 表达) 单文件示例一律写成 <file> 占位符:guard 的 missing-path-filter 分支会拒绝指向 不存在文件的具体路径,写个看似真实的 x.test.ts 反而会被拒。 content/docs/guide/plugin-development.md:422 本就是正确形状,未改动。 与 #3240(包级 test 脚本存废)无关 —— 无论存废,文档都该教仓根跑法。 Fixes #3442 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
yinlianghui
marked this pull request as ready for review
August 6, 2026 04:53
This was referenced Aug 6, 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.
Fixes #3442
两处面向人和 agent 的入门文档,把 #3378 那条会静默假绿的调用当推荐用法写着。本 PR 把它们换成仓根跑法。
为什么必须改
按 #3378 的机制,
pnpm --filter PKG test让 vitest 的 root 落在包目录:根级unit/dom/dom-heavy三个 project 的 include(packages/**等)相对它匹配不到任何文件,只有以绝对路径引入的apps/consoleproject 仍解析成功。于是跑的是 console 的 22 个文件、报Test Files 22 passed (22),注释里声称的那个包一个都没跑,而且没有任何 "0 tests matched" 信号。PR #3437 合并后,
vitest.config.mts的 invocation guard 会让这些命令直接非零退出。所以文档教的命令现在已不只是误导,而是根本跑不通 —— 照抄的读者会撞上一个他们没被告知过的错误框。改了什么(共 3 处,全仓 sweep 后确认无遗漏)
QUICK_REFERENCE.md:26pnpm --filter @object-ui/console testpnpm exec vitest run apps/console/QUICK_REFERENCE.md:27pnpm --filter @object-ui/core testpnpm exec vitest run packages/core/skills/objectui/guides/project-setup.md:309pnpm --filter @object-ui/core testpnpm exec vitest run packages/core/两个文件都补上了 guard 实际打印内容的摘录,便于读者在别处撞见那个错误框时认得出;并说明
turbo run test、cd packages/x && pnpm exec vitest、以及把路径挂在--后面(#3288)同属被拒之列。两处细节:
x.test.ts这种看似真实的路径 —— guard 的missing-path-filter分支会拒绝指向不存在文件的具体路径,写个假的具体路径反而会让照抄的人被拒。--filter PKG build/--filter "apps/*" dev仍然正确,只有 test 不能用--filter表达,混在一起会让读者以为是同一族写法。验证
三条新写进文档的命令都在仓根实跑过,确认收集到的确实是目标包的文件:
vitest list packages/core/ --filesOnly收集到 64 个文件,全部在packages/core/下,无一例外(旧写法收集的是 console 的 22 个)。vitest list apps/console/ --filesOnly收集 22 个,全部在apps/console/下。单文件形式pnpm exec vitest run packages/core/src/utils/managedBy.test.ts收集 1 个文件、26 个用例通过。反向确认 —— 旧文档教的那条命令现在确实被拒(退出码 1,非 0):
其他:
pnpm check:control-bytes通过(扫描 3640 个文本文件);两个文件grep -naP自查无控制字节;markdown fence 配平已核。content/docs/guide/plugin-development.md:422本就是正确形状,按 issue 要求未改动。范围说明
AGENTS.md已由 fix(test): 拒绝两种静默假绿的 vitest 调用,并把正确跑法写进 AGENTS.md #3437 更新,本 PR 未碰。顺带发现(均已有 issue,未新开重复单):
pnpm docs:check-links在本分支报一个断链content/docs/core/enhanced-actions.mdx -> /docs/components/form,经核对在origin/main上即已存在(该文件本 PR 未触碰),已分别记录在 #3292(断链本身)和 #3213(没有工作流跑这个检查器)。Generated by Claude Code