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

Should t.same use assert.deepStrictEqual? #68

Closed
SamVerschueren opened this issue Sep 26, 2015 · 2 comments
Closed

Should t.same use assert.deepStrictEqual? #68

SamVerschueren opened this issue Sep 26, 2015 · 2 comments

Comments

@SamVerschueren
Copy link
Contributor

Hi

The t.same method uses assert.deepEqual. This is also true when primitives do not have the same type. When using assert.deepStrictEqual, this is not the case.

assert.deepEqual({foo: 5}, {foo: '5'});
// true

assert.deepStrictEqual({foo: 5}, {foo: '5'});
// false

Same for t.notSame.

If for some reason, the implementation should be kept this way, new assertions can be added? t.strictSame and t.notStrictSame or something like that.

@vadimdemedes
Copy link
Contributor

Good point, I think we should switch. @sindresorhus what do you think?

@SamVerschueren
Copy link
Contributor Author

Not sure when the strict variants where introduced though. They do not exist in 0.12 so maybe we should use a ponyfill for older versions?

schnittstabil added a commit to sindresorhus/deep-assign that referenced this issue Nov 2, 2015
schnittstabil added a commit to sindresorhus/deep-assign that referenced this issue Nov 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants