Projects STRLCPY cfonts Commits 7fa9801c
🤬
  • ■ ■ ■ ■ ■
    README.md
    skipped 466 lines
    467 467   
    468 468   
    469 469  ## Release History
     470 +* 2.6.1 - fixed console `maxLength`, `gradient` and `lineHeight`, added more end-to-end tests
    470 471  * 2.6.0 - added transition gradients and sets
    471 472  * 2.5.2 - fixed jsDocs, added typescript type test
    472 473  * 2.5.1 - fixed array output to include everything including colors
    skipped 48 lines
  • ■ ■ ■ ■
    package.json
    1 1  {
    2 2   "name": "cfonts",
    3 3   "description": "Sexy fonts for the console",
    4  - "version": "2.6.0",
     4 + "version": "2.6.1",
    5 5   "homepage": "https://github.com/dominikwilkowski/cfonts",
    6 6   "author": {
    7 7   "name": "Dominik Wilkowski",
    skipped 100 lines
  • ■ ■ ■ ■ ■ ■
    src/GetOptions.js
    skipped 46 lines
    47 47   * @return {object} - Our merged options
    48 48   */
    49 49  const GetOptions = (
    50  - { font, align, colors, background, backgroundColor, letterSpacing, lineHeight, space, maxLength, gradient, independentGradient, transitionGradient },
     50 + { font = '', align, colors, background, backgroundColor, letterSpacing, lineHeight, space, maxLength, gradient, independentGradient, transitionGradient },
    51 51   allowedColors = COLORS,
    52 52   allowedBG = BGCOLORS,
    53 53   allowedFont = FONTFACES
    54 54  ) => ({
    55  - font: font === undefined
     55 + font: font === ''
    56 56   ? 'block'
    57 57   : allowedFont[ font.toLowerCase() ] || font,
    58 58   align: align === undefined
    skipped 7 lines
    66 66   : background === undefined
    67 67   ? allowedBG[ backgroundColor.toLowerCase() ] || backgroundColor
    68 68   : allowedBG[ background.toLowerCase() ] || background,
    69  - letterSpacing: typeof letterSpacing !== 'undefined' && letterSpacing > 0
     69 + letterSpacing: typeof letterSpacing !== 'undefined'
    70 70   ? parseInt( letterSpacing.toString() )
    71  - : 1,
     71 + : 0,
    72 72   lineHeight: lineHeight === undefined
    73  - ? 1
     73 + ? font.toLowerCase() === 'console'
     74 + ? 0
     75 + : 1
    74 76   : parseInt( lineHeight.toString() ),
    75 77   space: typeof space === 'boolean'
    76 78   ? space
    skipped 16 lines
  • ■ ■ ■ ■ ■
    src/Gradient.js
    skipped 7 lines
    8 8   * @author Dominik Wilkowski [email protected]
    9 9   * @repository https://github.com/dominikwilkowski/cfonts
    10 10   *
    11  - * Gradient
    12  - * Generate the most colorful delta between two colors
     11 + * Rgb2hsv - Converts an RGB color value to HSV
     12 + * Hsv2rgb - Converts an HSV color value to RGB
     13 + * Rgb2hex - Converts RGB to HEX
     14 + * Hex2rgb - Convert HEX to RGB
     15 + * Hsv2hsvRad - Convert HSV coordinate to HSVrad (degree to radian)
     16 + * HsvRad2hsv - Convert HSVrad color to HSV (radian to degree)
     17 + * Hex2hsvRad - Convert HEX to HSVrad
     18 + * HsvRad2hex - Convert HSVrad to HEX
     19 + * GetLinear - Interpolate a linear path from a number to another number
     20 + * GetTheta - Interpolate a radial path from a number to another number
     21 + * GetGradientColors - Generate the most colorful delta between two colors
     22 + * PaintLines - Take a bunch of lines and color them in the colors provided
     23 + * Color2hex - Make sure a color is hex
     24 + * GetGaps - Calculate the gaps between an array of points
     25 + * TransitionBetweenHex - Generate colors between two given colors
     26 + * Transition - Generate n colors between x colors
     27 + * PaintGradient - Paint finished output in a gradient
    13 28   *
    14 29   **************************************************************************************************************************************************************/
    15 30   
    skipped 7 lines
    23 38  const { Color } = require('./Color.js');
    24 39   
    25 40  /**
    26  - * Converts an RGB color value to HSV.
     41 + * Converts an RGB color value to HSV
    27 42   *
    28 43   * @author https://github.com/Gavin-YYC/colorconvert
    29 44   *
    skipped 38 lines
    68 83  }
    69 84   
    70 85  /**
    71  - * Converts an HSV color value to RGB.
     86 + * Converts an HSV color value to RGB
    72 87   *
    73 88   * @author https://github.com/Gavin-YYC/colorconvert
    74 89   *
    skipped 424 lines
    499 514   const colorsNeeded = longestLine - firstCharacterPosition;
    500 515   const linesInbetween = i === 0
    501 516   ? []
    502  - : Array( lineHeight ).fill('\n');
     517 + : Array( lineHeight ).fill('');
    503 518   
    504 519   Debugging.report(`longestLine: ${ longestLine } | firstCharacterPosition: ${ firstCharacterPosition }`, 2);
    505 520   
    skipped 31 lines
  • ■ ■ ■ ■ ■ ■
    src/RenderConsole.js
    skipped 37 lines
    38 38   * @return {ReturnObject} - An object with the output and the line breaks
    39 39   */
    40 40  const RenderConsole = ( INPUT, OPTIONS, size = Size ) => {
     41 + const width = OPTIONS.maxLength < size.width && OPTIONS.maxLength !== 0
     42 + ? OPTIONS.maxLength
     43 + : size.width;
     44 + let lines = 0;
    41 45   let output = [];
    42 46   let i = 0;
    43 47   
    44  - // the defaults need to cramp a little so console doesn't look silly
    45  - OPTIONS.letterSpacing = OPTIONS.letterSpacing <= 1 ? 0 : OPTIONS.letterSpacing - 1;
    46  - OPTIONS.lineHeight = OPTIONS.lineHeight <= 1 ? 0 : OPTIONS.lineHeight - 1;
    47  - 
    48 48   let space = '';
    49 49   if( OPTIONS.letterSpacing > 0 ) {
    50 50   space = ' '.repeat( OPTIONS.letterSpacing );
    51 51   }
    52 52   
    53 53   // we have to add our letter spacing first
    54  - let outputLines = INPUT
     54 + const outputLines = INPUT
    55 55   .replace( /(?:\r\n|\r|\n)/g, '|' )
    56 56   .split( '|' )
    57 57   .map( line =>
    58 58   line
    59  - .trim()
    60 59   .split('')
    61 60   .join( space )
    62 61   );
    skipped 2 lines
    65 64   while( i < outputLines.length ) {
    66 65   let line = outputLines[ i ];
    67 66   
    68  - if( line.length > size.width ) {
    69  - outputLines[ i ] = line.slice( 0, size.width ).trim();
    70  - outputLines.splice( i + 1, 0, line.slice( size.width ).trim() );
     67 + if( line.length > width ) {
     68 + outputLines[ i ] = line.slice( 0, width );
     69 + outputLines.splice( i + 1, 0, line.slice( width ) );
    71 70   line = outputLines[ i ];
    72 71   }
    73 72   
    skipped 9 lines
    83 82   }
    84 83   
    85 84   output = AlignText( output, line.length, 1, OPTIONS.align, size );
    86  - output = AddLine( output, 0, [''], OPTIONS.lineHeight );
     85 + if( i !== outputLines.length - 1 ) {
     86 + output = [ ...output, ...Array( OPTIONS.lineHeight ).fill('') ];
     87 + }
    87 88   
     89 + lines++;
    88 90   i++;
    89 91   }
    90 92   
    91 93   return {
    92 94   output,
    93  - lines: output.length,
     95 + lines,
    94 96   };
    95 97  };
    96 98   
    skipped 5 lines
  • ■ ■ ■ ■ ■ ■
    src/constants.js
    skipped 167 lines
    168 168   example: '--letter-spacing 2',
    169 169   short: '-l',
    170 170   options: true,
    171  - default: 1,
     171 + default: undefined,
    172 172   },
    173 173   '--line-height': {
    174 174   description: 'Use to define your line height',
    175 175   example: '--line-height 5',
    176 176   short: '-z',
    177 177   options: true,
    178  - default: 1,
     178 + default: undefined,
    179 179   },
    180 180   '--spaceless': {
    181 181   description: 'Use to disable the padding around your output',
    skipped 63 lines
  • ■ ■ ■ ■ ■ ■
    test/examples.js
    skipped 66 lines
    67 67   independentGradient: true,
    68 68  });
    69 69   
     70 +CFonts.say('Hi|world!', {
     71 + gradient: ['red','green'],
     72 + transitionGradient: true,
     73 +});
     74 + 
     75 +CFonts.say('Hi|world!', {
     76 + gradient: ['red','green'],
     77 + independentGradient: true,
     78 + transitionGradient: true,
     79 +});
     80 + 
     81 +CFonts.say('KeystoneJS', {
     82 + font: 'chrome',
     83 + colors: ['cyan', 'yellow', '#ffa500'],
     84 + letterSpacing: 1,
     85 + lineHeight: 1,
     86 + space: true,
     87 + maxLength: '0',
     88 +});
     89 + 
    70 90   
    71 91  // for issue #13
    72 92  Array.prototype.foo = () => { return 0; };
    skipped 2 lines
  • ■ ■ ■ ■ ■ ■
    test/unit/GetOptions.spec.js
    skipped 13 lines
    14 14   align: 'left',
    15 15   colors: [],
    16 16   background: 'transparent',
    17  - letterSpacing: 1,
     17 + letterSpacing: 0,
    18 18   lineHeight: 1,
    19 19   space: true,
    20 20   maxLength: 0,
    skipped 23 lines
    44 44   align: 'left',
    45 45   colors: [ 'coLor1', 'coLor3' ],
    46 46   background: 'bgCOLor2',
    47  - letterSpacing: 1,
     47 + letterSpacing: 0,
    48 48   lineHeight: 1,
    49 49   space: true,
    50 50   maxLength: 0,
    skipped 21 lines
    72 72   align: 'left',
    73 73   colors: [],
    74 74   background: 'bgcoLOR3',
    75  - letterSpacing: 1,
     75 + letterSpacing: 0,
    76 76   lineHeight: 1,
    77 77   space: true,
    78 78   maxLength: 0,
    skipped 10 lines
    89 89   align: 'left',
    90 90   colors: [],
    91 91   background: 'transparent',
    92  - letterSpacing: 1,
     92 + letterSpacing: 0,
    93 93   lineHeight: 1,
    94 94   space: true,
    95 95   maxLength: 0,
    skipped 7 lines
    103 103   align: 'xxx',
    104 104   colors: [],
    105 105   background: 'transparent',
    106  - letterSpacing: 1,
     106 + letterSpacing: 0,
    107 107   lineHeight: 1,
    108 108   space: true,
    109 109   maxLength: 0,
    skipped 7 lines
    117 117   align: 'left',
    118 118   colors: ['xxx'],
    119 119   background: 'transparent',
    120  - letterSpacing: 1,
     120 + letterSpacing: 0,
    121 121   lineHeight: 1,
    122 122   space: true,
    123 123   maxLength: 0,
    skipped 7 lines
    131 131   align: 'left',
    132 132   colors: [],
    133 133   background: 'xxx',
    134  - letterSpacing: 1,
     134 + letterSpacing: 0,
    135 135   lineHeight: 1,
    136 136   space: true,
    137 137   maxLength: 0,
    skipped 7 lines
    145 145   align: 'left',
    146 146   colors: [],
    147 147   background: 'xxx',
    148  - letterSpacing: 1,
     148 + letterSpacing: 0,
    149 149   lineHeight: 1,
    150 150   space: true,
    151 151   maxLength: 0,
    skipped 21 lines
    173 173   align: 'left',
    174 174   colors: [],
    175 175   background: 'transparent',
    176  - letterSpacing: 1,
     176 + letterSpacing: 0,
    177 177   lineHeight: 555,
    178 178   space: true,
    179 179   maxLength: 0,
    skipped 7 lines
    187 187   align: 'left',
    188 188   colors: [],
    189 189   background: 'transparent',
    190  - letterSpacing: 1,
     190 + letterSpacing: 0,
    191 191   lineHeight: 1,
    192 192   space: false,
    193 193   maxLength: 0,
    skipped 7 lines
    201 201   align: 'left',
    202 202   colors: [],
    203 203   background: 'transparent',
    204  - letterSpacing: 1,
     204 + letterSpacing: 0,
    205 205   lineHeight: 1,
    206 206   space: true,
    207 207   maxLength: 555,
    skipped 7 lines
    215 215   align: 'left',
    216 216   colors: [],
    217 217   background: 'transparent',
    218  - letterSpacing: 1,
     218 + letterSpacing: 0,
    219 219   lineHeight: 1,
    220 220   space: true,
    221 221   maxLength: 0,
    skipped 7 lines
    229 229   align: 'left',
    230 230   colors: [],
    231 231   background: 'transparent',
    232  - letterSpacing: 1,
     232 + letterSpacing: 0,
    233 233   lineHeight: 1,
    234 234   space: true,
    235 235   maxLength: 0,
    skipped 7 lines
    243 243   align: 'left',
    244 244   colors: [],
    245 245   background: 'transparent',
    246  - letterSpacing: 1,
     246 + letterSpacing: 0,
    247 247   lineHeight: 1,
    248 248   space: true,
    249 249   maxLength: 0,
    skipped 7 lines
    257 257   align: 'left',
    258 258   colors: [],
    259 259   background: 'transparent',
    260  - letterSpacing: 1,
     260 + letterSpacing: 0,
    261 261   lineHeight: 1,
    262 262   space: true,
    263 263   maxLength: 0,
    skipped 6 lines
  • ■ ■ ■ ■ ■ ■
    test/unit/ParseArgs.spec.js
    skipped 47 lines
    48 48   "independent-gradient": false,
    49 49   "transition-gradient": false,
    50 50   "help": false,
    51  - "letter-spacing": 1,
    52  - "line-height": 1,
     51 + "letter-spacing": undefined,
     52 + "line-height": undefined,
    53 53   "max-length": 0,
    54 54   "spaceless": false,
    55 55   "text": undefined,
    skipped 161 lines
  • ■ ■ ■ ■ ■ ■
    test/unit/RenderConsole.spec.js
    skipped 12 lines
    13 13   const test = RenderConsole( 'test', {
    14 14   align: 'left',
    15 15   colors: [],
    16  - letterSpacing: 1,
    17  - lineHeight: 1,
     16 + letterSpacing: 0,
     17 + lineHeight: 0,
    18 18   }, { width: 100, height: 10 } );
    19 19   
    20 20   expect( test.output ).toEqual( ['test'] );
    skipped 5 lines
    26 26   const test = RenderConsole( 'x', {
    27 27   align: 'left',
    28 28   colors: [],
    29  - letterSpacing: 1,
    30  - lineHeight: 1,
     29 + letterSpacing: 0,
     30 + lineHeight: 0,
    31 31   });
    32 32   
    33 33   expect( test.output ).toEqual( ['x'] );
    skipped 5 lines
    39 39   const test = RenderConsole( 'test|test', {
    40 40   align: 'left',
    41 41   colors: [],
    42  - letterSpacing: 1,
    43  - lineHeight: 1,
     42 + letterSpacing: 0,
     43 + lineHeight: 0,
    44 44   }, { width: 100, height: 10 } );
    45 45   
    46 46   expect( test.output ).toEqual( ['test', 'test'] );
    skipped 5 lines
    52 52   const test = RenderConsole( 'this is a very long line to test multi lines', {
    53 53   align: 'left',
    54 54   colors: [],
    55  - letterSpacing: 1,
    56  - lineHeight: 1,
     55 + letterSpacing: 0,
     56 + lineHeight: 0,
    57 57   }, { width: 10, height: 10 } );
    58 58   
    59  - expect( test.output ).toEqual( ['this is a', 'very long', 'line to te', 'st multi l', 'ines'] );
     59 + expect( test.output ).toEqual( ['this is a ', 'very long ', 'line to te', 'st multi l', 'ines'] );
    60 60   expect( test.lines ).toEqual( 5 );
    61 61  });
    62 62   
    skipped 2 lines
    65 65   const test = RenderConsole( 'center', {
    66 66   align: 'center',
    67 67   colors: [],
    68  - letterSpacing: 1,
    69  - lineHeight: 1,
     68 + letterSpacing: 0,
     69 + lineHeight: 0,
    70 70   }, { width: 10, height: 10 } );
    71 71   
    72 72   expect( test.output ).toEqual( [' center'] );
    skipped 5 lines
    78 78   const test = RenderConsole( 'right', {
    79 79   align: 'right',
    80 80   colors: [],
    81  - letterSpacing: 1,
    82  - lineHeight: 1,
     81 + letterSpacing: 0,
     82 + lineHeight: 0,
    83 83   }, { width: 10, height: 10 } );
    84 84   
    85 85   expect( test.output ).toEqual( [' right'] );
    skipped 6 lines
    92 92   align: 'left',
    93 93   colors: [],
    94 94   letterSpacing: 2,
    95  - lineHeight: 1,
     95 + lineHeight: 0,
    96 96   }, { width: 10, height: 10 } );
    97 97   
    98  - expect( test1.output ).toEqual( ['t e x t'] );
     98 + expect( test1.output ).toEqual( ['t e x t'] );
    99 99   expect( test1.lines ).toEqual( 1 );
    100 100   
    101 101   const test2 = RenderConsole( 'text', {
    102 102   align: 'left',
    103 103   colors: [],
    104 104   letterSpacing: 3,
    105  - lineHeight: 1,
     105 + lineHeight: 0,
    106 106   }, { width: 100, height: 10 } );
    107 107   
    108  - expect( test2.output ).toEqual( ['t e x t'] );
     108 + expect( test2.output ).toEqual( ['t e x t'] );
    109 109   expect( test2.lines ).toEqual( 1 );
    110 110   
    111 111   const test3 = RenderConsole( 'text', {
    112 112   align: 'left',
    113 113   colors: [],
    114 114   letterSpacing: 10,
    115  - lineHeight: 1,
     115 + lineHeight: 0,
    116 116   }, { width: 100, height: 10 } );
    117 117   
    118  - expect( test3.output ).toEqual( ['t e x t'] );
     118 + expect( test3.output ).toEqual( ['t e x t'] );
    119 119   expect( test3.lines ).toEqual( 1 );
    120 120  });
    121 121   
    skipped 3 lines
    125 125   align: 'left',
    126 126   colors: [],
    127 127   letterSpacing: 2,
    128  - lineHeight: 1,
     128 + lineHeight: 0,
    129 129   }, { width: 10, height: 10 } );
    130 130   
    131  - expect( test1.output ).toEqual( ['t e x t', 't e x t'] );
     131 + expect( test1.output ).toEqual( ['t e x t', 't e x t'] );
    132 132   expect( test1.lines ).toEqual( 2 );
    133 133   
    134 134   const test2 = RenderConsole( 'text|text', {
    135 135   align: 'left',
    136 136   colors: [],
    137 137   letterSpacing: 3,
    138  - lineHeight: 1,
     138 + lineHeight: 0,
    139 139   }, { width: 100, height: 10 } );
    140 140   
    141  - expect( test2.output ).toEqual( ['t e x t', 't e x t'] );
     141 + expect( test2.output ).toEqual( ['t e x t', 't e x t'] );
    142 142   expect( test2.lines ).toEqual( 2 );
    143 143   
    144 144   const test3 = RenderConsole( 'text|text', {
    145 145   align: 'left',
    146 146   colors: [],
    147 147   letterSpacing: 10,
    148  - lineHeight: 1,
     148 + lineHeight: 0,
    149 149   }, { width: 100, height: 10 } );
    150 150   
    151  - expect( test3.output ).toEqual( ['t e x t', 't e x t'] );
     151 + expect( test3.output ).toEqual( ['t e x t', 't e x t'] );
    152 152   expect( test3.lines ).toEqual( 2 );
    153 153  });
    154 154   
    skipped 2 lines
    157 157   const test1 = RenderConsole( 'text', {
    158 158   align: 'left',
    159 159   colors: [],
    160  - letterSpacing: 1,
    161  - lineHeight: 2,
     160 + letterSpacing: 0,
     161 + lineHeight: 1,
    162 162   }, { width: 100, height: 10 } );
    163 163   
    164  - expect( test1.output ).toEqual( ['text', ''] );
    165  - expect( test1.lines ).toEqual( 2 );
     164 + expect( test1.output ).toEqual( ['text'] );
     165 + expect( test1.lines ).toEqual( 1 );
    166 166   
    167  - const test2 = RenderConsole( 'text', {
     167 + const test2 = RenderConsole( 'text|text', {
    168 168   align: 'left',
    169 169   colors: [],
    170  - letterSpacing: 1,
     170 + letterSpacing: 0,
    171 171   lineHeight: 3,
    172 172   }, { width: 100, height: 10 } );
    173 173   
    174  - expect( test2.output ).toEqual( ['text', '', ''] );
    175  - expect( test2.lines ).toEqual( 3 );
     174 + expect( test2.output ).toEqual( ['text', '', '', '','text'] );
     175 + expect( test2.lines ).toEqual( 2 );
    176 176   
    177  - const test3 = RenderConsole( 'text', {
     177 + const test3 = RenderConsole( 'text|text', {
    178 178   align: 'left',
    179 179   colors: [],
    180  - letterSpacing: 1,
     180 + letterSpacing: 0,
    181 181   lineHeight: 10,
    182 182   }, { width: 100, height: 10 } );
    183 183   
    184  - expect( test3.output ).toEqual( ['text', '', '', '', '', '', '', '', '', ''] );
    185  - expect( test3.lines ).toEqual( 10 );
     184 + expect( test3.output ).toEqual( ['text', '', '', '', '', '', '', '', '', '', '', 'text'] );
     185 + expect( test3.lines ).toEqual( 2 );
    186 186  });
    187 187   
    188 188   
    skipped 1 lines
    190 190   const test1 = RenderConsole( 'text|text|text', {
    191 191   align: 'left',
    192 192   colors: [],
    193  - letterSpacing: 1,
     193 + letterSpacing: 0,
    194 194   lineHeight: 2,
    195 195   }, { width: 100, height: 10 } );
    196 196   
    197  - expect( test1.output ).toEqual( ['text', '', 'text', '', 'text', ''] );
    198  - expect( test1.lines ).toEqual( 6 );
     197 + expect( test1.output ).toEqual( ['text', '', '', 'text', '', '', 'text'] );
     198 + expect( test1.lines ).toEqual( 3 );
    199 199   
    200 200   const test2 = RenderConsole( 'text|text|text', {
    201 201   align: 'left',
    202 202   colors: [],
    203  - letterSpacing: 1,
     203 + letterSpacing: 0,
    204 204   lineHeight: 3,
    205 205   }, { width: 100, height: 10 } );
    206 206   
    207  - expect( test2.output ).toEqual( ['text', '', '', 'text', '', '', 'text', '', ''] );
    208  - expect( test2.lines ).toEqual( 9 );
     207 + expect( test2.output ).toEqual( ['text', '', '', '', 'text', '', '', '', 'text'] );
     208 + expect( test2.lines ).toEqual( 3 );
    209 209   
    210 210   const test3 = RenderConsole( 'text|text|text', {
    211 211   align: 'left',
    212 212   colors: [],
    213  - letterSpacing: 1,
     213 + letterSpacing: 0,
    214 214   lineHeight: 10,
    215 215   }, { width: 100, height: 10 } );
    216 216   
    217 217   expect( test3.output ).toEqual([
    218  - 'text', '', '', '', '', '', '', '', '', '',
    219  - 'text', '', '', '', '', '', '', '', '', '',
    220  - 'text', '', '', '', '', '', '', '', '', '',
     218 + 'text',
     219 + '', '', '', '', '', '', '', '', '', '',
     220 + 'text',
     221 + '', '', '', '', '', '', '', '', '', '',
     222 + 'text',
    221 223   ]);
    222  - expect( test3.lines ).toEqual( 30 );
     224 + expect( test3.lines ).toEqual( 3 );
    223 225  });
    224 226   
    225 227   
    skipped 1 lines
    227 229   const test1 = RenderConsole( 'this is a long line', {
    228 230   align: 'left',
    229 231   colors: [],
    230  - letterSpacing: 1,
     232 + letterSpacing: 0,
    231 233   lineHeight: 2,
    232 234   }, { width: 10, height: 10 } );
    233 235   
    234  - expect( test1.output ).toEqual( ['this is a', '', 'long line', ''] );
    235  - expect( test1.lines ).toEqual( 4 );
     236 + expect( test1.output ).toEqual( ['this is a ', '', '', 'long line'] );
     237 + expect( test1.lines ).toEqual( 2 );
    236 238   
    237 239   const test2 = RenderConsole( 'this is a long line', {
    238 240   align: 'left',
    239 241   colors: [],
    240  - letterSpacing: 1,
     242 + letterSpacing: 0,
    241 243   lineHeight: 3,
    242 244   }, { width: 10, height: 10 } );
    243 245   
    244  - expect( test2.output ).toEqual( ['this is a', '', '', 'long line', '', ''] );
    245  - expect( test2.lines ).toEqual( 6 );
     246 + expect( test2.output ).toEqual( ['this is a ', '', '', '', 'long line'] );
     247 + expect( test2.lines ).toEqual( 2 );
    246 248   
    247 249   const test3 = RenderConsole( 'this is a long line', {
    248 250   align: 'left',
    249 251   colors: [],
    250  - letterSpacing: 1,
     252 + letterSpacing: 0,
    251 253   lineHeight: 10,
    252 254   }, { width: 10, height: 10 } );
    253 255   
    254 256   expect( test3.output ).toEqual([
    255  - 'this is a', '', '', '', '', '', '', '', '', '',
    256  - 'long line', '', '', '', '', '', '', '', '', '',
     257 + 'this is a ',
     258 + '', '', '', '', '', '', '', '', '', '',
     259 + 'long line',
    257 260   ]);
    258  - expect( test3.lines ).toEqual( 20 );
     261 + expect( test3.lines ).toEqual( 2 );
    259 262  });
    260 263   
    261 264   
    skipped 1 lines
    263 266   const test = RenderConsole( 'test', {
    264 267   align: 'left',
    265 268   colors: ['red'],
    266  - letterSpacing: 1,
    267  - lineHeight: 1,
     269 + letterSpacing: 0,
     270 + lineHeight: 0,
    268 271   }, { width: 100, height: 10 } );
    269 272   
    270 273   expect( test.output ).toEqual( ['\u001b[38;2;255;0;0mtest\u001b[39m'] );
    skipped 5 lines
    276 279   const test = RenderConsole( 'test', {
    277 280   align: 'left',
    278 281   colors: ['candy'],
    279  - letterSpacing: 1,
    280  - lineHeight: 1,
     282 + letterSpacing: 0,
     283 + lineHeight: 0,
    281 284   }, { width: 100, height: 10 } );
    282 285   
    283 286   expect( StripColor( test.output[ 0 ] ) ).toEqual( 'test' );
    skipped 1 lines
    285 288   expect( test.lines ).toEqual( 1 );
    286 289  });
    287 290   
     291 + 
     292 +test(`RenderConsole - Should respect small window size`, () => {
     293 + const test = RenderConsole( 'testing long test', {
     294 + align: 'left',
     295 + colors: [],
     296 + letterSpacing: 0,
     297 + lineHeight: 0,
     298 + maxLength: 8,
     299 + }, { width: 7, height: 10 } );
     300 + 
     301 + expect( test.output ).toEqual([ 'testing', ' long t', 'est' ]);
     302 + expect( test.lines ).toEqual( 3 );
     303 +});
     304 + 
     305 + 
     306 +test(`RenderConsole - Should respect small maxLength over window size`, () => {
     307 + const test = RenderConsole( 'testing long test', {
     308 + align: 'left',
     309 + colors: [],
     310 + letterSpacing: 0,
     311 + lineHeight: 0,
     312 + maxLength: 5,
     313 + }, { width: 7, height: 10 } );
     314 + 
     315 + expect( test.output ).toEqual([ 'testi', 'ng lo', 'ng te', 'st' ]);
     316 + expect( test.lines ).toEqual( 4 );
     317 +});
     318 + 
  • ■ ■ ■ ■ ■ ■
    test/unit/bin.spec.js
    skipped 13 lines
    14 14   jest.resetModules();
    15 15  });
    16 16   
     17 + 
    17 18  test(`Bin - Should call Cli function`, () => {
    18 19   jest.doMock('../../lib/index.js', () => ({ Cli: jest.fn() }) );
    19 20   const Cfonts = require('../../lib/index.js');
    skipped 2 lines
    22 23   
    23 24   expect( Cfonts.Cli.mock.calls.length ).toBe( 1 );
    24 25  });
     26 + 
    25 27   
    26 28  test(`Bin - Will output with no flags`, () => {
    27 29   const output = Spawn(
    skipped 91 lines
    119 121   expect( output.stderr ).toBe( '' );
    120 122  });
    121 123   
     124 + 
     125 +test(`Bin - Will run all non-gradient flags with console`, () => {
     126 + const output = Spawn(
     127 + 'node',
     128 + [
     129 + path.normalize(`${__dirname }/../../src/bin.js`),
     130 + 'abc|xxx',
     131 + '-f', 'console',
     132 + '-a', 'right',
     133 + '-c', 'red',
     134 + '-b', 'white',
     135 + '-l', '3',
     136 + '-z', '4',
     137 + '-s',
     138 + '-m', '80',
     139 + ],
     140 + {
     141 + encoding : 'utf8',
     142 + env: { ...process.env },
     143 + }
     144 + );
     145 + 
     146 + const expected = '' +
     147 + '\u001b[48;2;255;255;255m\n' +
     148 + ' ' +
     149 + '\u001b[38;2;255;0;0ma b c\u001b[39m\n' +
     150 + '\n\n\n\n' +
     151 + ' ' +
     152 + '\u001b[38;2;255;0;0mx x x\u001b[39m\u001b[49m\n';
     153 + 
     154 + expect( output.stdout ).toBe( expected );
     155 + expect( output.stderr ).toBe('');
     156 +});
     157 + 
     158 + 
     159 +test(`Bin - Will run all flags and gradient with console`, () => {
     160 + const output = Spawn(
     161 + 'node',
     162 + [
     163 + path.normalize(`${__dirname }/../../src/bin.js`),
     164 + 'abc|xxx',
     165 + '-f', 'console',
     166 + '-a', 'right',
     167 + '-g', 'red,blue',
     168 + '-b', 'white',
     169 + '-l', '3',
     170 + '-z', '4',
     171 + '-s',
     172 + '-m', '80',
     173 + ],
     174 + {
     175 + encoding : 'utf8',
     176 + env: { ...process.env },
     177 + }
     178 + );
     179 + 
     180 + const expected = '' +
     181 + '\u001b[48;2;255;255;255m\n' +
     182 + ' ' +
     183 + '\u001b[38;2;255;0;0ma\u001b[39m\u001b[38;2;255;127;0m \u001b[39m\u001b[38;2;255;254;0m \u001b[39m\u001b[38;2;127;255;0m \u001b[39m\u001b[38;2;0;255;0mb\u001b[39m\u001b[38;2;0;255;127m \u001b[39m\u001b[38;2;0;255;255m \u001b[39m\u001b[38;2;0;127;255m \u001b[39m\u001b[38;2;0;0;255mc\u001b[39m\n' +
     184 + '\n\n\n\n' +
     185 + ' ' +
     186 + '\u001b[38;2;255;0;0mx\u001b[39m\u001b[38;2;255;127;0m \u001b[39m\u001b[38;2;255;254;0m \u001b[39m\u001b[38;2;127;255;0m \u001b[39m\u001b[38;2;0;255;0mx\u001b[39m\u001b[38;2;0;255;127m \u001b[39m\u001b[38;2;0;255;255m \u001b[39m\u001b[38;2;0;127;255m \u001b[39m\u001b[38;2;0;0;255mx\u001b[39m\u001b[49m\n';
     187 + 
     188 + expect( output.stdout ).toBe( expected );
     189 + expect( output.stderr ).toBe('');
     190 +});
     191 + 
     192 + 
     193 +test(`Bin - Will run all flags, gradient and i flag with console`, () => {
     194 + const output = Spawn(
     195 + 'node',
     196 + [
     197 + path.normalize(`${__dirname }/../../src/bin.js`),
     198 + 'abc|xx',
     199 + '-f', 'console',
     200 + '-a', 'right',
     201 + '-g', 'red,blue',
     202 + '-i',
     203 + '-b', 'white',
     204 + '-l', '3',
     205 + '-z', '4',
     206 + '-s',
     207 + '-m', '80',
     208 + ],
     209 + {
     210 + encoding : 'utf8',
     211 + env: { ...process.env },
     212 + }
     213 + );
     214 + 
     215 + const expected = '' +
     216 + '\u001b[48;2;255;255;255m\n' +
     217 + ' \u001b[38;2;255;0;0ma\u001b[39m\u001b[38;2;255;127;0m \u001b[39m\u001b[38;2;255;254;0m \u001b[39m\u001b[38;2;127;255;0m \u001b[39m\u001b[38;2;0;255;0mb\u001b[39m\u001b[38;2;0;255;127m \u001b[39m\u001b[38;2;0;255;255m \u001b[39m\u001b[38;2;0;127;255m \u001b[39m\u001b[38;2;0;0;255mc\u001b[39m\n' +
     218 + '\n\n\n\n' +
     219 + ' ' +
     220 + '\u001b[38;2;255;0;0mx\u001b[39m\u001b[38;2;255;254;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\u001b[38;2;0;255;255m \u001b[39m\u001b[38;2;0;0;255mx\u001b[39m\u001b[49m\n';
     221 + 
     222 + expect( output.stdout ).toBe( expected );
     223 + expect( output.stderr ).toBe('');
     224 +});
     225 + 
     226 + 
     227 +test(`Bin - Will run all flags, gradient, i flag and transition with console`, () => {
     228 + const output = Spawn(
     229 + 'node',
     230 + [
     231 + path.normalize(`${__dirname }/../../src/bin.js`),
     232 + 'abc|xx',
     233 + '-f', 'console',
     234 + '-a', 'right',
     235 + '-g', 'red,blue',
     236 + '-i',
     237 + '-t',
     238 + '-b', 'white',
     239 + '-l', '3',
     240 + '-z', '4',
     241 + '-s',
     242 + '-m', '80',
     243 + ],
     244 + {
     245 + encoding : 'utf8',
     246 + env: { ...process.env },
     247 + }
     248 + );
     249 + 
     250 + const expected = '' +
     251 + '\u001b[48;2;255;255;255m\n' +
     252 + ' \u001b[38;2;255;0;0ma\u001b[39m\u001b[38;2;223;0;31m \u001b[39m\u001b[38;2;191;0;63m \u001b[39m\u001b[38;2;159;0;95m \u001b[39m\u001b[38;2;127;0;127mb\u001b[39m\u001b[38;2;95;0;159m \u001b[39m\u001b[38;2;63;0;191m \u001b[39m\u001b[38;2;31;0;223m \u001b[39m\u001b[38;2;0;0;255mc\u001b[39m\n' +
     253 + '\n\n\n\n' +
     254 + ' ' +
     255 + '\u001b[38;2;255;0;0mx\u001b[39m\u001b[38;2;191;0;63m \u001b[39m\u001b[38;2;127;0;127m \u001b[39m\u001b[38;2;63;0;191m \u001b[39m\u001b[38;2;0;0;255mx\u001b[39m\u001b[49m\n';
     256 + 
     257 + expect( output.stdout ).toBe( expected );
     258 + expect( output.stderr ).toBe('');
     259 +});
     260 + 
     261 + 
     262 +test(`Bin - Will run all non-gradient flags with chrome font`, () => {
     263 + const output = Spawn(
     264 + 'node',
     265 + [
     266 + path.normalize(`${__dirname }/../../src/bin.js`),
     267 + 'abc|aa',
     268 + '-f', 'chrome',
     269 + '-a', 'right',
     270 + '-c', 'blue,green,yellow',
     271 + '-b', 'red',
     272 + '-l', '4',
     273 + '-z', '3',
     274 + '-s',
     275 + '-m', '80',
     276 + ],
     277 + {
     278 + encoding : 'utf8',
     279 + env: { ...process.env },
     280 + }
     281 + );
     282 + 
     283 + const expected = '\u001b[48;2;255;0;0m\n \u001b[38;2;0;0;255m╔═╗\u001b[39m \u001b[38;2;0;0;255m╔╗ \u001b[39m \u001b[38;2;0;0;255m╔═╗\u001b[39m \n \u001b[38;2;0;128;0m╠═╣\u001b[39m \u001b[38;2;0;128;0m╠╩╗\u001b[39m \u001b[38;2;0;128;0m║ \u001b[39m \n \u001b[38;2;255;255;0m╩ ╩\u001b[39m \u001b[38;2;255;255;0m╚═╝\u001b[39m \u001b[38;2;255;255;0m╚═╝\u001b[39m \n\n\n\n \u001b[38;2;0;0;255m╔═╗\u001b[39m \u001b[38;2;0;0;255m╔═╗\u001b[39m \n \u001b[38;2;0;128;0m╠═╣\u001b[39m \u001b[38;2;0;128;0m╠═╣\u001b[39m \n \u001b[38;2;255;255;0m╩ ╩\u001b[39m \u001b[38;2;255;255;0m╩ ╩\u001b[39m \u001b[49m\n';
     284 + 
     285 + expect( output.stdout ).toBe( expected );
     286 + expect( output.stderr ).toBe('');
     287 +});
     288 + 
     289 + 
     290 +test(`Bin - Will run all flags and gradient with chrome font`, () => {
     291 + const output = Spawn(
     292 + 'node',
     293 + [
     294 + path.normalize(`${__dirname }/../../src/bin.js`),
     295 + 'abc|aa',
     296 + '-f', 'chrome',
     297 + '-a', 'right',
     298 + '-g', 'blue,green',
     299 + '-b', 'red',
     300 + '-l', '4',
     301 + '-z', '3',
     302 + '-s',
     303 + '-m', '80',
     304 + ],
     305 + {
     306 + encoding : 'utf8',
     307 + env: { ...process.env },
     308 + }
     309 + );
     310 + 
     311 + const expected = '\u001b[48;2;255;0;0m\n \u001b[38;2;0;0;255m╔\u001b[39m\u001b[38;2;51;0;255m═\u001b[39m\u001b[38;2;102;0;255m╗\u001b[39m\u001b[38;2;152;0;255m \u001b[39m\u001b[38;2;203;0;255m \u001b[39m\u001b[38;2;254;0;255m \u001b[39m\u001b[38;2;255;0;203m \u001b[39m\u001b[38;2;255;0;152m╔\u001b[39m\u001b[38;2;255;0;102m╗\u001b[39m\u001b[38;2;255;0;51m \u001b[39m\u001b[38;2;255;0;0m \u001b[39m\u001b[38;2;255;50;0m \u001b[39m\u001b[38;2;255;101;0m \u001b[39m\u001b[38;2;255;153;0m \u001b[39m\u001b[38;2;255;203;0m╔\u001b[39m\u001b[38;2;254;255;0m═\u001b[39m\u001b[38;2;204;255;0m╗\u001b[39m\u001b[38;2;153;255;0m \u001b[39m\u001b[38;2;101;255;0m \u001b[39m\u001b[38;2;50;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╠\u001b[39m\u001b[38;2;51;0;255m═\u001b[39m\u001b[38;2;102;0;255m╣\u001b[39m\u001b[38;2;152;0;255m \u001b[39m\u001b[38;2;203;0;255m \u001b[39m\u001b[38;2;254;0;255m \u001b[39m\u001b[38;2;255;0;203m \u001b[39m\u001b[38;2;255;0;152m╠\u001b[39m\u001b[38;2;255;0;102m╩\u001b[39m\u001b[38;2;255;0;51m╗\u001b[39m\u001b[38;2;255;0;0m \u001b[39m\u001b[38;2;255;50;0m \u001b[39m\u001b[38;2;255;101;0m \u001b[39m\u001b[38;2;255;153;0m \u001b[39m\u001b[38;2;255;203;0m║\u001b[39m\u001b[38;2;254;255;0m \u001b[39m\u001b[38;2;204;255;0m \u001b[39m\u001b[38;2;153;255;0m \u001b[39m\u001b[38;2;101;255;0m \u001b[39m\u001b[38;2;50;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╩\u001b[39m\u001b[38;2;51;0;255m \u001b[39m\u001b[38;2;102;0;255m╩\u001b[39m\u001b[38;2;152;0;255m \u001b[39m\u001b[38;2;203;0;255m \u001b[39m\u001b[38;2;254;0;255m \u001b[39m\u001b[38;2;255;0;203m \u001b[39m\u001b[38;2;255;0;152m╚\u001b[39m\u001b[38;2;255;0;102m═\u001b[39m\u001b[38;2;255;0;51m╝\u001b[39m\u001b[38;2;255;0;0m \u001b[39m\u001b[38;2;255;50;0m \u001b[39m\u001b[38;2;255;101;0m \u001b[39m\u001b[38;2;255;153;0m \u001b[39m\u001b[38;2;255;203;0m╚\u001b[39m\u001b[38;2;254;255;0m═\u001b[39m\u001b[38;2;204;255;0m╝\u001b[39m\u001b[38;2;153;255;0m \u001b[39m\u001b[38;2;101;255;0m \u001b[39m\u001b[38;2;50;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n\n\n\n \u001b[38;2;0;0;255m \u001b[39m\u001b[38;2;51;0;255m \u001b[39m\u001b[38;2;102;0;255m \u001b[39m\u001b[38;2;152;0;255m \u001b[39m\u001b[38;2;203;0;255m \u001b[39m\u001b[38;2;254;0;255m \u001b[39m\u001b[38;2;255;0;203m \u001b[39m\u001b[38;2;255;0;152m╔\u001b[39m\u001b[38;2;255;0;102m═\u001b[39m\u001b[38;2;255;0;51m╗\u001b[39m\u001b[38;2;255;0;0m \u001b[39m\u001b[38;2;255;50;0m \u001b[39m\u001b[38;2;255;101;0m \u001b[39m\u001b[38;2;255;153;0m \u001b[39m\u001b[38;2;255;203;0m╔\u001b[39m\u001b[38;2;254;255;0m═\u001b[39m\u001b[38;2;204;255;0m╗\u001b[39m\u001b[38;2;153;255;0m \u001b[39m\u001b[38;2;101;255;0m \u001b[39m\u001b[38;2;50;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m \u001b[39m\u001b[38;2;51;0;255m \u001b[39m\u001b[38;2;102;0;255m \u001b[39m\u001b[38;2;152;0;255m \u001b[39m\u001b[38;2;203;0;255m \u001b[39m\u001b[38;2;254;0;255m \u001b[39m\u001b[38;2;255;0;203m \u001b[39m\u001b[38;2;255;0;152m╠\u001b[39m\u001b[38;2;255;0;102m═\u001b[39m\u001b[38;2;255;0;51m╣\u001b[39m\u001b[38;2;255;0;0m \u001b[39m\u001b[38;2;255;50;0m \u001b[39m\u001b[38;2;255;101;0m \u001b[39m\u001b[38;2;255;153;0m \u001b[39m\u001b[38;2;255;203;0m╠\u001b[39m\u001b[38;2;254;255;0m═\u001b[39m\u001b[38;2;204;255;0m╣\u001b[39m\u001b[38;2;153;255;0m \u001b[39m\u001b[38;2;101;255;0m \u001b[39m\u001b[38;2;50;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m \u001b[39m\u001b[38;2;51;0;255m \u001b[39m\u001b[38;2;102;0;255m \u001b[39m\u001b[38;2;152;0;255m \u001b[39m\u001b[38;2;203;0;255m \u001b[39m\u001b[38;2;254;0;255m \u001b[39m\u001b[38;2;255;0;203m \u001b[39m\u001b[38;2;255;0;152m╩\u001b[39m\u001b[38;2;255;0;102m \u001b[39m\u001b[38;2;255;0;51m╩\u001b[39m\u001b[38;2;255;0;0m \u001b[39m\u001b[38;2;255;50;0m \u001b[39m\u001b[38;2;255;101;0m \u001b[39m\u001b[38;2;255;153;0m \u001b[39m\u001b[38;2;255;203;0m╩\u001b[39m\u001b[38;2;254;255;0m \u001b[39m\u001b[38;2;204;255;0m╩\u001b[39m\u001b[38;2;153;255;0m \u001b[39m\u001b[38;2;101;255;0m \u001b[39m\u001b[38;2;50;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\u001b[49m\n';
     312 + 
     313 + expect( output.stdout ).toBe( expected );
     314 + expect( output.stderr ).toBe('');
     315 +});
     316 + 
     317 + 
     318 +test(`Bin - Will run all flags, gradient and i flag with chrome font`, () => {
     319 + const output = Spawn(
     320 + 'node',
     321 + [
     322 + path.normalize(`${__dirname }/../../src/bin.js`),
     323 + 'abc|aa',
     324 + '-f', 'chrome',
     325 + '-a', 'right',
     326 + '-g', 'blue,green',
     327 + '-i',
     328 + '-b', 'red',
     329 + '-l', '4',
     330 + '-z', '3',
     331 + '-s',
     332 + '-m', '80',
     333 + ],
     334 + {
     335 + encoding : 'utf8',
     336 + env: { ...process.env },
     337 + }
     338 + );
     339 + 
     340 + const expected = '\u001b[48;2;255;0;0m\n \u001b[38;2;0;0;255m╔\u001b[39m\u001b[38;2;51;0;255m═\u001b[39m\u001b[38;2;102;0;255m╗\u001b[39m\u001b[38;2;152;0;255m \u001b[39m\u001b[38;2;203;0;255m \u001b[39m\u001b[38;2;254;0;255m \u001b[39m\u001b[38;2;255;0;203m \u001b[39m\u001b[38;2;255;0;152m╔\u001b[39m\u001b[38;2;255;0;102m╗\u001b[39m\u001b[38;2;255;0;51m \u001b[39m\u001b[38;2;255;0;0m \u001b[39m\u001b[38;2;255;50;0m \u001b[39m\u001b[38;2;255;101;0m \u001b[39m\u001b[38;2;255;153;0m \u001b[39m\u001b[38;2;255;203;0m╔\u001b[39m\u001b[38;2;254;255;0m═\u001b[39m\u001b[38;2;204;255;0m╗\u001b[39m\u001b[38;2;153;255;0m \u001b[39m\u001b[38;2;101;255;0m \u001b[39m\u001b[38;2;50;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╠\u001b[39m\u001b[38;2;51;0;255m═\u001b[39m\u001b[38;2;102;0;255m╣\u001b[39m\u001b[38;2;152;0;255m \u001b[39m\u001b[38;2;203;0;255m \u001b[39m\u001b[38;2;254;0;255m \u001b[39m\u001b[38;2;255;0;203m \u001b[39m\u001b[38;2;255;0;152m╠\u001b[39m\u001b[38;2;255;0;102m╩\u001b[39m\u001b[38;2;255;0;51m╗\u001b[39m\u001b[38;2;255;0;0m \u001b[39m\u001b[38;2;255;50;0m \u001b[39m\u001b[38;2;255;101;0m \u001b[39m\u001b[38;2;255;153;0m \u001b[39m\u001b[38;2;255;203;0m║\u001b[39m\u001b[38;2;254;255;0m \u001b[39m\u001b[38;2;204;255;0m \u001b[39m\u001b[38;2;153;255;0m \u001b[39m\u001b[38;2;101;255;0m \u001b[39m\u001b[38;2;50;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╩\u001b[39m\u001b[38;2;51;0;255m \u001b[39m\u001b[38;2;102;0;255m╩\u001b[39m\u001b[38;2;152;0;255m \u001b[39m\u001b[38;2;203;0;255m \u001b[39m\u001b[38;2;254;0;255m \u001b[39m\u001b[38;2;255;0;203m \u001b[39m\u001b[38;2;255;0;152m╚\u001b[39m\u001b[38;2;255;0;102m═\u001b[39m\u001b[38;2;255;0;51m╝\u001b[39m\u001b[38;2;255;0;0m \u001b[39m\u001b[38;2;255;50;0m \u001b[39m\u001b[38;2;255;101;0m \u001b[39m\u001b[38;2;255;153;0m \u001b[39m\u001b[38;2;255;203;0m╚\u001b[39m\u001b[38;2;254;255;0m═\u001b[39m\u001b[38;2;204;255;0m╝\u001b[39m\u001b[38;2;153;255;0m \u001b[39m\u001b[38;2;101;255;0m \u001b[39m\u001b[38;2;50;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n\n\n\n \u001b[38;2;0;0;255m╔\u001b[39m\u001b[38;2;78;0;255m═\u001b[39m\u001b[38;2;156;0;255m╗\u001b[39m\u001b[38;2;235;0;255m \u001b[39m\u001b[38;2;255;0;196m \u001b[39m\u001b[38;2;255;0;117m \u001b[39m\u001b[38;2;255;0;39m \u001b[39m\u001b[38;2;255;39;0m╔\u001b[39m\u001b[38;2;255;117;0m═\u001b[39m\u001b[38;2;255;196;0m╗\u001b[39m\u001b[38;2;235;255;0m \u001b[39m\u001b[38;2;156;255;0m \u001b[39m\u001b[38;2;78;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╠\u001b[39m\u001b[38;2;78;0;255m═\u001b[39m\u001b[38;2;156;0;255m╣\u001b[39m\u001b[38;2;235;0;255m \u001b[39m\u001b[38;2;255;0;196m \u001b[39m\u001b[38;2;255;0;117m \u001b[39m\u001b[38;2;255;0;39m \u001b[39m\u001b[38;2;255;39;0m╠\u001b[39m\u001b[38;2;255;117;0m═\u001b[39m\u001b[38;2;255;196;0m╣\u001b[39m\u001b[38;2;235;255;0m \u001b[39m\u001b[38;2;156;255;0m \u001b[39m\u001b[38;2;78;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╩\u001b[39m\u001b[38;2;78;0;255m \u001b[39m\u001b[38;2;156;0;255m╩\u001b[39m\u001b[38;2;235;0;255m \u001b[39m\u001b[38;2;255;0;196m \u001b[39m\u001b[38;2;255;0;117m \u001b[39m\u001b[38;2;255;0;39m \u001b[39m\u001b[38;2;255;39;0m╩\u001b[39m\u001b[38;2;255;117;0m \u001b[39m\u001b[38;2;255;196;0m╩\u001b[39m\u001b[38;2;235;255;0m \u001b[39m\u001b[38;2;156;255;0m \u001b[39m\u001b[38;2;78;255;0m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\u001b[49m\n';
     341 + 
     342 + expect( output.stdout ).toBe( expected );
     343 + expect( output.stderr ).toBe('');
     344 +});
     345 + 
     346 + 
     347 +test(`Bin - Will run all flags, gradient, i flag and transition with chrome font`, () => {
     348 + const output = Spawn(
     349 + 'node',
     350 + [
     351 + path.normalize(`${__dirname }/../../src/bin.js`),
     352 + 'abc|aa',
     353 + '-f', 'chrome',
     354 + '-a', 'right',
     355 + '-g', 'blue,green',
     356 + '-i',
     357 + '-t',
     358 + '-b', 'red',
     359 + '-l', '4',
     360 + '-z', '3',
     361 + '-s',
     362 + '-m', '80',
     363 + ],
     364 + {
     365 + encoding : 'utf8',
     366 + env: { ...process.env },
     367 + }
     368 + );
     369 + 
     370 + const expected = '\u001b[48;2;255;0;0m\n \u001b[38;2;0;0;255m╔\u001b[39m\u001b[38;2;0;12;242m═\u001b[39m\u001b[38;2;0;25;229m╗\u001b[39m\u001b[38;2;0;38;216m \u001b[39m\u001b[38;2;0;51;204m \u001b[39m\u001b[38;2;0;63;191m \u001b[39m\u001b[38;2;0;76;178m \u001b[39m\u001b[38;2;0;89;165m╔\u001b[39m\u001b[38;2;0;102;153m╗\u001b[39m\u001b[38;2;0;114;140m \u001b[39m\u001b[38;2;0;127;127m \u001b[39m\u001b[38;2;0;140;114m \u001b[39m\u001b[38;2;0;153;102m \u001b[39m\u001b[38;2;0;165;89m \u001b[39m\u001b[38;2;0;178;76m╔\u001b[39m\u001b[38;2;0;191;63m═\u001b[39m\u001b[38;2;0;204;51m╗\u001b[39m\u001b[38;2;0;216;38m \u001b[39m\u001b[38;2;0;229;25m \u001b[39m\u001b[38;2;0;242;12m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╠\u001b[39m\u001b[38;2;0;12;242m═\u001b[39m\u001b[38;2;0;25;229m╣\u001b[39m\u001b[38;2;0;38;216m \u001b[39m\u001b[38;2;0;51;204m \u001b[39m\u001b[38;2;0;63;191m \u001b[39m\u001b[38;2;0;76;178m \u001b[39m\u001b[38;2;0;89;165m╠\u001b[39m\u001b[38;2;0;102;153m╩\u001b[39m\u001b[38;2;0;114;140m╗\u001b[39m\u001b[38;2;0;127;127m \u001b[39m\u001b[38;2;0;140;114m \u001b[39m\u001b[38;2;0;153;102m \u001b[39m\u001b[38;2;0;165;89m \u001b[39m\u001b[38;2;0;178;76m║\u001b[39m\u001b[38;2;0;191;63m \u001b[39m\u001b[38;2;0;204;51m \u001b[39m\u001b[38;2;0;216;38m \u001b[39m\u001b[38;2;0;229;25m \u001b[39m\u001b[38;2;0;242;12m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╩\u001b[39m\u001b[38;2;0;12;242m \u001b[39m\u001b[38;2;0;25;229m╩\u001b[39m\u001b[38;2;0;38;216m \u001b[39m\u001b[38;2;0;51;204m \u001b[39m\u001b[38;2;0;63;191m \u001b[39m\u001b[38;2;0;76;178m \u001b[39m\u001b[38;2;0;89;165m╚\u001b[39m\u001b[38;2;0;102;153m═\u001b[39m\u001b[38;2;0;114;140m╝\u001b[39m\u001b[38;2;0;127;127m \u001b[39m\u001b[38;2;0;140;114m \u001b[39m\u001b[38;2;0;153;102m \u001b[39m\u001b[38;2;0;165;89m \u001b[39m\u001b[38;2;0;178;76m╚\u001b[39m\u001b[38;2;0;191;63m═\u001b[39m\u001b[38;2;0;204;51m╝\u001b[39m\u001b[38;2;0;216;38m \u001b[39m\u001b[38;2;0;229;25m \u001b[39m\u001b[38;2;0;242;12m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n\n\n\n \u001b[38;2;0;0;255m╔\u001b[39m\u001b[38;2;0;19;235m═\u001b[39m\u001b[38;2;0;39;215m╗\u001b[39m\u001b[38;2;0;58;196m \u001b[39m\u001b[38;2;0;78;176m \u001b[39m\u001b[38;2;0;98;156m \u001b[39m\u001b[38;2;0;117;137m \u001b[39m\u001b[38;2;0;137;117m╔\u001b[39m\u001b[38;2;0;156;98m═\u001b[39m\u001b[38;2;0;176;78m╗\u001b[39m\u001b[38;2;0;196;58m \u001b[39m\u001b[38;2;0;215;39m \u001b[39m\u001b[38;2;0;235;19m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╠\u001b[39m\u001b[38;2;0;19;235m═\u001b[39m\u001b[38;2;0;39;215m╣\u001b[39m\u001b[38;2;0;58;196m \u001b[39m\u001b[38;2;0;78;176m \u001b[39m\u001b[38;2;0;98;156m \u001b[39m\u001b[38;2;0;117;137m \u001b[39m\u001b[38;2;0;137;117m╠\u001b[39m\u001b[38;2;0;156;98m═\u001b[39m\u001b[38;2;0;176;78m╣\u001b[39m\u001b[38;2;0;196;58m \u001b[39m\u001b[38;2;0;215;39m \u001b[39m\u001b[38;2;0;235;19m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\n \u001b[38;2;0;0;255m╩\u001b[39m\u001b[38;2;0;19;235m \u001b[39m\u001b[38;2;0;39;215m╩\u001b[39m\u001b[38;2;0;58;196m \u001b[39m\u001b[38;2;0;78;176m \u001b[39m\u001b[38;2;0;98;156m \u001b[39m\u001b[38;2;0;117;137m \u001b[39m\u001b[38;2;0;137;117m╩\u001b[39m\u001b[38;2;0;156;98m \u001b[39m\u001b[38;2;0;176;78m╩\u001b[39m\u001b[38;2;0;196;58m \u001b[39m\u001b[38;2;0;215;39m \u001b[39m\u001b[38;2;0;235;19m \u001b[39m\u001b[38;2;0;255;0m \u001b[39m\u001b[49m\n';
     371 + 
     372 + expect( output.stdout ).toBe( expected );
     373 + expect( output.stderr ).toBe('');
     374 +});
     375 + 
  • test/unit/fonts.spec.js
    Unable to diff as some line is too long.
Please wait...
Page is in error, reload to recover