Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! benchmark: add validateStream to styleText bench
  • Loading branch information
RafaelGSS committed Jan 11, 2025
commit 6580f3fd5dc4b4d9f2d0b94cba3eb0442f7dea81
5 changes: 3 additions & 2 deletions benchmark/util/style-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const common = require('../common.js');

const { styleText } = require('node:util');
const assert = require('node:assert');

const bench = common.createBenchmark(main, {
messageType: ['string', 'number', 'boolean', 'invalid'],
Expand Down Expand Up @@ -30,9 +31,9 @@ function main({ messageType, format, validateStream, n }) {

bench.start();
for (let i = 0; i < n; i++) {
let colored = ''
let colored = '';
try {
colored = util.styleText(format, str, { validateStream });
colored = styleText(format, str, { validateStream });
assert.ok(colored); // Attempt to avoid dead-code elimination
} catch {
// eslint-disable no-empty
Expand Down