diff --git a/tests/setup.ts b/tests/setup.ts new file mode 100644 index 0000000..b56b9f4 --- /dev/null +++ b/tests/setup.ts @@ -0,0 +1,10 @@ +import { vi } from "vitest"; + +// Mock sharp globally — it's a native binary module that may not be available in CI +vi.mock("sharp", () => ({ + default: vi.fn().mockReturnValue({ + png: vi.fn().mockReturnValue({ + toBuffer: vi.fn().mockResolvedValue(Buffer.from("mock-image")), + }), + }), +})); diff --git a/vite.config.ts b/vite.config.ts index 9828231..ed038a7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,7 +4,6 @@ import { defineConfig } from 'vite' export default defineConfig({ test: { - /* for example, use global to avoid globals imports (describe, test, expect): */ - // globals: true, + setupFiles: ['./tests/setup.ts'], }, }) \ No newline at end of file