defunctzombie / zuul

[UNMAINTAINED] multi-framework javascript browser testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multiple arguments to console.log prints duplicates

feross opened this issue · comments

When I write:

console.log(1, 2, 3)

This gets printed:

1 2 3 2 3

This makes the debug module almost unusable.

var debug = require('debug')('simple-peer')
debug(1)

Produces:

simple-peer 1 +0ms 'color: lightseagreen' 'color: inherit' 1 'color: lightseagreen'

This line seems to be the culprit:

for (var i = index; i < args.length; i++) {

When you pass multiple arguments to console.log, this will fail because it iterates through the arguments and concats them to the first argument, effectively duplicating them.

How can we fix this? What is the purpose of this code?

You can fix this by not using tape ;P

Honestly not sure what the purpose of that code is or where I originally got it from. Likely some example from substack, who knows.

I dislike tape because it overloads stdout and doesn't give a great interface to hook into test events. I am open to any suggestions here or improvements since I myself don't use tape.

What do you use instead of tape?

Sent a PR to fix the issue with tape.

I use mocha.

Do I need to fix anything with zuul?

On Sunday, January 18, 2015, Feross Aboukhadijeh notifications@github.com
wrote:

Sent a PR to fix the issue with tape.


Reply to this email directly or view it on GitHub
#127 (comment).

I sent a PR to fix the issue I was seeing with tape. It's here: #128

pushed it out in v1.16.5

On Sun, Jan 18, 2015 at 6:32 PM, Feross Aboukhadijeh <
notifications@github.com> wrote:

I sent a PR to fix the issue I was seeing with tape. It's here: #128
#128


Reply to this email directly or view it on GitHub
#127 (comment).

thanks!

On Sun Jan 18 2015 at 6:55:31 PM Roman Shtylman notifications@github.com
wrote:

pushed it out in v1.16.5

On Sun, Jan 18, 2015 at 6:32 PM, Feross Aboukhadijeh <
notifications@github.com> wrote:

I sent a PR to fix the issue I was seeing with tape. It's here: #128
#128


Reply to this email directly or view it on GitHub
#127 (comment).


Reply to this email directly or view it on GitHub
#127 (comment).