fix: mock api-logger and api-logging.plugin in cloudHandler-sync test
The DailyRotateFile transport in api-logger.ts creates directories at module load time. When the paths mock returns '/mock/agent/dir', the real file-stream-rotator fails with EACCES on CI Linux runners. Added vi.mock for both api-logger and api-logging.plugin to prevent the real DailyRotateFile from initializing during tests.
This commit is contained in:
1 parent
6e568dd866
commit
cca8bdf68f
1 file changed
+14
@@ -85,6 +85,20 @@ vi.mock('../../utils/traffic-logger', () => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
vi.mock('../../server/logging/api-logger', () => ({
|
||||||
|
apiLogger: {
|
||||||
|
info: vi.fn(),
|
||||||
|
warn: vi.fn(),
|
||||||
|
error: vi.fn(),
|
||||||
|
debug: vi.fn(),
|
||||||
|
},
|
||||||
|
safeApiLogValue: vi.fn((v: unknown) => v),
|
||||||
|
}));
|
||||||
|
|
||||||
|
vi.mock('../../server/logging/api-logging.plugin', () => ({
|
||||||
|
registerApiLogging: vi.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
vi.mock('../../services/GoogleAPIService', () => ({
|
vi.mock('../../services/GoogleAPIService', () => ({
|
||||||
GoogleAPIService: {
|
GoogleAPIService: {
|
||||||
getUserInfo: vi.fn(),
|
getUserInfo: vi.fn(),
|
||||||
|
|||||||
Reference in new issue
Block a user