From 062913b2f201cb3bd40a242a18ae7a4ee2364145 Mon Sep 17 00:00:00 2001 From: Pitchfork-and-Torch Date: Fri, 18 Sep 2026 02:02:26 +0000 Subject: [PATCH] fix: do not let unused printf tokens consume the +ms suffix When colors are enabled, formatArgs pushed the duration as a trailing argument. util.format then substituted that value into any unused %s/%d in the message (issue #967). Append the colored +ms suffix to the format string instead, matching how the non-color path embeds the timestamp. --- src/node.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/node.js b/src/node.js index 715560a4..27141049 100644 --- a/src/node.js +++ b/src/node.js @@ -171,9 +171,11 @@ function formatArgs(args) { const c = this.color; const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); const prefix = ` ${colorCode};1m${name} \u001B[0m`; - - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + // Append the +ms suffix to the format string instead of pushing a trailing + // argument. A separate arg is consumed by unused printf tokens (e.g. lone + // `%s`), which made the duration replace the missing value (#967). + const suffix = ` ${colorCode}m+` + module.exports.humanize(this.diff) + '\u001B[0m'; + args[0] = prefix + args[0].split('\n').join('\n' + prefix) + suffix; } else { args[0] = getDate() + name + ' ' + args[0]; }