fix: add missing vitest aliases and mock export for CI test failures (#1888)
## Summary Fixes three root causes behind CI run [28695362549](https://github.com/Runfusion/Fusion/actions/runs/28695362549) failures on main. ### 1. droid-cli: missing `@fusion-plugin-examples/droid-runtime` alias (8 tests) The droid-cli `index.test.ts` imports `@fusion-plugin-examples/droid-runtime`, but the droid-cli vitest config had no source alias. Without the alias, Vite tries to resolve the package's dist/ exports which don't exist in a source checkout, causing every droid-cli test that touches the droid runtime to fail. **Fix:** Added `resolve.alias` entries for `@fusion-plugin-examples/droid-runtime` and `/probe` subpath to `packages/droid-cli/vitest.config.ts`. ### 2. CLI: missing `@fusion-plugin-examples/roadmap` aliases The CLI imports the roadmap plugin (`roadmap-routes.ts`, `roadmap-suggestions.ts`), but the CLI vitest config was missing source aliases for `@fusion-plugin-examples/roadmap` and its `/server` and `/roadmap-suggestions` subpaths. **Fix:** Added three regex aliases to `packages/cli/vitest.config.ts`. ### 3. CLI: missing `runTaskImportFromGitLab` mock export (73 tests) The GitLab task import command was added to `bin.ts` and `commands/task.ts` but `bin.test.ts`'s `vi.mock("../commands/task.js")` factory was not updated to include the new export, causing 73 tests to fail with `No "runTaskImportFromGitLab" export is defined on the "../commands/task.js" mock`. **Fix:** Added `runTaskImportFromGitLab: vi.fn()` to the hoisted `commandMocks` and the mock factory in `packages/cli/src/__tests__/bin.test.ts`. ## Verification - droid-cli: 232 passed - CLI bin.test.ts: 74 passed - CLI broader tests (11 files): 146 passed, 90 skipped - CLI dashboard-tui tests: 72 passed - Gate suite (`pnpm test:gate`): 319 engine-core + 63 CI-shape passed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved test environment module resolution so local source packages load correctly during CLI and Droid CLI test runs. * Added support for additional command routing in test coverage, helping import-related flows dispatch to the right handler. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -25,6 +25,7 @@ const commandMocks = vi.hoisted(() => ({
|
||||
runTaskUnpause: vi.fn(),
|
||||
runTaskImportFromGitHub: vi.fn(),
|
||||
runTaskImportGitHubInteractive: vi.fn(),
|
||||
runTaskImportFromGitLab: vi.fn(),
|
||||
runTaskDuplicate: vi.fn(),
|
||||
runTaskArchive: vi.fn(),
|
||||
runTaskUnarchive: vi.fn(),
|
||||
@@ -171,6 +172,7 @@ vi.mock("../commands/task.js", () => ({
|
||||
runTaskUnpause: commandMocks.runTaskUnpause,
|
||||
runTaskImportFromGitHub: commandMocks.runTaskImportFromGitHub,
|
||||
runTaskImportGitHubInteractive: commandMocks.runTaskImportGitHubInteractive,
|
||||
runTaskImportFromGitLab: commandMocks.runTaskImportFromGitLab,
|
||||
runTaskDuplicate: commandMocks.runTaskDuplicate,
|
||||
runTaskArchive: commandMocks.runTaskArchive,
|
||||
runTaskUnarchive: commandMocks.runTaskUnarchive,
|
||||
|
||||
@@ -90,6 +90,22 @@ export default defineConfig({
|
||||
find: /^@fusion-plugin-examples\/cursor-runtime$/,
|
||||
replacement: resolve(__dirname, "../../plugins/fusion-plugin-cursor-runtime/src/index.ts"),
|
||||
},
|
||||
/*
|
||||
FNXC:PluginTests 2026-07-04-09:30:
|
||||
The roadmap plugin (@fusion-plugin-examples/roadmap) is imported by the CLI extension. Without source aliases, Vite resolves to the dist/ exports which don't exist in a source checkout.
|
||||
*/
|
||||
{
|
||||
find: /^@fusion-plugin-examples\/roadmap\/server$/,
|
||||
replacement: resolve(__dirname, "../../plugins/fusion-plugin-roadmap/src/server/index.ts"),
|
||||
},
|
||||
{
|
||||
find: /^@fusion-plugin-examples\/roadmap\/roadmap-suggestions$/,
|
||||
replacement: resolve(__dirname, "../../plugins/fusion-plugin-roadmap/src/roadmap-suggestions.ts"),
|
||||
},
|
||||
{
|
||||
find: /^@fusion-plugin-examples\/roadmap$/,
|
||||
replacement: resolve(__dirname, "../../plugins/fusion-plugin-roadmap/src/index.ts"),
|
||||
},
|
||||
{ find: /^@fusion\/test-utils$/, replacement: resolve(__dirname, "../core/src/__test-utils__/workspace.ts") },
|
||||
],
|
||||
},
|
||||
|
||||
@@ -5,6 +5,16 @@ import { computeMaxWorkers } from "../core/src/__test-utils__/vitest-workers";
|
||||
const maxWorkers = computeMaxWorkers();
|
||||
|
||||
export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
/*
|
||||
FNXC:PluginTests 2026-07-04-09:30:
|
||||
droid-cli's index.test.ts imports @fusion-plugin-examples/droid-runtime, but without a source alias Vite tries to resolve the package's dist/ exports which don't exist in a source checkout, causing every droid-cli test to fail with 'Failed to resolve entry for package'.
|
||||
*/
|
||||
"@fusion-plugin-examples/droid-runtime/probe": resolve(__dirname, "../../plugins/fusion-plugin-droid-runtime/src/probe.ts"),
|
||||
"@fusion-plugin-examples/droid-runtime": resolve(__dirname, "../../plugins/fusion-plugin-droid-runtime/src/index.ts"),
|
||||
},
|
||||
},
|
||||
test: {
|
||||
globals: true,
|
||||
setupFiles: [
|
||||
|
||||
Reference in New Issue
Block a user