UNPKG

playwright-flake-checker

Version:

A tool to check for flaky Playwright tests by running them multiple times and analyzing results.

41 lines (40 loc) 1.78 kB
/** * Returns a promise that resolves after the specified number of milliseconds. * @param ms - The number of milliseconds to sleep. * @returns {Promise<void>} A promise that resolves after the specified time. */ export declare const sleep: (ms: number) => Promise<void>; /** * Finds and parses the package.json file from the current directory. * * @returns {PackageJson} The parsed package.json object. If the file cannot be found or parsed, * returns a default object with name set to 'Unknown Project' and empty scripts. */ export declare const findPackageJson: () => PackageJson; /** * Gracefully exits the script, stopping any detached server if running. * * - If a detached server is running, it attempts to kill the port specified in the configuration. * - If no detached server is running, it simply exits the script. */ export declare const gracefulExit: () => never; /** * Handles errors by logging them and gracefully exiting the script. * - If the error is an ExitPromptError, it logs a cancellation message. * - If the error message indicates a prompt was closed, it logs a cancellation message. * - If the error message indicates a command was interrupted by the user, it exits gracefully. * - For all other errors, it logs the error message and stack trace, then exits gracefully. * * @param {Error} error - The error to handle. * @returns {void} */ export declare const handleError: (error: Error) => void; /** * Retrieves all script entries from package.json and formats them as name-value pairs. * @returns An array of objects with name and value properties, both containing the script name. * Returns an empty array if no scripts are found. */ export declare const projectScripts: () => { name: string; value: string; }[];