Files
ruvnet__ruflo/v3/__tests__/setup.ts
Reuven f51c11e2c7 test: mock sharp globally in vitest setup (transitive dep, never built)
77 tests in the latest run failed at module-load with
  'Cannot find module ../build/Release/sharp-linux-x64.node'

Root cause: sharp is a transitive dep via @xenova/transformers and
@huggingface/transformers (both deps of @claude-flow/embeddings).
v3/package.json has 'neverBuiltDependencies: [sharp]' — so pnpm
never fetches sharp's prebuilt binary in any environment, including
CI. The threads pool masked this (single Node process, fast-fail
caught and suppressed earlier in some runs); the forks pool exposes
it (each test file is a fresh process; sharp's load fails fresh).

No test in this suite exercises sharp's image-processing behavior —
it's purely a bystander pulled in by transformers' module graph.

Add a global vi.mock('sharp', ...) in __tests__/setup.ts so the
import resolves to a no-op throwing stub. Tests that load
transformers transitively now succeed at module-load; if any test
ever does need real sharp, vi.unmock('sharp') in that file.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-09 10:29:56 -04:00

1.3 KiB