Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  loader.git-path-regression.test.ts

  Sprache: JAVA
 

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

import { execFileSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import {
  cleanupTrackedTempDirs,
  makeTrackedTempDir,
  mkdirSafeDir,
} from "./test-helpers/fs-fixtures.js";

const tempRoots: string[] = [];

function makeTempDir() {
  return makeTrackedTempDir("openclaw-plugin-loader", tempRoots);
}

const mkdirSafe = mkdirSafeDir;

afterEach(() => {
  cleanupTrackedTempDirs(tempRoots);
});

describe("plugin loader git path regression", () => {
  it("loads git-style package extension entries when they import plugin-sdk infra-runtime (#49806)", async () => {
    const copiedExtensionRoot = path.join(makeTempDir(), "extensions", "imessage");
    const copiedSourceDir = path.join(copiedExtensionRoot, "src");
    const copiedPluginSdkDir = path.join(copiedExtensionRoot, "plugin-sdk");
    mkdirSafe(copiedSourceDir);
    mkdirSafe(copiedPluginSdkDir);
    const jitiBaseFile = path.join(copiedSourceDir, "__jiti-base__.mjs");
    fs.writeFileSync(jitiBaseFile, "export {};\n", "utf-8");
    fs.writeFileSync(
      path.join(copiedSourceDir, "channel.runtime.ts"),
      `import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime";
import { PAIRING_APPROVED_MESSAGE } from "../runtime-api.js";

export const copiedRuntimeMarker = {
  resolveOutboundSendDep,
  PAIRING_APPROVED_MESSAGE,
};
`,
      "utf-8",
    );
    fs.writeFileSync(
      path.join(copiedExtensionRoot, "runtime-api.ts"),
      `export const PAIRING_APPROVED_MESSAGE = "paired";
`,
      "utf-8",
    );
    const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "infra-runtime.ts");
    fs.writeFileSync(
      copiedChannelRuntimeShim,
      `export function resolveOutboundSendDep() {
  return "shimmed";
}
`,
      "utf-8",
    );
    const copiedChannelRuntime = path.join(copiedExtensionRoot, "src", "channel.runtime.ts");
    const script = `
      import { createJiti } from "jiti";
      const withoutAlias = createJiti(${JSON.stringify(jitiBaseFile)}, {
        interopDefault: true,
        tryNative: false,
        extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"],
      });
      let withoutAliasThrew = false;
      try {
        withoutAlias(${JSON.stringify(copiedChannelRuntime)});
      } catch {
        withoutAliasThrew = true;
      }
      const withAlias = createJiti(${JSON.stringify(jitiBaseFile)}, {
        interopDefault: true,
        tryNative: false,
        extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"],
        alias: {
          "openclaw/plugin-sdk/infra-runtime": ${JSON.stringify(copiedChannelRuntimeShim)},
        },
      });
      const mod = withAlias(${JSON.stringify(copiedChannelRuntime)});
      console.log(JSON.stringify({
        withoutAliasThrew,
        marker: mod.copiedRuntimeMarker?.PAIRING_APPROVED_MESSAGE,
        dep: mod.copiedRuntimeMarker?.resolveOutboundSendDep?.(),
      }));
    `;
    const raw = execFileSync(process.execPath, ["--input-type=module", "--eval", script], {
      cwd: process.cwd(),
      encoding: "utf-8",
    });
    const result = JSON.parse(raw) as {
      withoutAliasThrew: boolean;
      marker?: string;
      dep?: string;
    };
    expect(result.withoutAliasThrew).toBe(true);
    expect(result.marker).toBe("paired");
    expect(result.dep).toBe("shimmed");
  });
});

¤ 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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge