-
-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Little bug in spy.printf "%*" formatter #1332
Comments
Thanks for your detailed investigation. That helps a lot! Do you have any chance of fixing this with a small PR? |
eauc
pushed a commit
to eauc/sinon
that referenced
this issue
Mar 15, 2017
…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.
fatso83
added a commit
that referenced
this issue
Mar 15, 2017
Fix issue #1332 : little bug in spy.printf "%*" formatter.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 [email protected]
$ 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 [email protected].
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: