Skip to content

Commit 029701a

Browse files
benchmark: update to use group
1 parent 1542aa5 commit 029701a

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

benchmark/util/style-text.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ const { styleText } = require('node:util');
66
const assert = require('node:assert');
77

88
const bench = common.createBenchmark(main, {
9-
messageType: ['string', 'number', 'boolean', 'invalid'],
10-
format: ['red', 'italic', 'invalid'],
11-
validateStream: [1, 0],
12-
noColors: ['1', ''],
13-
n: [1e3],
14-
});
9+
withColor: {
10+
messageType: ['string', 'number', 'boolean', 'invalid'],
11+
format: ['red', 'italic', 'invalid'],
12+
validateStream: [1, 0],
13+
noColor: [''],
14+
n: [1e3],
15+
},
16+
withoutColor: {
17+
messageType: ['string', 'number', 'boolean', 'invalid'],
18+
format: ['red', 'italic', 'invalid'],
19+
validateStream: [1, 0],
20+
noColor: ['1'],
21+
n: [1e3],
22+
},
23+
}, { byGroups: true });
1524

16-
function main({ messageType, format, validateStream, noColors, n }) {
25+
function main({ messageType, format, validateStream, noColor, n }) {
1726
let str;
1827
switch (messageType) {
1928
case 'string':
@@ -30,7 +39,7 @@ function main({ messageType, format, validateStream, noColors, n }) {
3039
break;
3140
}
3241

33-
process.env.NO_COLOR = noColors;
42+
process.env.NO_COLOR = noColor;
3443

3544
bench.start();
3645
for (let i = 0; i < n; i++) {

0 commit comments

Comments
 (0)