-
-
Notifications
You must be signed in to change notification settings - Fork 772
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
error message for assert.calledWith breaks when representations are equal #2084
Comments
Boy, this took me a while. The main problem was that applyStatusChange is async, which I hadn't taken into account. Therefore, the assertion was run before applyStatusChange had done its work. Stupid error of me. I also made some mistakes for the tabId: I didn't resolve the browser.tabs.query-mock with the variable, but with a hand coded integer. What made this even more frustrating to debug, was a bug in Sinon I found through this: comparing '1234' to 1234 gave a very confusing AssertionError message, as if everything was okay. See sinonjs/sinon#2084 for the bug I filed.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@rensbaardman Would you like to have a stab at fixing this? I think it's a one-line fix, preferably with a small regression test. |
Sorry for the late reply – I certainly want to take a look at it, but I am quite busy right now so can't promise a quick resolution. |
Seems like this is still an issue? |
Can I reopen a pull request for this, most of the work has actually already been done by @rgroothuijsen. |
…tual value is equal, fixing issue #2084 (#2303) Co-authored-by: Roman Balayan <[email protected]>
This has been fixed with #2303 |
Describe the bug
When the (string) representations of the expected outcome and the actual outcome of e.g.
assert.calledWith()
are equal, the resulting error message is very confusing and hinting at a bug in the display logic. Instead of<red>actual</red> <green>expected</green>
(with<color>...</color>
my attempt at showing the expected terminal output color), it displays<black>actual</black>
, as if the outcome is actually correct.To Reproduce
Running the following with
node
:generates this output:
Expected behavior
I expected something like this:
so
<red>1234</red> <green>1234</green>
instead of<black>1234</black>
.Or, as
assert.match
does it (run e.g.sinon.assert.match(1234, '1234')
):It would be even better if it recognizes when string representations are equal, since this remains a confusing way to display the error: on first sight, it seems the actual outcome is equal to expected outcome, when it is not! Or simply include apostrophes for strings.
Compare how Chai handles this:
throws:
Context (please complete the following information):
The text was updated successfully, but these errors were encountered: