Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Is it possible to ignore the prototype when doing object comparisons? #157

Open
opensourcegeek opened this issue Jun 23, 2022 · 0 comments

Comments

@opensourcegeek
Copy link

I recently moved some code that had Object.assign(Object.create(null), { prop1: 1 }) to just properties on the class, where the class holds this.props1 = 1. Then the assertions started failing.

   expect(postDataStub).to.be.calledOnceWith(dataObject);

If I do a Object.setPrototypeOf(objInstantiatedFromClass, null) then tests pass again. The real test has nested properties. I just wanted to see if I can somehow get away by telling sinon to ignore prototype methods.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant