mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 16:14:44 +00:00
fix(test): avoid scanning bundled build entries
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
@@ -74,6 +75,48 @@ describe("bundled plugin build entries", () => {
|
||||
expect(entries["extensions/telegram/telegram-ingress-worker.runtime"]).toBeUndefined();
|
||||
});
|
||||
|
||||
it("discovers repo plugin build entries without directory scans", () => {
|
||||
const output = execFileSync(
|
||||
process.execPath,
|
||||
[
|
||||
"--input-type=module",
|
||||
"--eval",
|
||||
`
|
||||
import fs from "node:fs";
|
||||
import { syncBuiltinESMExports } from "node:module";
|
||||
const counts = { readdirSync: 0 };
|
||||
const originalReaddirSync = fs.readdirSync;
|
||||
fs.readdirSync = (...args) => {
|
||||
counts.readdirSync += 1;
|
||||
return originalReaddirSync(...args);
|
||||
};
|
||||
syncBuiltinESMExports();
|
||||
const build = await import("./scripts/lib/bundled-plugin-build-entries.mjs");
|
||||
const entries = build.listBundledPluginBuildEntries();
|
||||
const artifacts = build.listBundledPluginPackArtifacts();
|
||||
console.log(JSON.stringify({
|
||||
artifacts: artifacts.length,
|
||||
counts,
|
||||
entries: Object.keys(entries).length,
|
||||
}));
|
||||
`,
|
||||
],
|
||||
{
|
||||
cwd: process.cwd(),
|
||||
encoding: "utf8",
|
||||
},
|
||||
);
|
||||
const payload = JSON.parse(output) as {
|
||||
artifacts: number;
|
||||
counts: { readdirSync: number };
|
||||
entries: number;
|
||||
};
|
||||
|
||||
expect(payload.entries).toBeGreaterThan(0);
|
||||
expect(payload.artifacts).toBeGreaterThan(0);
|
||||
expect(payload.counts.readdirSync).toBe(0);
|
||||
});
|
||||
|
||||
it("packs runtime core support packages without requiring plugin manifests", () => {
|
||||
const artifacts = listBundledPluginPackArtifacts();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user