Repository navigation
fix(shared): count Vitest type-test files as tests in diffs - #46808
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Recognizes Vitest type-test filenames as tests in diff summaries and existing test-file filtering and folding. The change is limited to presentation and classification, with no change to product defaults or diagnostic suppression. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
EvidenceEnvironment: real web dev app, Chromium, 1280×800, light theme, fresh isolated databases and identical synthetic repository on each side; Replay (dev), default model. On both commits, created a fresh synthetic git project with committed format.ts, format.d.ts and README.md; modified the code (+1), declaration (+1/-1), and Markdown (+1), and added format.test-d.ts (+5), format.spec-d.ts (+6), and format.test.ts (+3), all under src outside test directories. Seeded a Replay thread, opened it, opened the right-panel working-tree Diff, verified all six files were listed with none selected, and enabled Hide test files. The ordinary test disappeared on both sides; both type tests stayed visible on base and disappeared on head. Code, declaration and Markdown controls remained visible. Scenario: Hide Tests hides Vitest type tests outside test directoriesProven: the scenario fails on base 89ba000739 and passes on head 23ad3077a6.
Not shown:
|
…ime/mobile/desktop fixes) Ported 17 commits from 772e3d4..1e6e7d7: - f44640c (pingdotgg#46524), 65dc8c2 (pingdotgg#46550), a1181e8 (pingdotgg#46563), 99d0fc3 (pingdotgg#46619) - 4eac693 (pingdotgg#46618), 0192cf0 (pingdotgg#46889), 8eac85d (pingdotgg#46692), e5528df (pingdotgg#46723) - 39bc9cf (pingdotgg#46754), ba31532 (pingdotgg#46763), 41a1079 (pingdotgg#46808), ae3de2b (pingdotgg#46814) - fc6ba3d (pingdotgg#46882), 364693b (pingdotgg#46923), 6adb78e (pingdotgg#46933) - 75d3e79 (pingdotgg#46671 Android thread search) - 909eeee (pingdotgg#47131 desktop managed update mirrors release notes, Lock pingdotgg#10 preserved)





Problem
Vitest type-test files (
*.test-d.ts,*.spec-d.ts) are classified as product code, so they stay visible under Hide Tests in the web working-tree/PR diff panels and the mobile PR diff, and their additions and deletions are counted as code in PR change breakdowns.TEST_NAMEinpackages/shared/src/changedFileKind.tsmatches.test./.spec.but not Vitest's-dtype-test suffix.Deterministic repro on
origin/main(3763606d20cd834ebfb419ef1525695b397af793): frompackages/shared, importsrc/changedFileKind.tsand callisTestChangedFileonsrc/format.test-d.ts,src/format.spec-d.tsandsrc/format.d.ts, thensummarizeChangedFiles([{ path: "src/format.test-d.ts", additions: 8, deletions: 2 }]). In the app,DiffPaneland the mobile PR diff filter callisTestChangedFilefor every unselected file when Hide Tests is on, and the server PR change breakdown callssummarizeChangedFiles.false, and the breakdown puts+8/-2incodewith0/0intests.+8/-2intests). The plain declaration filesrc/format.d.tsstays code.Change
Recognize Vitest's
*.test-d.*and*.spec-d.*names in the shared classifier, limited to the script extensions Vitest type-checks (.ts,.tsx,.js,.jsx, and theirc/mvariants). A plain.d.tsstays code and a document such asdocs/api.spec-d.mdstays docs. Every surface (web working-tree and PR diff filters, mobile PR diff filter, PR change breakdowns) uses this classifier, so this one change covers all of them.Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
packages/shared/src/changedFileKind.test.ts:src/format.test-d.tsandsrc/format.spec-d.tsare tests,src/format.d.tsis code, and the Markdown controldocs/api.spec-d.mdis docs.src/format.test-d.tsandsrc/format.spec-d.ts: expected"tests", received"code") and 34 pass. On head072dce92778, all 36 pass.vp run check:changedsummary for head072dce92778(format, lint, knip, typecheck, tests) are here: https://gist.github.com/saphid/4a5d75c3e9a16580c8f31ce65649c489Not shown: I did not run an app scenario or capture before/after screenshots of the rendered Hide Tests toggle in web or mobile. The evidence covers the shared classifier those filters call, not the rendered interaction.
Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).
Not shown