vitest 排除 .tmp,消除本地测试假红 - #60
Open
chenmohan123 wants to merge 1 commit into
Open
chenmohan123 wants to merge 1 commit into
chenmohan123 wants to merge 1 commit into
Conversation
.tmp 下存着 4 份仓库整树历史快照(archive、ppyoloe-release-audit、 detection-standard-sod-final、detection-compatibility-before),共 415 个 测试文件被默认 include 收进来:本地 pnpm test 收集 155 个文件、报 11 个失败, 而真实源码树只有 13 个文件。失败原因是同一 jsdom 里重复注册角色, 报 "Found multiple elements with the role ...",与被测代码无关。 排除 .tmp 后本地为 13 files / 136 tests 全绿,与 CI 的 13 files 完全一致 (CI 环境没有 .tmp),即本改动只去噪、不降低覆盖面。
This branch has not been deployed
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.
问题
.tmp/(已 gitignore)下存着 4 份仓库整树历史快照:archive/tinypose-media-portal-2026-09-18/worktree-remainder、ppyoloe-release-audit、detection-standard-sod-final、detection-compatibility-before,合计 415 个测试文件。vitest.config.ts的exclude盖了node_modules、.worktrees、.pnpm-store,唯独没盖.tmp,于是pnpm test把它们一并收集。后果:本地
pnpm test收集 155 个文件、报 11 个失败(Found multiple elements with the role "searchbox"等),而真实源码树只有 13 个文件。任何人本地跑一次都会误判自己改坏了。变更
exclude增加'**/.tmp/**'(1 行配置 + 2 行原因注释)。验证(同口径 A/B)
pnpm test.tmp).tmp下pnpm testpnpm test(main,run36250207135)改后文件数与 CI 完全一致,说明只去噪、不降低覆盖面(CI 环境本就没有
.tmp)。git diff --check干净。边界
不改生产代码、registry 记录、
standards/v1与 CI 配置。.tmp目录本身不动,是否清理另行决定。