You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, many thanks for all your hard work on sinon ;)
Sinon version : v2.0.0
Environment : all ? found in node v4
Example URL : n/a
Other libraries you are using: sinon-chai, chai
What did you expect to happen?
In the spy.printf(format, args...) function,
when using the "%*" formatter, and passing a list of strings as arguments,
I'd expect all the string to be unquoted.
What actually happens
the first string is unquoted,
all the others ones are quoted.
the index masquerade as the processedFlag, resulting in the first string being correctly unquoted (index 0 == false) and all the others being quoted (index>0 == true)
Context
I tried to make the sinon-chai module work with sinon@2.0.0.
I ran the tests for sinon-chai, and the only error is in the format of the expectation messages.
I traked it down to this little bug in sinon.
The text was updated successfully, but these errors were encountered:
…atter.
When used with a list of strings, only the first one is correctly non-quoted :
spy.printf("%*", "a", "b", "c") -> a, "b", "c"
The formatio.ascii function was called with all the arguments provided by map (value, index, collection).
Just added a wrapper in the map() call to forward only the first argument (value).
The unit test shows that the error is a little more serious:
in case the arguments are not simple values, but array/object, formatio throws an exception.
First of all, many thanks for all your hard work on sinon ;)
What did you expect to happen?
In the spy.printf(format, args...) function,
when using the "%*" formatter, and passing a list of strings as arguments,
I'd expect all the string to be unquoted.
What actually happens
the first string is unquoted,
all the others ones are quoted.
How to reproduce
npm install sinon@2.0.0
$ node
The Bug
In lib/sinon/util/core/format.js:
you're calling formatio.ascii with all the arguments of your sinonFormat function.
In lib/sinon/spy-formatters.js
You're calling sinonFormat directly with map.
the index masquerade as the processedFlag, resulting in the first string being correctly unquoted (index 0 == false) and all the others being quoted (index>0 == true)
Context
I tried to make the sinon-chai module work with sinon@2.0.0.
I ran the tests for sinon-chai, and the only error is in the format of the expectation messages.
I traked it down to this little bug in sinon.
The text was updated successfully, but these errors were encountered: