Skip to content

Commit c6af2e4

Browse files
committed
fix: remove extra interleaved spaces from assert console.error
1 parent 7c719d1 commit c6af2e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/assert/src/assert.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ function details(template, ...args) {
8989
} else {
9090
argStr = `(${an(typeof arg)})`;
9191
}
92-
interleaved.push(arg, template[i + 1]);
92+
93+
// Remove the extra spaces (since console.error puts them
94+
// between each interleaved).
95+
const priorWithoutSpace = interleaved.pop().replace(/ $/, '');
96+
const nextWithoutSpace = template[i + 1].replace(/^ /, '');
97+
interleaved.push(priorWithoutSpace, arg, nextWithoutSpace);
98+
9399
parts.push(argStr, template[i + 1]);
94100
}
95101
if (args.length >= 1) {

0 commit comments

Comments
 (0)