2015-08-20 03:05:43 +07:00
|
|
|
/* globals set bench */
|
|
|
|
|
'use strict';
|
2017-06-20 19:18:21 +02:00
|
|
|
const chalk = require('.');
|
2014-07-04 21:21:44 +02:00
|
|
|
|
2017-06-20 19:18:21 +02:00
|
|
|
suite('chalk', () => {
|
2014-07-04 22:32:23 +02:00
|
|
|
set('iterations', 100000);
|
|
|
|
|
|
2017-06-20 19:18:21 +02:00
|
|
|
bench('single style', () => {
|
2014-07-04 21:21:44 +02:00
|
|
|
chalk.red('the fox jumps over the lazy dog');
|
|
|
|
|
});
|
|
|
|
|
|
2017-06-20 19:18:21 +02:00
|
|
|
bench('several styles', () => {
|
2014-07-04 22:29:02 +02:00
|
|
|
chalk.blue.bgRed.bold('the fox jumps over the lazy dog');
|
2014-07-04 21:21:44 +02:00
|
|
|
});
|
|
|
|
|
|
2017-06-20 19:18:21 +02:00
|
|
|
const cached = chalk.blue.bgRed.bold;
|
|
|
|
|
bench('cached styles', () => {
|
2014-07-08 20:43:54 -07:00
|
|
|
cached('the fox jumps over the lazy dog');
|
|
|
|
|
});
|
|
|
|
|
|
2017-06-20 19:18:21 +02:00
|
|
|
bench('nested styles', () => {
|
2014-07-04 22:29:02 +02:00
|
|
|
chalk.red('the fox jumps', chalk.underline.bgBlue('over the lazy dog') + '!');
|
2014-07-04 21:21:44 +02:00
|
|
|
});
|
|
|
|
|
});
|