mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 01:50:43 +00:00
test: simplify install package dir scans
This commit is contained in:
@@ -16,14 +16,24 @@ vi.mock("../process/exec.js", async () => {
|
||||
|
||||
async function listMatchingDirs(root: string, prefix: string): Promise<string[]> {
|
||||
const entries = await fs.readdir(root, { withFileTypes: true });
|
||||
return entries
|
||||
.filter((entry) => entry.isDirectory() && entry.name.startsWith(prefix))
|
||||
.map((entry) => entry.name);
|
||||
const names: string[] = [];
|
||||
for (const entry of entries) {
|
||||
if (entry.isDirectory() && entry.name.startsWith(prefix)) {
|
||||
names.push(entry.name);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
async function listMatchingEntries(root: string, prefix: string): Promise<string[]> {
|
||||
const entries = await fs.readdir(root, { withFileTypes: true });
|
||||
return entries.filter((entry) => entry.name.startsWith(prefix)).map((entry) => entry.name);
|
||||
const names: string[] = [];
|
||||
for (const entry of entries) {
|
||||
if (entry.name.startsWith(prefix)) {
|
||||
names.push(entry.name);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
function normalizeDarwinTmpPath(filePath: string): string {
|
||||
|
||||
Reference in New Issue
Block a user