Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openclaw/src/plugin-sdk/   (KI Agentensystem Version 22©)  Datei vom 26.3.2026 mit Größe 2 kB image not shown  

Quelle  qa-runtime.test-helpers.ts

  Sprache: JAVA
 

Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { expect, vi } from "vitest";

type QaRuntimeModule = {
  loadQaRuntimeModule: () => unknown;
};

type SurfaceLoaderMock = ReturnType<typeof vi.fn>;

export function cleanupTempDirs(tempDirs: string[]): void {
  for (const dir of tempDirs.splice(0)) {
    fs.rmSync(dir, { recursive: true, force: true });
  }
}

export function restorePrivateQaCliEnv(originalPrivateQaCli: string | undefined): void {
  if (originalPrivateQaCli === undefined) {
    delete process.env.OPENCLAW_ENABLE_PRIVATE_QA_CLI;
  } else {
    process.env.OPENCLAW_ENABLE_PRIVATE_QA_CLI = originalPrivateQaCli;
  }
}

export function makePrivateQaSourceRoot(tempDirs: string[], prefix: string): string {
  const sourceRoot = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
  tempDirs.push(sourceRoot);
  fs.mkdirSync(path.join(sourceRoot, "src"), { recursive: true });
  fs.mkdirSync(path.join(sourceRoot, "extensions"), { recursive: true });
  fs.writeFileSync(path.join(sourceRoot, ".git"), "gitdir: /tmp/mock\n", "utf8");
  process.env.OPENCLAW_ENABLE_PRIVATE_QA_CLI = "1";
  return sourceRoot;
}

export function makeQaRuntimeSurface() {
  return {
    defaultQaRuntimeModelForMode: vi.fn(),
    startQaLiveLaneGateway: vi.fn(),
  };
}

export async function expectQaLabRuntimeSurfaceLoad(params: {
  importRuntime: () => Promise<QaRuntimeModule>;
  loadBundledPluginPublicSurfaceModuleSync: SurfaceLoaderMock;
}) {
  const runtimeSurface = makeQaRuntimeSurface();
  params.loadBundledPluginPublicSurfaceModuleSync.mockReturnValue(runtimeSurface);

  const module = await params.importRuntime();

  expect(module.loadQaRuntimeModule()).toBe(runtimeSurface);
  expect(params.loadBundledPluginPublicSurfaceModuleSync).toHaveBeenCalledWith({
    dirName: "qa-lab",
    artifactBasename: "runtime-api.js",
  });
}

export async function expectPrivateQaLabRuntimeSurfaceLoad(params: {
  tempDirs: string[];
  importRuntime: () => Promise<QaRuntimeModule>;
  loadBundledPluginPublicSurfaceModuleSync: SurfaceLoaderMock;
  resolveOpenClawPackageRootSync: SurfaceLoaderMock;
}) {
  const sourceRoot = makePrivateQaSourceRoot(params.tempDirs, "openclaw-qa-runtime-root-");
  params.resolveOpenClawPackageRootSync.mockReturnValue(sourceRoot);

  const runtimeSurface = makeQaRuntimeSurface();
  params.loadBundledPluginPublicSurfaceModuleSync.mockReturnValue(runtimeSurface);

  const module = await params.importRuntime();

  expect(module.loadQaRuntimeModule()).toBe(runtimeSurface);
  expect(params.loadBundledPluginPublicSurfaceModuleSync).toHaveBeenCalledWith({
    dirName: "qa-lab",
    artifactBasename: "runtime-api.js",
    env: expect.objectContaining({
      OPENCLAW_ENABLE_PRIVATE_QA_CLI: "1",
      OPENCLAW_BUNDLED_PLUGINS_DIR: path.join(sourceRoot, "extensions"),
    }),
  });
}

¤ Dauer der Verarbeitung: 0.23 Sekunden  (vorverarbeitet am  2026-04-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.