On Windows, `report.test.ts`'s unwritable-folder case creates `\dev\null\nope` at the drive root instead of meeting an unwritable folder
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 83/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
- 领域
- testing
调研方向
阅读 packages/jest/src/diagnostics/__tests__/report.test.ts 中 “never throws when the directory cannot be written” 测试用例附近的内容,以及 packages/jest/src/diagnostics/report.ts 中递归调用 fs.mkdir 附近的内容。issue 建议使用测试临时文件夹中的一个文件作为 projectRoot;在 Windows 上运行针对性的 Vitest 用例,并确认它仍然通过,且不会在驱动器根目录创建任何内容。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
never throws when the directory cannot be written hands the diagnostics appender projectRoot: '/dev/null/nope' (report.test.ts), a folder no write reaches on Linux and macOS, where /dev/null is a device. On Windows Node resolves it against the root of the drive the run is on, and the appender's fs.mkdir(dir, { recursive: true }) (report.ts) creates it. So the case passes without meeting an unwritable folder, and leaves \dev\null\nope\.harness\diagnostics\unwritable.jsonl behind, holding the marks a and b.
While that folder exists, Windows programs that open /dev/null as a path from that drive open the folder instead: Git for Windows' git diff --no-index /dev/null <file> fails with error: Could not access '/dev/null/<file>'.
A projectRoot below a regular file fails the same way on every platform (ENOTDIR), so a file the test writes in its temporary folder would keep the case's premise on Windows too.
System Info
System:
OS: Windows 11 10.0.26300
Binaries:
Node: 26.12.1
pnpm: 10.6.1
React Native Harness Version
main at 26b67ea4
Reproduction
Steps to reproduce
- On Windows, in a checkout of
main:pnpm install, thenpnpm vitest run packages/jest/src/diagnostics/__tests__/report.test.ts -t "never throws when the directory cannot be written". - The case passes:
Tests 1 passed | 26 skipped (27). dir /s /b \devon the drive the run is on lists what it made. I ran it from a drive mapped withsubst,X:, so the folder landed there:
X:\dev\null
X:\dev\null\nope
X:\dev\null\nope\.harness
X:\dev\null\nope\.harness\diagnostics
X:\dev\null\nope\.harness\diagnostics\unwritable.jsonl
unwritable.jsonl:
{"label":"a","startTime":1793230779050.4949,"duration":0,"status":"ok","kind":"mark"}
{"label":"b","startTime":1793230779052.054,"duration":0,"status":"ok","kind":"mark"}
Expected: the case meets a folder it cannot write, as on Linux and macOS, and leaves nothing outside its temporary folder.
Actual: the case passes after creating the folders above at the root of the drive the run is on, with the two marks in unwritable.jsonl.
- 主要语言
- TypeScript
- 星标
- 340
- 派生
- 23
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 54
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstackincubator/react-native-harness 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
callstackincubator/react-native-harness#296 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
callstackincubator/react-native-harness#128 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 58/100
callstackincubator/react-native-harness#303 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 52/100
callstackincubator/react-native-harness#300 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
callstackincubator/react-native-harness#299 ·
维护者通常 1 天内回复
查看 callstackincubator/react-native-harness 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
enhancement tech debt
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
privatenumber/tsx#866 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
danielmiessler/LifeOS#2533 ·
维护者通常 9 天内回复
-
auto:producer auto:uiux
难度 2/5 1-3 小时 新手友好度 78/100
fritzprix/libr-agent#2447 ·
维护者通常 1 天内回复