badgen/bench/index.js

22 wiersze
979 B
JavaScript
Czysty Zwykły widok Historia

2018-06-23 09:54:52 +00:00
const { Suite } = require('benchmark')
const badgen = require('..')
2018-07-20 07:51:00 +00:00
const dockerIcon = require('../test/docker-icon-b64.js')
2018-06-23 09:54:52 +00:00
const longParams = {
subject: 'build-build-build',
status: 'passing-passing-passing'
}
2018-07-19 03:19:09 +00:00
const fullParams = { subject: 'license', status: 'Apache 2.0', color: 'cyan' }
2018-07-19 06:24:52 +00:00
const emojiParams = { subject: 'emojis', status: '💩🤱🦄💩🤱🦄', emoji: true }
2018-07-20 07:51:00 +00:00
const iconParams = { subject: 'docker', status: 'badge', icon: dockerIcon }
2018-06-23 09:59:12 +00:00
new Suite()
2018-07-20 07:51:00 +00:00
.add('[classic] style, long params', () => badgen(longParams))
.add('[classic] style, full params', () => badgen(fullParams))
.add(' [flat] style, long params', () => badgen({ style: 'flat', ...longParams }))
.add(' [flat] style, full params', () => badgen({ style: 'flat', ...fullParams }))
.add('[classic] style, with emoji ', () => badgen(emojiParams))
.add('[classic] style, with icon ', () => badgen(iconParams))
2018-06-23 09:59:12 +00:00
.on('cycle', event => console.log(String(event.target)))
.run()