Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: Every test run leaves a temp folder behind (vitest 5.0.1 via vite-plus 1.0.0)

未关闭 适合新手
#20,128 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
nodejs, typescript

调研方向

修复方法是提升 pnpm catalog 中 vite-plus 和 vite(@voidzero-dev/vite-plus-core)条目的版本号,issue 中说它们被固定在 1.0.0。将 TMPDIR 设置为一个空目录,在 packages/contracts 中运行 pnpm run test,然后用 ls -A 检查是否还残留 <id>/ssr 文件夹。测试仍然通过且只剩下 node-compile-cache 时即完成。

由索引模型根据 Issue 内容生成。

描述

bug via-triage
Before submitting
  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.
Area

Build, CI, or release tooling

Steps to reproduce

On a clean checkout of main:

pnpm install
T=$(mktemp -d)
cd packages/contracts && TMPDIR=$T pnpm run test
ls -A "$T"
Expected behavior

A finished test run leaves nothing behind in the temp dir. The exception is node-compile-cache, which is reused across runs.

Actual behavior

Every run leaves a <tmpdir>/<21-char id>/ssr/ folder of transformed module copies, even when every test passes. For packages/contracts that's 109 files and 4.4 MB. apps/server runs leave up to ~34 MB each.

Cause: the catalog pins vite-plus 1.0.0, which pins vitest 5.0.1. In Vitest 5.0.0–5.0.2, Vitest.close() never removes the root _tmpDir that holds the forks pool's module copies. Vitest fixed this in 5.0.3: "Remove root temp dir on close" (vitest-dev/vitest#11248). vite-plus 1.1.0 ships vitest 5.0.3, and 1.2.0 ships 5.0.4.

Agents run tests in worktrees all day, so the folders pile up. On one machine, 411 of them (11.8 GB, uncompressed) came from t3code worktrees in under 3 days.

Suggested fix: bump the vite-plus and vite (@voidzero-dev/vite-plus-core) catalog entries to 1.2.0. I made the same bump in another repo on vite-plus 1.0.0: its 710 tests still passed and the run left no folder behind.

Impact

Minor bug or occasional failure

Version or commit

main @ e74f477eed

Environment

CachyOS Linux (kernel 7.2.10), Node 26.11.1, pnpm 11.10.0, vite-plus 1.0.0, vitest 5.0.1

Logs or stack traces
$ cd packages/contracts && TMPDIR=$T pnpm run test
 RUN  v5.0.1 …/packages/contracts
 Test Files  39 passed (39)
      Tests  667 passed (667)
$ ls -A "$T"
NEcLqKcMrzjuO4WeCz9m7
node-compile-cache
$ ls "$T/NEcLqKcMrzjuO4WeCz9m7"
ssr
$ ls "$T/NEcLqKcMrzjuO4WeCz9m7/ssr" | wc -l
109
Workaround

Delete stale <id>/ssr folders from the temp dir by hand, or override vitest to 5.0.3 or later.

主要语言
TypeScript
星标
24.8k
派生
6.4k
平均合并
6 小时 53 分钟
30 天内合并 PR
222

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pingdotgg/t3code 的其他 Issue

查看 pingdotgg/t3code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。