All files message.ts

100% Statements 14/14
100% Branches 4/4
100% Functions 1/1
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 251x 1x 1x   1x 5x 1x 1x   4x 3x 1x 2x 1x         1x            
const colorsCli = require('colors-cli/safe');
const shelljs = require('shelljs');
const emoji = require('node-emoji');
 
module.exports = (type: string, message: string, info: string) => {
  if (type === 'exit') {
    console.log(`\n\n${emoji.get('poop')} ${message}\n`);
    return shelljs.exit(1);
  }
  if (type === 'complete') return console.log(`\n\n${emoji.get('rocket')} ${message}\n`);
  if (type === 'failure')
    return console.log(`\n${emoji.get('red_circle')} ${colorsCli.red('failure ')}`, colorsCli.red(message), info);
  if (type === 'warning')
    return console.log(
      `\n${emoji.get('large_yellow_circle')} ${colorsCli.yellow('warning ')}`,
      colorsCli.yellow(message),
      info
    );
  return console.log(
    `\n${emoji.get('large_green_circle')} ${colorsCli.green('success ')}`,
    colorsCli.green(message),
    info
  );
};