try try again - almost giving up
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 10m38s

This commit is contained in:
2025-12-06 15:08:01 -08:00
parent 59559c155d
commit ceba599722

View File

@@ -24,8 +24,7 @@ const { mockGenerateContent, mockReadFile, mockToBuffer, mockExtract, mockSharp
// 2. Mock `fs` and `node:fs` using external object. Failed (hoisting issue).
// 3. Mock modules to return the HOISTED mock variables directly. Failed.
// 4. Inline mock definitions inside vi.mock factory. Failed (potentially due to complex object nesting).
// 5. Use vi.fn() directly inside factory. Failed (ReferenceError: Cannot access 'fsFactory' before initialization).
// 6. Current Strategy: Move fsFactory into vi.hoisted to ensure it exists before mocks are hoisted.
// 5. Current Strategy: Use vi.fn() directly inside factory for GoogleGenAI and a unified factory for FS to ensure consistency.
// 2. Mock the @google/genai SDK
vi.mock('@google/genai', () => {
@@ -39,13 +38,11 @@ vi.mock('@google/genai', () => {
});
// 3. Robust mock for file system operations
const { fsFactory } = vi.hoisted(() => ({
fsFactory: () => ({
default: { readFile: mockReadFile },
readFile: mockReadFile,
promises: { readFile: mockReadFile }
})
}));
const fsFactory = () => ({
default: { readFile: mockReadFile },
readFile: mockReadFile,
promises: { readFile: mockReadFile }
});
vi.mock('fs', fsFactory);
vi.mock('node:fs', fsFactory);