fix(test-runner): skip git-ignored and unreadable directories in readAllFiles - #3356
Open
Battleplus wants to merge 2 commits into
Open
fix(test-runner): skip git-ignored and unreadable directories in readAllFiles#3356Battleplus wants to merge 2 commits into
Battleplus wants to merge 2 commits into
Conversation
…AllFiles Two issues with readAllFiles(): 1. It doesn't include "tmp" in IGNORED_PARTS, so it scans the git-ignored tmp/ directory. On Windows, tmp/ may contain unreadable subdirectories created by other processes, causing EPERM failures in the test gate. 2. fs.readdirSync() throws on unreadable directories (EPERM on Windows), crashing the entire test runner before any tests run. Fix: add "tmp" to IGNORED_PARTS, and wrap readdirSync in try-catch to gracefully skip unreadable directories. Fixes makecindy#3353. Signed-off-by: Battleplus <3559424769@qq.com>
|
| Filename | Overview |
|---|---|
| scripts/test-workspaces.mjs | 文件遍历现在忽略 tmp 目录,并将不可读目录的容错范围限制为权限错误;此前线程指出的错误被无条件吞掉问题已修复。 |
Reviews (2): Last reviewed commit: "fix(test-runner): restrict readAllFiles ..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46ad0c9e52
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…S only The unconditional catch in readAllFiles() swallowed all errors, including real I/O errors like EIO and ENOTDIR. Restrict the catch to only EPERM and EACCES (permission denied), and re-throw other errors so real filesystem issues propagate correctly. Addresses P1 and P2 review feedback on makecindy#3356. Signed-off-by: Battleplus <3559424769@qq.com>
Contributor
|
@Battleplus 👋 这个 PR 目前与 请在本地 merge 最新的 |
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.
这次改了什么
摘要
修复测试运行器
readAllFiles()的两个问题:未忽略 git-ignored 目录:
IGNORED_PARTS缺少"tmp",导致readAllFiles扫描被.gitignore忽略的tmp/目录。Windows 上tmp/可能包含其他进程创建的不可读子目录,导致 EPERM 错误使测试门禁失败。不可读目录导致崩溃:
fs.readdirSync()遇到不可读目录时直接抛错,整个测试运行器崩溃,无法执行任何测试。变更类型
范围
scripts/test-workspaces.mjs:在IGNORED_PARTS中添加"tmp"scripts/test-workspaces.mjs:在readAllFiles中用 try-catch 包裹readdirSync,跳过不可读目录.gitignore解析(更彻底但改动更大)怎么验证的
pnpm test:runner,确认不再因tmp/目录 EPERM 失败tmp/test/目录并设置权限限制,确认测试运行器不会崩溃readAllFiles仍能正确发现所有非忽略的源码和测试文件风险