playwright-flake-checker
Version:
A tool to check for flaky Playwright tests by running them multiple times and analyzing results.
86 lines • 4.97 kB
JavaScript
import chalk from 'chalk';
import figlet from 'figlet';
/**
* Logger interface for logging messages with different styles.
* @returns {Logger} An object with methods for logging messages.
*/
export const log = () => ({
info: (...args) => console.info(...args),
error: (...args) => console.error(styled.error(args.join(' '))),
yellow: (...args) => console.info(chalk.yellow(args.join(' '))),
green: (...args) => console.info(chalk.green(args.join(' '))),
red: (...args) => console.info(chalk.red(args.join(' '))),
cyan: (...args) => console.info(chalk.cyan(args.join(' '))),
magenta: (...args) => console.info(chalk.magenta(args.join(' '))),
blue: (...args) => console.info(chalk.blue(args.join(' '))),
gray: (...args) => console.info(chalk.gray(args.join(' '))),
bold: (...args) => console.info(chalk.bold(args.join(' '))),
dim: (...args) => console.info(chalk.dim(args.join(' '))),
underline: (...args) => console.info(chalk.underline(args.join(' '))),
italic: (...args) => console.info(chalk.italic(args.join(' '))),
warning: (...args) => console.info(styled.warning(args.join(' '))),
success: (...args) => console.info(styled.success(args.join(' '))),
});
/**
* Styled interface for styled text messages.
* @returns {Styled} An object with methods for styled text messages.
*/
export const styled = {
success: (text) => chalk.green.bold(`✅ ${text}`),
error: (text) => chalk.red.bold(`❌ ${text}`),
warning: (text) => chalk.yellow.bold(`⚠️ ${text}`),
info: (text) => chalk.blue.bold(`ℹ️ ${text}`),
highlight: (text) => chalk.cyan.bold.underline(text),
subtle: (text) => chalk.gray.dim(text),
emphasis: (text) => chalk.yellow.italic(text),
filename: (text) => chalk.green.bold.underline(text),
command: (text) => chalk.blue.italic(`\`${text}\``),
url: (text) => chalk.cyan.underline(text),
};
/**
* Displays a banner with the Playwright and Flake Checker logos.
* @returns {void}
*/
export const displayBanner = () => {
log().info(figlet.textSync('PLAYWRIGHT', { font: 'ANSI Shadow', horizontalLayout: 'full' }));
log().info(`
****
#*******
##*********
##************
##****************
##*********************
#****************************
++++******************************++++++++++++ *++++++++++++
+++++++++******************************+++++++++++++++++++++++++++
*++++++++++++++++++++++++++++******************************+++++++++++++++++++++++++++
##+++++++++++++++++++++++++++******************************++++++++++++++++++++++++++++
##+++++++++++++++++++++++++++*************###**************++++++++++++++++++++++++++++
#*++++++++++++++++++++++++++**********##########*********++++++++++++++++++++++++++++
##+++++++++++++++++++++++++*********## ######********++++++++++++++++++++++++++++
##*+++++++++++++++**#++++++*************** ####******+++++++++++++++++++++++++++++
#*++++++++**#######*++++++********************####*****++++++++*****+++++++++++++++
##+++++++*# **+++++++*****************************+++++*#########*++++++++++++
##++++++++++++++++++++++*****************************+++++*# ######*+++++++++
##*+++++++++++++++++++++*****************************+++++++++++++ ####*++++++++
##+++++++++++++++++++++****************************+++++++++++++++++*###+++++++
##++++++++++++++++++++****************************+++++++++++++++++++++++++++
###++++++++++++++++**####*********#####**********++++++++++++++++++++++++++++
##*++++++++++++++* ###**********###########***+++++++++++++++++++++++++++
###++++++++++++ ###************ ############****+++++++++++++++++++++
###++++++++++ ++++++**************** ############***++++++++++++++
##*+++++++++++++++****************** #########++++++++++++
###+++++++++++++++********************* #**+++++++++++++
####*++++++++++++**********************+++++++++++++++++++++++++
%###*+++++++++++*********************+++++++++++++++++++++++
####****+++++****#***************+++++++++++++++++++++++
###############**************+++++++++++++++++++++
#####***********+++++++++++++++++++*
#######********++++++++++++++++**#
#########***+++++++++++++***##
##########*********#####
################\n
`);
log().info(figlet.textSync('FLAKE CHECKER', { font: 'ANSI Shadow', horizontalLayout: 'full' }));
};
//# sourceMappingURL=logger.js.map