test: harden sparse Testbox scans · openclaw/openclaw@3df6499
vincentkoc
·
2026-05-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -37,6 +37,7 @@ function listGitSourceFiles(dir: string): string[] | null {
|
37 | 37 | } |
38 | 38 | return files |
39 | 39 | .map((file) => path.join(REPO_ROOT, file)) |
| 40 | +.filter((filePath) => fs.existsSync(filePath)) |
40 | 41 | .filter(isOwnedSourceFile) |
41 | 42 | .toSorted(); |
42 | 43 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,6 +34,7 @@ function listGitSourceFiles(repoPath: string): string[] | null {
|
34 | 34 | } |
35 | 35 | return files |
36 | 36 | .map((filePath) => path.join(REPO_ROOT, filePath)) |
| 37 | +.filter((filePath) => fs.existsSync(filePath)) |
37 | 38 | .filter(isSourceFile) |
38 | 39 | .toSorted(); |
39 | 40 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -183,6 +183,7 @@ function listGitTrackedTsFiles(rootRelativePath: string, filter: FileFilter): st
|
183 | 183 | .filter((line) => line.endsWith(".ts")) |
184 | 184 | .filter((line) => !(filter.excludeTests && line.endsWith(".test.ts"))) |
185 | 185 | .filter((line) => !(filter.testOnly && !line.endsWith(".test.ts"))) |
| 186 | +.filter((line) => fs.existsSync(resolve(REPO_ROOT, line))) |
186 | 187 | .toSorted(); |
187 | 188 | } |
188 | 189 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -37,6 +37,7 @@ function listTrackedSourceFiles(dir: string): string[] | null {
|
37 | 37 | return files |
38 | 38 | .filter((line) => line.length > 0 && line.endsWith(".ts") && !line.includes("/plugin-sdk/")) |
39 | 39 | .map((line) => path.join(repoRoot, ...line.split("/"))) |
| 40 | +.filter((filePath) => fs.existsSync(filePath)) |
40 | 41 | .toSorted(); |
41 | 42 | } |
42 | 43 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -89,6 +89,7 @@ function listTrackedCodeFiles(relativeDir: string): string[] | null {
|
89 | 89 | } |
90 | 90 | const files = trackedFiles |
91 | 91 | .filter((line) => line.length > 0 && /\.(?:[cm]?ts|tsx|mts|cts)$/u.test(line)) |
| 92 | +.filter((line) => fs.existsSync(resolve(REPO_ROOT, line))) |
92 | 93 | .toSorted(); |
93 | 94 | trackedCodeFilesByRoot.set(relativeDir, files); |
94 | 95 | return [...files]; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -94,6 +94,7 @@ function listTrackedFiles(root: string): string[] | null {
|
94 | 94 | const files = trackedFiles |
95 | 95 | .filter((line) => line.length > 0 && !isSkippedTrackedPath(line)) |
96 | 96 | .map((line) => resolve(REPO_ROOT, line)) |
| 97 | +.filter((filePath) => fs.existsSync(filePath)) |
97 | 98 | .toSorted(); |
98 | 99 | trackedFilesByRoot.set(relativeRoot, files); |
99 | 100 | return [...files]; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -342,6 +342,7 @@ function listTrackedRepoTsFiles(dir: string): string[] | null {
|
342 | 342 | line.endsWith(".ts") && !line.includes("/dist/") && !line.includes("/node_modules/"), |
343 | 343 | ) |
344 | 344 | .map((line) => resolve(REPO_ROOT, ...line.split("/"))) |
| 345 | +.filter((filePath) => fs.existsSync(filePath)) |
345 | 346 | .toSorted(); |
346 | 347 | } |
347 | 348 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -58,6 +58,7 @@ function listGitFiles(dir: string): string[] | null {
|
58 | 58 | return files |
59 | 59 | .filter((line) => !isSkippedRepoPath(line)) |
60 | 60 | .map((line) => path.join(process.cwd(), ...line.split("/"))) |
| 61 | +.filter((filePath) => fs.existsSync(filePath)) |
61 | 62 | .toSorted(); |
62 | 63 | } |
63 | 64 | |
@@ -73,6 +74,7 @@ function listGitPluginManifestPaths(extensionsDir: string): string[] | null {
|
73 | 74 | return files |
74 | 75 | .filter((line) => /^extensions\/[^/]+\/openclaw\.plugin\.json$/u.test(line)) |
75 | 76 | .map((line) => path.join(process.cwd(), ...line.split("/"))) |
| 77 | +.filter((filePath) => fs.existsSync(filePath)) |
76 | 78 | .toSorted(); |
77 | 79 | } |
78 | 80 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,6 +34,7 @@ function listGitProductionSourceFiles(root: string): string[] | null {
|
34 | 34 | return files |
35 | 35 | .filter(isProductionSourcePath) |
36 | 36 | .map((line) => path.join(repoRoot, ...line.split("/"))) |
| 37 | +.filter((filePath) => fs.existsSync(filePath)) |
37 | 38 | .toSorted(); |
38 | 39 | } |
39 | 40 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -67,6 +67,7 @@ function listGitFiles(dir: string): string[] | null {
|
67 | 67 | return files |
68 | 68 | .filter((line) => !shouldSkipScannedPath(line)) |
69 | 69 | .map((line) => resolve(REPO_ROOT, line)) |
| 70 | +.filter((filePath) => fs.existsSync(filePath)) |
70 | 71 | .toSorted(); |
71 | 72 | } |
72 | 73 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。