mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
* refactor(test): split plugin SDK test helpers * fix(test): align plugin SDK test subpaths
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
/**
|
|
* Browser test-support re-exports from shared plugin-sdk test fixtures.
|
|
*/
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
|
|
|
|
export {
|
|
createCliRuntimeCapture,
|
|
expectGeneratedTokenPersistedToGatewayAuth,
|
|
type CliRuntimeCapture,
|
|
} from "openclaw/plugin-sdk/test-fixtures";
|
|
export { createTempHomeEnv } from "openclaw/plugin-sdk/test-env";
|
|
export type { TempHomeEnv } from "openclaw/plugin-sdk/test-env";
|
|
export { isLiveTestEnabled } from "openclaw/plugin-sdk/test-live";
|
|
export type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
|
|
|
|
export function useAutoCleanupTempDirTracker(registerCleanup: (cleanup: () => void) => unknown) {
|
|
const dirs = new Set<string>();
|
|
registerCleanup(() => {
|
|
for (const dir of dirs) {
|
|
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 20 });
|
|
}
|
|
dirs.clear();
|
|
});
|
|
return {
|
|
make(prefix: string): string {
|
|
const dir = fs.mkdtempSync(path.join(resolvePreferredOpenClawTmpDir(), prefix));
|
|
dirs.add(dir);
|
|
return dir;
|
|
},
|
|
};
|
|
}
|