mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 21:37:41 +00:00
- Also fix issue where integration tests were making actual network requests - this also slightly speeds up tests - Fixes issues where there were JS errors thrown during tests due to incorrect mocks, causing confusion when adding/fixing other tests Before (note: too much content to even see all tests) https://github.com/user-attachments/assets/346bb57d-aa64-4a62-b666-3cf47fcc2a6c After: https://github.com/user-attachments/assets/f6379a93-2d1d-4f12-a467-02d874f98de6 Fixes HDX-3165
21 lines
664 B
TypeScript
21 lines
664 B
TypeScript
// @eslint-disable @typescript-eslint/no-var-requires
|
|
jest.retryTimes(1, { logErrorsBeforeRetry: true });
|
|
|
|
global.console = {
|
|
...console,
|
|
// Turn off console.debug logs in tests (useful since we log db queries aggressively)
|
|
debug: jest.fn(),
|
|
};
|
|
|
|
// Mock alert notification functions to prevent HTTP calls during tests
|
|
jest.mock('@/utils/slack', () => ({
|
|
...jest.requireActual('@/utils/slack'),
|
|
postMessageToWebhook: jest.fn().mockResolvedValue(null),
|
|
}));
|
|
|
|
// Mock global fetch for generic webhook calls
|
|
global.fetch = jest.fn().mockResolvedValue({
|
|
ok: true,
|
|
text: jest.fn().mockResolvedValue(''),
|
|
json: jest.fn().mockResolvedValue({}),
|
|
} as any);
|