Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

test: mock sharp globally in vitest setup (transitive dep, never built)

Reuvenf51c11e2c7f1
diff --git a/v3/__tests__/setup.ts b/v3/__tests__/setup.ts
index a48066fd8a..b188b8de91 100644
--- a/v3/__tests__/setup.ts
+++ b/v3/__tests__/setup.ts
@@ -5,6 +5,24 @@
import { beforeAll, afterAll, vi } from 'vitest';
+// ── Native binding mocks ─────────────────────────────────────────────
+// `sharp` is a transitive dep via @xenova/transformers + @huggingface/
+// transformers. v3/package.json has `neverBuiltDependencies: ['sharp']`,
+// so sharp's prebuilt binary is never fetched in CI. Any test that
+// transitively pulls in transformers fails at module-load with
+// 'Cannot find module ../build/Release/sharp-linux-x64.node'.
+//
+// No test in this suite actually exercises sharp's image-processing
+// behavior β€” it's only ever a transitive bystander. Mock it as a no-op
+// so module-load succeeds. If a test ever does need real sharp, it can
+// override locally via vi.unmock('sharp').
+vi.mock('sharp', () => ({
+ default: () => {
+ throw new Error('sharp is mocked in tests; install it in your project for real image processing');
+ },
+}));
+
+
// Mock console.warn for cleaner test output
beforeAll(() => {
vi.spyOn(console, 'warn').mockImplementation(() => {});