feat(FN-3470): prefer source aliases for runtime plugins and add test artif

Merges FN-3470 in two steps: first, runtime plugins now prefer source path aliases over build artifacts, with hardening tests for vitest alias resolution and plugin view registry updates; second, a new `ensure-test-artifacts.mjs` bootstrap script guarantees required test files exist before test runs

Fusion-Task-Id: FN-3470
This commit is contained in:
Fusion
2026-05-05 13:19:16 -07:00
committed by gsxdsm
parent 0aef085f13
commit 7d373286d9
10 changed files with 146 additions and 5 deletions

View File

@@ -0,0 +1,33 @@
import test from "node:test";
import assert from "node:assert/strict";
import { detectMissingArtifacts, ensureTestArtifacts } from "../ensure-test-artifacts.mjs";
test("detectMissingArtifacts returns missing package list", () => {
const missing = detectMissingArtifacts("/repo", () => false);
assert.ok(missing.length >= 5);
assert.equal(missing[0].name, "@fusion/core");
});
test("ensureTestArtifacts skips build when nothing is missing", () => {
let called = false;
const built = ensureTestArtifacts("/repo", () => {
called = true;
}, () => true);
assert.equal(called, false);
assert.deepEqual(built, []);
});
test("ensureTestArtifacts builds only missing packages", () => {
const calls = [];
const built = ensureTestArtifacts(
"/repo",
(cmd, args, cwd) => calls.push({ cmd, args, cwd }),
(fullPath) => !fullPath.includes("fusion-plugin-openclaw-runtime"),
);
assert.deepEqual(built, ["@fusion-plugin-examples/openclaw-runtime"]);
assert.equal(calls.length, 1);
assert.equal(calls[0].cmd, "pnpm");
assert.deepEqual(calls[0].args, ["--filter", "@fusion-plugin-examples/openclaw-runtime", "build"]);
});