-
-
Notifications
You must be signed in to change notification settings - Fork 733
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
Regression: Error when matching message body #1713
Comments
This regression is unfortunately very impacting for us. Would be great to get a quick response! Thank you very much for all the hard work! |
When matching objects with the same number of keys but different keys, should not match instead of crashing. Close #1713
When matching objects with the same number of keys but different keys, should not match instead of crashing. Close #1713
Thanks for the test case! |
Can you confirm the fix in #1714? |
@paulmelnikow I can confirm that #1714 will fix the issue for now. Thank you for the quick response! Should bringing deep-equal (which is a very popular and maintained package) back into the project be considered? There may be more edge cases not considered with the custom utility. |
When matching objects with the same number of keys but different keys, should not match instead of crashing. Close #1713
On one hand I agree it's better to pull in a library rather than solve problems over and over again. On the other side, a lot of what makes deep-equal complicated seems to be its focus on performance, which is not a big consideration in nock. This particular bug was very shallow, though I'd say we should consider reverting to deep-equal if we find more subtle edge-case bugs. /cc @mastermatt, I'd be curious your thoughts. |
🎉 This issue has been resolved in version 11.3.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What is the expected behavior?
To not crash on message body matching if body doesn't match.
What is the actual behavior?
Crashing on message body matching if message body has same count of keys, but different keys.
Possible solution
Go back to using
deep-equal
npm package. There was a PR here that introduced custom deepEqual logic that is not good enough.If two objects have the same count of keys but not the same keys, it tries to extract the keys on
undefined
and crashes, making debugging hard to impossible.How to reproduce the issue
Runkit: Link
Having problem producing a test case? Try and ask the community for help. If the test case cannot be reproduced, the Nock community might not be able to help you.
Does the bug have a test case?
Versions
The text was updated successfully, but these errors were encountered: