routes
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m27s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m27s
This commit is contained in:
@@ -9,16 +9,14 @@ import systemRouter from './system.routes';
|
||||
type ExecCallback = (error: ExecException | null, stdout: string, stderr: string) => void;
|
||||
|
||||
// FIX: Add default export to child_process mock
|
||||
vi.mock('child_process', () => {
|
||||
// The mock now handles both overloads of exec without using `any`.
|
||||
const mockExec = vi.fn();
|
||||
vi.mock('child_process', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('child_process')>();
|
||||
return {
|
||||
exec: mockExec,
|
||||
default: { exec: mockExec },
|
||||
...actual, // Spread all original exports.
|
||||
exec: vi.fn(), // Override only the 'exec' function with a mock.
|
||||
};
|
||||
});
|
||||
|
||||
// Now we can safely import the mocked function and control it.
|
||||
import { exec } from 'child_process';
|
||||
|
||||
vi.mock('../services/logger.server', () => ({
|
||||
|
||||
Reference in New Issue
Block a user