playwright-flake-checker
Version:
A tool to check for flaky Playwright tests by running them multiple times and analyzing results.
46 lines (45 loc) • 2.39 kB
TypeScript
/**
* Checks if the server is running and prompts the user to start it if not.
* @param url - The URL of the server to check.
* @param timeoutMs - The maximum time to wait for the server to respond, in milliseconds.
* @returns {Promise<boolean>} - Returns true if the server is running or started successfully, false otherwise.
*/
export declare const checkServerStatus: (route: string, timeoutMs?: number) => Promise<boolean>;
/**
* Determines if the server is running in detached mode.
*
* @returns {boolean} True if a detached server was started, otherwise false.
*/
export declare const isDetachedServerRunning: () => boolean;
/**
* Sets the state of the detached server.
* @param state - State of the detached server.
* @returns {void}
*/
export declare const setDetachedServerState: (state: boolean) => void;
/**
* Starts or builds a server process using either custom commands or npm scripts.
*
* This function provides an interactive CLI to select how to start or build a server:
* - Using npm scripts from package.json
* - Using a custom command provided by the user
*
* The server can run in foreground or detached (background) mode.
*
* @param {boolean} detached - When true, runs the server process detached in the background.
* When false (default), runs server in foreground.
* @param {object} options - Configuration options for the server
* @param {boolean} options.buildOnly - When true, only builds the server without starting it
* @param {('custom'|'scripts'|undefined)} options.mode - Controls how server commands are collected:
* - `'custom'` - Skip script selection and request custom command
* - `'scripts'` - Force using package.json scripts
* - `undefined` - Ask user to choose between scripts or custom command
* @returns {Promise<boolean>} A Promise resolving to true if server was started/built successfully, false otherwise
*/
export declare const startServer: (detached?: boolean, options?: ServerOptions) => Promise<boolean>;
/**
* Handles the server prompt logic based on whether the server is already running.
* @param isServerRunning - Indicates if the server is already running.
* @returns {Promise<boolean>} - Returns true if the server is running or started successfully, false otherwise.
*/
export declare const handleServerPrompt: (isServerRunning: boolean) => Promise<boolean>;