Files
ComfyUI_frontend/vitest.setup.ts
Christian Byrne b210e63f3c [backport rh-test] make 'require subscription' toggleable (#6147)
## Summary

Backport of PR #6144 to the `rh-test` branch.

This adds build time feature flags system starting with a flag that
indicates whether subscription is required to use the app. This is only
used on cloud.

## Changes

- Added build feature flags system via `__BUILD_FLAGS__` global
- Added `REQUIRE_SUBSCRIPTION` flag that can be set via environment
variable
- Conditionally load subscription-related components based on the flag
- Updated run button logic to respect the subscription requirement flag
- Updated settings UI to show subscription panel only when required

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6147-Backport-make-require-subscription-toggleable-in-build-to-rh-test-2916d73d365081e89bcfc4502315a812)
by [Unito](https://www.unito.io)
2025-10-19 12:08:57 -07:00

30 lines
1.0 KiB
TypeScript

import { vi } from 'vitest'
import 'vue'
// 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'
globalThis.__BUILD_FLAGS__ = {
REQUIRE_SUBSCRIPTION: true
}
// 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()
}))