UNPKG

jest-firestore

Version:

Run your tests using Jest & Firestore Emulator

68 lines (67 loc) 2.27 kB
export interface FirestoreEmulatorArgs { port?: number; host?: string; websocket_port?: number; project_id?: string; rules?: string; functions_emulator?: string; auto_download?: boolean; seed_from_export?: string; single_project_mode?: boolean; single_project_mode_error?: boolean; } export declare function startEmulator(args: FirestoreEmulatorArgs): Promise<string>; export declare function stopEmulator(): Promise<void>; /** * Return a connectable hostname, replacing wildcard 0.0.0.0 or :: with loopback * addresses 127.0.0.1 / ::1 correspondingly. See below for why this is needed: * https://github.com/firebase/firebase-tools-ui/issues/286 * * This assumes that the consumer (i.e. client SDK, etc.) is located on the same * device as the Emulator hub (i.e. CLI), which may not be true on multi-device * setups, etc. In that case, the customer can work around this by specifying a * non-wildcard IP address (like the IP address on LAN, if accessing via LAN). */ export declare function connectableHostname(hostname: string): string; export interface FirestoreEmulatorInstance { /** * Called to begin the emulator process. * * Note: you should almost always call EmulatorRegistry.start() instead of this method. */ start(): Promise<void>; /** * Called to tell the emulator to connect to other running emulators. * This must be called after start(). */ connect(): Promise<void>; /** * Called to stop the emulator process. * * Note: you should almost always call EmulatorRegistry.stop() instead of this method. */ stop(): Promise<void>; /** * Get the information about the running instance needed by the registry; */ getInfo(): EmulatorInfo; /** * Get the name of the corresponding service. */ getName(): 'firestore'; } export interface EmulatorInfo { name: 'firestore'; pid?: number; reservedPorts?: number[]; /** All addresses that an emulator listens on. */ listen?: ListenSpec[]; /** The primary IP address that the emulator listens on. */ host: string; port: number; } export interface ListenSpec { address: string; port: number; family: 'IPv4' | 'IPv6'; }