-
-
Notifications
You must be signed in to change notification settings - Fork 768
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
sinon.stub().withArgs() matches too often #1882
Comments
@tbiesemann, @mroderick |
@mgred I don't think we're quite done yet
describe("#1882", function () {
it("should use constructor name when checking deepEquality", function () {
class ClassWithoutProps {};
const arg1 = new ClassWithoutProps(); //arg1.constructor.name === ClassWithoutProps
const arg2 = new Proxy({}, {}); //arg2.constructor.name === Object
const stub = sinon.stub();
stub.withArgs(arg1).returns(5);
const result = stub(arg2);
assert.same(result, undefined); //[ERR_ASSERTION]: 5 === undefined
});
}); Produces Would you take another look at this one? |
@mroderick Sure I will. Also: sinonjs/samsam#39 |
* add test case provided in sinonjs#1882 * change some eslint config to match test: ** class definitions are not enabled in ecmaVersion 5, ** addint Proxy as global See: sinonjs#1882, sinonjs/samsam#37
@mroderick, In the #1905 I added your test and it passes for me. |
* test(1882): add test case * add test case provided in #1882 * change some eslint config to match test: ** class definitions are not enabled in ecmaVersion 5, ** addint Proxy as global See: #1882, sinonjs/samsam#37 * fix(1882): changes according to review * Rewert config to support IE11 again * Adopt changes to test to be ES5
@tbiesemann can you verify that the issue has been fixed in latest version of Sinon? |
This is failing on Internet Explorer 11. Two different runs: |
@mroderick Confirmed - Fix works with Sinon 6.3.4 |
* test(1882): add test case * add test case provided in sinonjs#1882 * change some eslint config to match test: ** class definitions are not enabled in ecmaVersion 5, ** addint Proxy as global See: sinonjs#1882, sinonjs/samsam#37 * fix(1882): changes according to review * Rewert config to support IE11 again * Adopt changes to test to be ES5
Sinon 6.1.5
This test fails:
Describe the bug
withArgs() has too many matches.
Empty objects, instances of empty classes or proxies are all treated the same.
The deepEqual function in sinon returns true when comparing those.
One could use the constructor.name for further comparison in deepEqual, to solve some of these false matches.
The text was updated successfully, but these errors were encountered: