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;
|
type ExecCallback = (error: ExecException | null, stdout: string, stderr: string) => void;
|
||||||
|
|
||||||
// FIX: Add default export to child_process mock
|
// FIX: Add default export to child_process mock
|
||||||
vi.mock('child_process', () => {
|
vi.mock('child_process', async (importOriginal) => {
|
||||||
// The mock now handles both overloads of exec without using `any`.
|
const actual = await importOriginal<typeof import('child_process')>();
|
||||||
const mockExec = vi.fn();
|
|
||||||
return {
|
return {
|
||||||
exec: mockExec,
|
...actual, // Spread all original exports.
|
||||||
default: { exec: mockExec },
|
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';
|
import { exec } from 'child_process';
|
||||||
|
|
||||||
vi.mock('../services/logger.server', () => ({
|
vi.mock('../services/logger.server', () => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user