Files
ComfyUI_frontend/vitest.setup.ts
Christian Byrne eabc7ec19a [don't port to main] Fix CI checks for rh-test (by ignoring failing tests and checks) (#6266)
## Summary

Fixes all CI check failures on rh-test


┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6266-don-t-port-to-main-Fix-CI-checks-for-rh-test-after-cherry-pick-6257-2976d73d3650812c828fc3fa9aaf345f)
by [Unito](https://www.unito.io)

---------

Co-authored-by: GitHub Action <action@github.com>
2025-10-24 19:37:17 -07:00

56 lines
1.7 KiB
TypeScript

import { vi } from 'vitest'
import 'vue'
// Mock firebaseAuthStore to break circular dependency in rh-test branch
// Circular chain: api -> firebaseAuthStore -> dialogService -> components -> settingStore -> app -> ComfyUI -> api
// This is a test-only fix to prevent module initialization failures
vi.mock('@/stores/firebaseAuthStore', () => ({
useFirebaseAuthStore: vi.fn(() => ({
getAuthHeader: vi.fn(),
getIdToken: vi.fn(),
isAuthenticated: false,
user: null
}))
}))
// Augment Window interface for tests
declare global {
interface Window {
__CONFIG__: {
mixpanel_token?: string
subscription_required?: boolean
server_health_alert?: string
}
}
}
// Define global variables for tests
// @ts-expect-error - Global variables are defined in global.d.ts
globalThis.__COMFYUI_FRONTEND_VERSION__ = '1.24.0'
// @ts-expect-error - Global variables are defined in global.d.ts
globalThis.__SENTRY_ENABLED__ = false
// @ts-expect-error - Global variables are defined in global.d.ts
globalThis.__SENTRY_DSN__ = ''
// @ts-expect-error - Global variables are defined in global.d.ts
globalThis.__ALGOLIA_APP_ID__ = ''
// @ts-expect-error - Global variables are defined in global.d.ts
globalThis.__ALGOLIA_API_KEY__ = ''
// @ts-expect-error - Global variables are defined in global.d.ts
globalThis.__USE_PROD_CONFIG__ = false
globalThis.__DISTRIBUTION__ = 'localhost'
// Define runtime config for tests
window.__CONFIG__ = {
subscription_required: true,
mixpanel_token: 'test-token'
}
// Mock Worker for extendable-media-recorder
globalThis.Worker = vi.fn().mockImplementation(() => ({
postMessage: vi.fn(),
terminate: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn()
}))