chalk/benchmark.js
2018-09-18 14:32:14 +07:00

24 lines
555 B
JavaScript

/* globals suite, set, bench */
'use strict';
const chalk = require('.');
suite('chalk', () => {
set('iterations', 100000);
bench('single style', () => {
chalk.red('the fox jumps over the lazy dog');
});
bench('several styles', () => {
chalk.blue.bgRed.bold('the fox jumps over the lazy dog');
});
const cached = chalk.blue.bgRed.bold;
bench('cached styles', () => {
cached('the fox jumps over the lazy dog');
});
bench('nested styles', () => {
chalk.red('the fox jumps', chalk.underline.bgBlue('over the lazy dog') + '!');
});
});