Skip to content

Commit

Permalink
fix: remove extra interleaved spaces from assert console.error
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Mar 15, 2020
1 parent 7c719d1 commit c6af2e4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/assert/src/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ function details(template, ...args) {
} else {
argStr = `(${an(typeof arg)})`;
}
interleaved.push(arg, template[i + 1]);

// Remove the extra spaces (since console.error puts them
// between each interleaved).
const priorWithoutSpace = interleaved.pop().replace(/ $/, '');
const nextWithoutSpace = template[i + 1].replace(/^ /, '');
interleaved.push(priorWithoutSpace, arg, nextWithoutSpace);

parts.push(argStr, template[i + 1]);
}
if (args.length >= 1) {
Expand Down

0 comments on commit c6af2e4

Please sign in to comment.