/** * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { ChildProcess } from 'child_process'; export interface TestServerOptions { /** Path to the test-server configuration file. */ configPath: string; /** Directory to store/load recordings. */ recordingDir: string; /** * Mode to run test-server in. * - 'record': Forces record mode. * - 'replay': Forces replay mode. * - 'cli-driven': Mode is determined by CLI arguments. Defaults to 'replay' unless --record is passed. */ mode: 'record' | 'replay' | 'cli-driven'; /** Optional environment variables for the test-server process. */ env?: NodeJS.ProcessEnv; /** Optional callback for stdout data. */ onStdOut?: (data: string) => void; /** Optional callback for stderr data. */ onStdErr?: (data: string) => void; /** Optional callback for when the process exits. */ onExit?: (code: number | null, signal: NodeJS.Signals | null) => void; /** Optional callback for when an error occurs in spawning the process. */ onError?: (err: Error) => void; } /** * Starts the test-server process. * @param options Configuration options for starting the server. * @returns The spawned ChildProcess instance. */ export declare function startTestServer(options: TestServerOptions): Promise; /** * Stops the test-server process. * @param serverProcess The ChildProcess instance to stop. * @returns A Promise that resolves when the process has exited. */ export declare function stopTestServer(serverProcess: ChildProcess): Promise;