import fs from "node:fs/promises"; import path from "node:path"; import { describe, expect, it } from "vitest"; import { repoInstallSpec } from "../../test/helpers/bundled-plugin-paths.js"; import { withTempHome } from "../../test/helpers/temp-home.js"; import {
detectPluginInstallPathIssue,
formatPluginInstallPathIssue,
} from "./plugin-install-path-warnings.js";
expect(issue).toEqual({
kind: "missing-path",
pluginId: "matrix",
path: "/tmp/openclaw-matrix-missing",
});
expect(
formatPluginInstallPathIssue({
issue: issue!,
pluginLabel: "Matrix",
defaultInstallCommand: "openclaw plugins install @openclaw/matrix",
repoInstallCommand: MATRIX_REPO_INSTALL_COMMAND,
}),
).toEqual([ "Matrix is installed from a custom path that no longer exists: /tmp/openclaw-matrix-missing", 'Reinstall with "openclaw plugins install @openclaw/matrix".',
`If you are running from a repo checkout, you can also use "${MATRIX_REPO_INSTALL_COMMAND}".`,
]);
});
it("uses the second candidate path when the first one is stale", async () => { const { issue, pluginPath } = await detectMatrixCustomPathIssue("/tmp/openclaw-matrix-missing");
expect(issue).toEqual({
kind: "custom-path",
pluginId: "matrix",
path: pluginPath,
});
});
it("applies custom command formatting in warning messages", () => {
expect(
formatPluginInstallPathIssue({
issue: {
kind: "custom-path",
pluginId: "matrix",
path: "/tmp/matrix-plugin",
},
pluginLabel: "Matrix",
defaultInstallCommand: "openclaw plugins install @openclaw/matrix",
repoInstallCommand: MATRIX_REPO_INSTALL_COMMAND,
formatCommand: (command) => `<${command}>`,
}),
).toEqual([ "Matrix is installed from a custom path: /tmp/matrix-plugin", "Main updates will not automatically replace that plugin with the repo's default Matrix package.", 'Reinstall with "<openclaw plugins install @openclaw/matrix>" when you want to return to the standard Matrix plugin.',
`If you are intentionally running from a repo checkout, reinstall that checkout explicitly with "<${MATRIX_REPO_INSTALL_COMMAND}>" after updates.`,
]);
});
it("omits repo checkout guidance when no bundled source hint exists", () => {
expect(
formatPluginInstallPathIssue({
issue: {
kind: "missing-path",
pluginId: "matrix",
path: "/tmp/openclaw-matrix-missing",
},
pluginLabel: "Matrix",
defaultInstallCommand: "openclaw plugins install @openclaw/matrix",
repoInstallCommand: null,
}),
).toEqual([ "Matrix is installed from a custom path that no longer exists: /tmp/openclaw-matrix-missing", 'Reinstall with "openclaw plugins install @openclaw/matrix".',
]);
});
});
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet am 2026-06-10)
¤
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.