Skip to content
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

Incorrect assertion for Object.create(null) #933

Closed
vitalets opened this issue Apr 25, 2016 · 3 comments
Closed

Incorrect assertion for Object.create(null) #933

vitalets opened this issue Apr 25, 2016 · 3 comments

Comments

@vitalets
Copy link

This works correctly:

const obj = {};
obj.x = 2;
expect(obj).toEqual({x: 1});

but this does not:

const obj = Object.create(null);
obj.x = 2;
expect(obj).toEqual({x: 1});

Instead of diff it shows error:

- TypeError: obj.hasOwnProperty is not a function

I suppose we should check that obj.hasOwnProperty is function.

jest -v
v11.0.2
@cpojer
Copy link
Member

cpojer commented Apr 25, 2016

This is a bug in Jasmine and we fixed it in our fork of Jasmine here: d6660c4

It'll go out with Jest 12 probably in a week and a half. You can use the master version of Jest until then if you'd like: https://docs.npmjs.com/files/package.json#git-urls-as-dependencies

@cpojer cpojer closed this as completed Apr 25, 2016
@cpojer
Copy link
Member

cpojer commented Apr 25, 2016

(I also ran into this in #896 and it was annoying).

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants