badgen/bench/index.js

22 wiersze
1.2 KiB
JavaScript
Czysty Zwykły widok Historia

2018-06-23 09:54:52 +00:00
const { Suite } = require('benchmark')
2019-10-03 04:08:16 +00:00
const { badgen } = require('..')
2019-08-24 05:47:29 +00:00
const icon = require('../test/assets/icon-data-uri.js')
2018-06-23 09:54:52 +00:00
2018-08-23 02:20:11 +00:00
/* eslint max-len: ["error", { "code": 90 }] */
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-08-24 04:40:11 +00:00
const iconParams = { subject: 'docker', status: 'badge', icon }
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('[classic] style, with emoji ', () => badgen(emojiParams))
.add('[classic] style, with icon ', () => badgen(iconParams))
2018-08-23 02:20:11 +00:00
.add(' [flat] style, long params', () => badgen({ style: 'flat', ...longParams }))
.add(' [flat] style, full params', () => badgen({ style: 'flat', ...fullParams }))
.add(' [flat] style, with emoji ', () => badgen({ style: 'flat', ...emojiParams }))
.add(' [flat] style, with icon ', () => badgen({ style: 'flat', ...iconParams }))
2018-06-23 09:59:12 +00:00
.on('cycle', event => console.log(String(event.target)))
.run()