e2e setup() leaves its random .nuxt/test/<id> build directory behind after every run
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, nuxt, typescript
- 领域
- testing
调研方向
The issue points to loadFixture in the generated dist/e2e-*.mjs and shows the cleanup registration condition. Trace this code to its source and check how loadNuxt() creates the build directory and how teardown runs. Reproduce with the provided Vitest e2e test; done when the test-created random build directory is removed after the test finishes.
由索引模型根据 Issue 内容生成。
描述
Environment
@nuxt/test-utils4.1.0,nuxt4.5.2, Node 22.21.1, macOS
What happens
Every run of an e2e test that uses setup({ server: true }) (build mode, no buildDir option) leaves its random build directory, .nuxt/test/<randomId> (about 23 MB for our app), behind after the run finishes. They pile up, one per run.
Why
In loadFixture (dist/e2e-*.mjs), the teardown that removes the build directory is only registered when the directory does not exist after loadNuxt():
ctx.nuxt = await loadNuxt({ ... overrides: ctx.options.nuxtConfig ... })
const buildDir = ctx.nuxt.options.buildDir
if (!existsSync(buildDir)) {
await promises.mkdir(buildDir, { recursive: true })
ctx.teardown = ctx.teardown || []
ctx.teardown.push(() => promises.rm(buildDir, { recursive: true, force: true }))
}
On our app loadNuxt() has already created the directory by that point, so the cleanup is never registered.
Steps to reproduce
- In a Nuxt 4 app, add a test:
// @vitest-environment node import { expect, it } from "vitest"; import { fetch, setup } from "@nuxt/test-utils/e2e"; await setup({ server: true, browser: false }); it("serves /", async () => { expect((await fetch("/")).status).toBe(200); }); - Run it with
npx vitest run <file>; it passes. ls .nuxt/testshows a<randomId>directory left behind. Each further run adds another.
Expected
The build directory created for the test is removed when the test finishes.
- 主要语言
- TypeScript
- 星标
- 445
- 派生
- 121
- 平均合并
- 3 天 11 小时
- 30 天内合并 PR
- 23
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nuxt/test-utils 的其他 Issue
-
nuxt environment: `fetch(new Request(url))` fails with `Failed to parse URL from [object Request]`可能已有人在做 @yamachi4416 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
nuxt/test-utils#1891 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
nuxt/test-utils#1883 ·
维护者通常 2 天内回复
-
pending triage
难度 3/5 1-2 天 新手友好度 55/100
nuxt/test-utils#1671 · 5 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
pending triage
难度 4/5 3-5 天 新手友好度 52/100
nuxt/test-utils#1607 · 2 条评论 ·
维护者通常 2 天内回复
-
`@vitest-environment-options` is not working可能已有人在做 @yamachi4416 于 210 天前认领。 未关闭pending triage
难度 3/5 1-2 天 新手友好度 45/100
nuxt/test-utils#1541 · 2 个 reaction ·
维护者通常 2 天内回复
相似的 Issue
-
approved check:passed streams:remove
难度 1/5 1 小时以内 新手友好度 62/100
维护者通常 1 天内回复
-
Monthly Not a priority
难度 2/5 1-3 小时 新手友好度 66/100
Expensify/App#107229 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
GitTools/actions#2297 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 88/100
hiero-ledger/hiero-sdk-js#4793 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
microsoft/vscode-cosmosdb#3594 · 1 条评论 ·
维护者通常 1 天内回复