feat(FN-2620): add plugin test-time engine resolution stubs

- Add engine-guard-stub test modules for hermes, openclaw, and paperclip runtime plugins to fail fast on unmocked @fusion/engine imports
- Update each plugin Vitest config to alias @fusion/engine to the local guard stub during test runs
- Keep setup-engine-guard behavior while removing dependency on built engine dist artifacts for plugin-local tests
This commit is contained in:
Fusion
2026-04-26 21:49:47 -07:00
committed by gsxdsm
parent b56571e082
commit b918ba5ee6
6 changed files with 96 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
/**
* Resolution stub for @fusion/engine in plugin test mode.
*
* Vitest resolves mocked module IDs before applying vi.mock factories. The
* real @fusion/engine workspace package points to dist outputs that are not
* built for plugin-local test runs, so we alias to this stub in vitest config.
*
* Any direct import of @fusion/engine in plugin tests should still fail fast.
*/
const guardError = () =>
new Error(
"Guard: @fusion/engine was imported without an explicit mock. Runtime plugin tests must mock '../pi-module.js' to prevent loading the real engine.",
);
export const createFnAgent = () => {
throw guardError();
};
export const promptWithFallback = async () => {
throw guardError();
};
export const describeModel = () => {
throw guardError();
};