Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const log = logger("sender test", false);
// we can't snapshot because of logSymbols & colors...
const colorStart =
process.platform !== "win32" && !process.env.CIRCLECI ? "[90m" : "";
const colorEnd =
process.platform !== "win32" && !process.env.CIRCLECI ? "[39m" : "";
expect(log("test msg")).toBe(
`${logSymbols.info} ${colorStart}sender test:${colorEnd} test msg`,
);
expect(log.debug("test debug")).toBe(
` ${colorStart}sender test:${colorEnd} test debug`,
);
expect(log.info("test info")).toBe(
`${logSymbols.info} ${colorStart}sender test:${colorEnd} test info`,
);
expect(log.success("test success")).toBe(
`${logSymbols.success} ${colorStart}sender test:${colorEnd} test success`,
);
expect(log.warn("test warning")).toBe(
`${logSymbols.warning} ${colorStart}sender test:${colorEnd} test warning`,
);
expect(log.error("test error")).toBe(
`${logSymbols.error} ${colorStart}sender test:${colorEnd} test error`,
);
});
module.exports.delete = () => { // Delete saved emoticons
try {
fs.unlinkSync(`${homeDir}/saved_emoji.txt`);
console.log(chalk.green.bold(`${logSymbols.success} Successfully deleted all saved emoticons!`));
return;
} catch (err) {
if (err.code === 'ENOENT') {
console.log(chalk.red(`${logSymbols.error} File ${homeDir}/saved_emoji.txt not found :(`));
process.exit(1);
}
}
};
.build(err => {
// Handle build errors
if (err) {
console.log(stripIndents`
${logSymbols.error} Handlebars build failed:
${chalk.red.bold(err.message)}
`);
process.exit(1);
} else {
// Handle successful build
/**
* NOTE:
* We need to backdate the generated files by ten seconds until
* https://github.com/webpack/watchpack/issues/25 is fixed.
* Otherwise we would have some unneeded rebuilds when starting webpack in
* watch mode or starting the webpack dev server.
*/
const f = path.resolve(
__dirname,
'../',
settings.destinations.handlebars
proc.on('exit', async (code) => {
if (code === 0) {
if (flow) {
try {
await installFlow();
} catch (e) {
spinner.fail('There was an error installing dependencies.');
}
}
spinner.stop();
console.log();
console.log(ls.success, chalk.green('Woohoo! Everything is good to go!'));
console.log('To start your app, just run:');
console.log();
console.log(chalk.cyan(' npm start'));
console.log();
console.log('Happy coding!');
process.exit(); // eslint-disable-line unicorn/no-process-exit
} else {
spinner.fail('There was an error installing dependencies.');
}
});
}
async function startChat(user) {
// replace selector with selected user
let user_chat_selector = selector.user_chat;
user_chat_selector = user_chat_selector.replace('XXX', user);
await page.waitFor(user_chat_selector);
await page.click(user_chat_selector);
await page.click(selector.chat_input);
let name = getCurrentUserName();
if (name) {
console.log(logSymbols.success, chalk.bgGreen('You can chat now :-)'));
console.log(logSymbols.info, chalk.bgRed('Press Ctrl+C twice to exit any time.\n'));
} else {
console.log(logSymbols.warning, 'Could not find specified user "' + user + '"in chat threads\n');
}
}
async function startChat(user) {
// replace selector with selected user
let user_chat_selector = selector.user_chat;
user_chat_selector = user_chat_selector.replace('XXX', user);
await page.waitFor(user_chat_selector);
await page.click(user_chat_selector);
await page.click(selector.chat_input);
let name = getCurrentUserName();
if (name) {
console.log(logSymbols.success, chalk.bgGreen('You can chat now :-)'));
console.log(logSymbols.info, chalk.bgRed('Press Ctrl+C twice to exit any time.\n'));
} else {
console.log(logSymbols.warning, 'Could not find specified user "' + user + '"in chat threads\n');
}
}
export function printGeneralInfoMessage(msg: string, symbol?: string) {
if (typeof symbol === 'undefined') {
// eslint-disable-next-line no-param-reassign
symbol = logSymbols.info;
}
console.info(addTimeStampToLog(`${symbol} ${msg}`));
}
var colors = {
success: {
symbol: config.mochaReporter.symbols.success || stripAnsi(symbols.success),
print: chalk[config.mochaReporter.colors.success] || chalk.green
},
info: {
symbol: config.mochaReporter.symbols.info || stripAnsi(symbols.info),
print: chalk[config.mochaReporter.colors.info] || chalk.grey
},
warning: {
symbol: config.mochaReporter.symbols.warning || stripAnsi(symbols.warning),
print: chalk[config.mochaReporter.colors.warning] || chalk.yellow
},
error: {
symbol: config.mochaReporter.symbols.error || stripAnsi(symbols.error),
print: chalk[config.mochaReporter.colors.error] || chalk.red
}
};
// init max number of log lines
config.mochaReporter.maxLogLines = config.mochaReporter.maxLogLines || 999;
if (isNaN(config.mochaReporter.maxLogLines)) {
self.write(colors.warning.print('Option "config.mochaReporter.maxLogLines" must be of type number. Default value 999 is used!'));
config.mochaReporter.maxLogLines = 999;
}
// check if mocha is installed when showDiff is enabled
if (config.mochaReporter.showDiff) {
try {
var mocha = require('mocha');
spinner.fail = function fail(err) {
spinner.stopAndPersist(symbols.error);
// stop the rest of spinners
to.each(self.spinners, ({ value }) => {
value.originalStop();
});
self.log('error', err);
};
const getSymbol = (task: TaskStatus, spinners: Spinners) => {
if (spinners[task.id] == null) {
// eslint-disable-next-line
spinners[task.id] = elegantSpinner();
}
const hasSubtasks = task.subtasks != null && task.subtasks.length > 0;
if (task.pending) {
return hasSubtasks ? pointer : chalk.yellow(spinners[task.id]());
}
if (task.complete) {
return logSymbols.success;
}
if (task.error != null) {
return hasSubtasks ? pointer : logSymbols.error;
}
if (task.skipped != null) {
return skipped;
}
return ' ';
};