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

assert: enforce type check in deepStrictEqual #10282

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
@joyeecheung
Member

joyeecheung commented Dec 15, 2016

For a write-up on this PR, see #10282 (comment)

The less-breaking part of this PR has been moved to #11128

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

assert, test

Description of change

Add checks for the built-in tags and refactor _deepEqual,
most user-land modules do this for a strict, deep comparison.
nodejs/node-v0.x-archive#7178 already added
this check for argument objects, even in non-strict tests.

Fixes #10258.
Docs updates are postponed due to #7815.

See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
for a partial list of the tags.

@addaleax

I’ve labelled this semver-major since it looks like a pretty clear behavioural change to me, even if it seems to make a lot of sense from the first look at it.

Fixes #10258.

Could you add a Fixes: https://github.com/nodejs/node/issues/10258 line at the end of the commit message? :)

Show outdated Hide outdated lib/assert.js
return a.source === b.source &&
a.global === b.global &&
a.multiline === b.multiline &&
a.lastIndex === b.lastIndex &&

This comment has been minimized.

@addaleax

addaleax Dec 15, 2016

Member

So, this is not related to the changes you are making here, but I would have a couple of suggestions:

  • I guess you could probably make arguments both for including lastIndex here and for leaving it out, and I’m tempted to say “drop it”. I probably wouldn’t expect this behaviour.

  • Maybe instead of the global, multiline and ignoreCase checks a single check for .flags would be a good idea? There are new flags like u that would currently be ignored.

(If you think these suggestions make sense, it’s probably best to keep that for a separate commit/separate PR.)

@addaleax

addaleax Dec 15, 2016

Member

So, this is not related to the changes you are making here, but I would have a couple of suggestions:

  • I guess you could probably make arguments both for including lastIndex here and for leaving it out, and I’m tempted to say “drop it”. I probably wouldn’t expect this behaviour.

  • Maybe instead of the global, multiline and ignoreCase checks a single check for .flags would be a good idea? There are new flags like u that would currently be ignored.

(If you think these suggestions make sense, it’s probably best to keep that for a separate commit/separate PR.)

This comment has been minimized.

@joyeecheung

joyeecheung Dec 15, 2016

Member

Good suggestion, I think I will just submit another commit in this PR.

@joyeecheung

joyeecheung Dec 15, 2016

Member

Good suggestion, I think I will just submit another commit in this PR.

Show outdated Hide outdated lib/assert.js
if (ArrayBuffer.isView(actual) && ArrayBuffer.isView(expected) &&
getTag(actual) === getTag(expected) &&
!(actual instanceof Float32Array ||
actual instanceof Float64Array)) {

This comment has been minimized.

@addaleax

addaleax Dec 15, 2016

Member

The indentation seems off here?

Also, could you update the instanceof checks here to use getTag, too? (probably also best kept for a separate commit or PR)

@addaleax

addaleax Dec 15, 2016

Member

The indentation seems off here?

Also, could you update the instanceof checks here to use getTag, too? (probably also best kept for a separate commit or PR)

This comment has been minimized.

@joyeecheung

joyeecheung Dec 15, 2016

Member

Oops, why my make lint doesn't scream at me about this :/? I will update these indentations, thanks. And the tag checks can go into another commit I think.

@joyeecheung

joyeecheung Dec 15, 2016

Member

Oops, why my make lint doesn't scream at me about this :/? I will update these indentations, thanks. And the tag checks can go into another commit I think.

Show outdated Hide outdated test/parallel/test-assert-strict-typecheck.js
const date = new Date('2016');
// See #10258

This comment has been minimized.

@addaleax

addaleax Dec 15, 2016

Member

nit: Can I suggest that you update this to use the full URL here?

@addaleax

addaleax Dec 15, 2016

Member

nit: Can I suggest that you update this to use the full URL here?

Show outdated Hide outdated test/parallel/test-assert-strict-typecheck.js
const fake = new FakeDate();
/* eslint-disable no-restricted-properties */
// We are testing deepEqual!

This comment has been minimized.

@addaleax

addaleax Dec 15, 2016

Member

Is the eslint-disable tag to that deepEqual can be used here?

@addaleax

addaleax Dec 15, 2016

Member

Is the eslint-disable tag to that deepEqual can be used here?

This comment has been minimized.

@joyeecheung

joyeecheung Dec 15, 2016

Member

no-restricted-properties is the one I get from make lint, I can't find a specific eslint-disable tag for deepEqual, do you know what that is?

@joyeecheung

joyeecheung Dec 15, 2016

Member

no-restricted-properties is the one I get from make lint, I can't find a specific eslint-disable tag for deepEqual, do you know what that is?

This comment has been minimized.

@addaleax

addaleax Dec 15, 2016

Member

@joyeecheung Nope, and to be clear, I wasn’t requesting you to change anything here, just making sure that I understood why the line is there in the first place

@addaleax

addaleax Dec 15, 2016

Member

@joyeecheung Nope, and to be clear, I wasn’t requesting you to change anything here, just making sure that I understood why the line is there in the first place

This comment has been minimized.

@joyeecheung

joyeecheung Dec 16, 2016

Member

Oh yes, this disable tag is for all the deepEquals below :).

@joyeecheung

joyeecheung Dec 16, 2016

Member

Oh yes, this disable tag is for all the deepEquals below :).

This comment has been minimized.

@Trott

Trott Dec 16, 2016

Member

I think it's fine the way you did it, but if you want to get even more granular with the linting options, you can disable the check on just the lines that need it by either using // eslint-disable-line no-restricted-properties or // eslint-disable-next-line no-restricted-properties (depending on if you can fit the comment on the same line or if it needs to go on the line right before the assert.deepEqual()).

@Trott

Trott Dec 16, 2016

Member

I think it's fine the way you did it, but if you want to get even more granular with the linting options, you can disable the check on just the lines that need it by either using // eslint-disable-line no-restricted-properties or // eslint-disable-next-line no-restricted-properties (depending on if you can fit the comment on the same line or if it needs to go on the line right before the assert.deepEqual()).

This comment has been minimized.

@joyeecheung

joyeecheung Dec 16, 2016

Member

Thank you for the tips!

@joyeecheung

joyeecheung Dec 16, 2016

Member

Thank you for the tips!

Show outdated Hide outdated test/parallel/test-assert-strict-typecheck.js
// For deepStrictEqual we check the runtime type,
// then reveal the fakeness of the fake date
assert.throws(() => assert.deepStrictEqual(date, fake),
`AssertionError: ${date} deepStrictEqual Date { }`);

This comment has been minimized.

@addaleax

addaleax Dec 15, 2016

Member

The indentation is off here, and there’s a assert.throws pitfall: You can’t specify a string to check the error message against; only a constructor, RegExp or function that checks the argument work here. (You can probably just wrap the expression in new RegExp or something)

(edit: link to docs: https://nodejs.org/api/assert.html#assert_assert_throws_block_error_message)

@addaleax

addaleax Dec 15, 2016

Member

The indentation is off here, and there’s a assert.throws pitfall: You can’t specify a string to check the error message against; only a constructor, RegExp or function that checks the argument work here. (You can probably just wrap the expression in new RegExp or something)

(edit: link to docs: https://nodejs.org/api/assert.html#assert_assert_throws_block_error_message)

This comment has been minimized.

@joyeecheung

joyeecheung Dec 15, 2016

Member

Sorry for not reading the docs more thoroughly. I'll wrap them up in new RegExp, thanks!

@joyeecheung

joyeecheung Dec 15, 2016

Member

Sorry for not reading the docs more thoroughly. I'll wrap them up in new RegExp, thanks!

This comment has been minimized.

@addaleax

addaleax Dec 15, 2016

Member

Sorry for not reading the docs more thoroughly.

@joyeecheung If it helps… that mistake is something found a lot in our own tests, at least until very recently ;)

@addaleax

addaleax Dec 15, 2016

Member

Sorry for not reading the docs more thoroughly.

@joyeecheung If it helps… that mistake is something found a lot in our own tests, at least until very recently ;)

Show outdated Hide outdated test/parallel/test-assert-strict-typecheck.js
const date2 = new MyDate('2016');
// deepEqual return true as long as the time are the same,
// but deepStrictEqual check properties

This comment has been minimized.

@addaleax

addaleax Dec 15, 2016

Member

typos: returns and checks (here and below)

@addaleax

addaleax Dec 15, 2016

Member

typos: returns and checks (here and below)

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Dec 15, 2016

Member

@addaleax Thanks for the review, I've updated this PR, PTAL.

Member

joyeecheung commented Dec 15, 2016

@addaleax Thanks for the review, I've updated this PR, PTAL.

@addaleax

This comment has been minimized.

Show comment
Hide comment
@addaleax

addaleax Dec 15, 2016

Member

Thanks! This looks pretty good so far, I’ll have time for a full review of this later.

CI: https://ci.nodejs.org/job/node-test-commit/6668/
CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/481/

Member

addaleax commented Dec 15, 2016

Thanks! This looks pretty good so far, I’ll have time for a full review of this later.

CI: https://ci.nodejs.org/job/node-test-commit/6668/
CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/481/

@addaleax addaleax requested a review from Trott Dec 15, 2016

@Trott

Thanks for doing this! Mostly seems good to me. Not sure if we'd have to "unlock" the API, but (as of right now, at least) I'd be in favor of doing that. Some small comments.

Show outdated Hide outdated lib/assert.js
// equivalent if it is also a Date object that refers to the same time.
} else if (util.isDate(actual) && util.isDate(expected)) {
return actual.getTime() === expected.getTime();
// 7.2. If both values are Date objects,

This comment has been minimized.

@Trott

Trott Dec 16, 2016

Member

These numbers (7.2) correspond to the sections of a specification that assert followed in its initial implementation. http://wiki.commonjs.org/wiki/Unit_Testing/1.0

If we're going to change the algorithm, I'd recommend removing the numbers, since we're not following the spec anymore.

@Trott

Trott Dec 16, 2016

Member

These numbers (7.2) correspond to the sections of a specification that assert followed in its initial implementation. http://wiki.commonjs.org/wiki/Unit_Testing/1.0

If we're going to change the algorithm, I'd recommend removing the numbers, since we're not following the spec anymore.

This comment has been minimized.

@joyeecheung

joyeecheung Dec 16, 2016

Member

Didn't know this is a thing :O I will remove those numbers. Thanks.

@joyeecheung

joyeecheung Dec 16, 2016

Member

Didn't know this is a thing :O I will remove those numbers. Thanks.

Show outdated Hide outdated test/parallel/test-assert.js
const re1 = /a/;
re1.lastIndex = 3;
assert.throws(makeBlock(a.deepEqual, re1, /a/));
}

This comment has been minimized.

@Trott

Trott Dec 16, 2016

Member

Instead of removing this test, would it make sense to change it to assert.doesNotThrow?

@Trott

Trott Dec 16, 2016

Member

Instead of removing this test, would it make sense to change it to assert.doesNotThrow?

This comment has been minimized.

@joyeecheung

joyeecheung Dec 16, 2016

Member

Good suggestion. I will update these. Thanks.

@joyeecheung

joyeecheung Dec 16, 2016

Member

Good suggestion. I will update these. Thanks.

Show outdated Hide outdated test/parallel/test-assert.js
{
const re1 = /a/;
re1.lastIndex = 3;
assert.throws(makeBlock(a.deepStrictEqual, re1, /a/));

This comment has been minimized.

@Trott

Trott Dec 16, 2016

Member

Same here: assert.doesNotThrow()?

@Trott

Trott Dec 16, 2016

Member

Same here: assert.doesNotThrow()?

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Dec 16, 2016

Member

@Trott Thank you for the review, I have updated this PR, PTAL.

Member

joyeecheung commented Dec 16, 2016

@Trott Thank you for the review, I have updated this PR, PTAL.

@Trott

Trott approved these changes Dec 16, 2016

@Trott

This comment has been minimized.

Show comment
Hide comment
@Trott

Trott Dec 16, 2016

Member

@nodejs/ctc Would we need to "unlock" the assert module to land this? I think the answer is: "technically yes" but there might be some wiggle room on something like this?

Member

Trott commented Dec 16, 2016

@nodejs/ctc Would we need to "unlock" the assert module to land this? I think the answer is: "technically yes" but there might be some wiggle room on something like this?

@Trott Trott added the blocked label Dec 16, 2016

@Trott

This comment has been minimized.

Show comment
Hide comment
@Trott

Trott Dec 16, 2016

Member

Added the blocked label until the "Locked API" issue is sorted out.

Member

Trott commented Dec 16, 2016

Added the blocked label until the "Locked API" issue is sorted out.

@Trott

Trott approved these changes Dec 16, 2016

LGTM if CI is and CITGM is

@addaleax

LGTM. Maybe read me adding the “semver-major” label more as a precaution than anything else; I am fine considering this a bugfix.

targos added a commit to targos/node that referenced this pull request Dec 19, 2016

tools: forbid template literals in assert.throws
Extend the assert-throws-arguments custom ESLint rule to also check for
the use of template literals as a second argument to assert.throws.

PR-URL: nodejs#10301
Ref: nodejs#10282 (comment)
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Italo A. Casas <me@italoacasas.com>

cjihrig added a commit to cjihrig/node-1 that referenced this pull request Dec 20, 2016

tools: forbid template literals in assert.throws
Extend the assert-throws-arguments custom ESLint rule to also check for
the use of template literals as a second argument to assert.throws.

PR-URL: nodejs#10301
Ref: nodejs#10282 (comment)
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Italo A. Casas <me@italoacasas.com>

cjihrig added a commit that referenced this pull request Dec 20, 2016

tools: forbid template literals in assert.throws
Extend the assert-throws-arguments custom ESLint rule to also check for
the use of template literals as a second argument to assert.throws.

PR-URL: #10301
Ref: #10282 (comment)
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Italo A. Casas <me@italoacasas.com>

@mscdex mscdex removed the lts-watch-v6.x label Dec 21, 2016

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Dec 22, 2016

Member

Added the blocked label until the "Locked API" issue is sorted out.

Just linking the issue here: #6528

Member

joyeecheung commented Dec 22, 2016

Added the blocked label until the "Locked API" issue is sorted out.

Just linking the issue here: #6528

@Trott

This comment has been minimized.

Show comment
Hide comment
@Trott

Trott Dec 22, 2016

Member

@nodejs/ctc: Thoughts on the semver-ness of this change? And thoughts on whether we'd need to change the API status from Locked if we want to land this?

(Long-winded aside: Personally, I think we should remove "Locked" from the assert API. Either we should fully deprecate everything in it except assert(), or else we should support it. And I vote for supporting it. But deprecation would be better than "Locked". At least for the assert module, "Locked" is this really problematic middle state where we're not "deprecating" it but we are discouraging people from using it...which means we're deprecating it. It also discourages people from spending time fixing bugs in the assert module. Either we should deprecate it or we should support it. For the assert module, at least, "Locked" seems like we're just trying to have it both ways.)

Member

Trott commented Dec 22, 2016

@nodejs/ctc: Thoughts on the semver-ness of this change? And thoughts on whether we'd need to change the API status from Locked if we want to land this?

(Long-winded aside: Personally, I think we should remove "Locked" from the assert API. Either we should fully deprecate everything in it except assert(), or else we should support it. And I vote for supporting it. But deprecation would be better than "Locked". At least for the assert module, "Locked" is this really problematic middle state where we're not "deprecating" it but we are discouraging people from using it...which means we're deprecating it. It also discourages people from spending time fixing bugs in the assert module. Either we should deprecate it or we should support it. For the assert module, at least, "Locked" seems like we're just trying to have it both ways.)

@addaleax

This comment has been minimized.

Show comment
Hide comment
@addaleax

addaleax Dec 22, 2016

Member

And thoughts on whether we'd need to change the API status from Locked if we want to land this?

Fwiw I think semver-major changes and bugfixes are not mutually exclusive terms, and I think this change here might fall under both categories; so: no, not necessarily.

Member

addaleax commented Dec 22, 2016

And thoughts on whether we'd need to change the API status from Locked if we want to land this?

Fwiw I think semver-major changes and bugfixes are not mutually exclusive terms, and I think this change here might fall under both categories; so: no, not necessarily.

@jasnell

This comment has been minimized.

Show comment
Hide comment
@jasnell

jasnell Dec 23, 2016

Member

Definitely semver-major

Member

jasnell commented Dec 23, 2016

Definitely semver-major

@addaleax addaleax added this to the 8.0.0 milestone Dec 26, 2016

targos added a commit that referenced this pull request Dec 26, 2016

tools: forbid template literals in assert.throws
Extend the assert-throws-arguments custom ESLint rule to also check for
the use of template literals as a second argument to assert.throws.

PR-URL: #10301
Ref: #10282 (comment)
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Italo A. Casas <me@italoacasas.com>

targos added a commit that referenced this pull request Dec 28, 2016

tools: forbid template literals in assert.throws
Extend the assert-throws-arguments custom ESLint rule to also check for
the use of template literals as a second argument to assert.throws.

PR-URL: #10301
Ref: #10282 (comment)
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Italo A. Casas <me@italoacasas.com>

@joyeecheung joyeecheung closed this Jan 2, 2017

@joyeecheung joyeecheung deleted the joyeecheung:fix-assert branch Jan 2, 2017

@joyeecheung joyeecheung restored the joyeecheung:fix-assert branch Jan 2, 2017

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Jan 2, 2017

Member

Accidentally deleted the remote branch. Reopen.

Member

joyeecheung commented Jan 2, 2017

Accidentally deleted the remote branch. Reopen.

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Feb 1, 2017

Member

Did some benchmarking work per @addaleax's suggestion. Opened another PR for benchmarks (#11092) because I don't feel those should be blocked by this..

Also reorganized the commits and separated the two different parts described in #10282 (comment). The first commit being the not-so-breaking refactor+bugfix patch, the second being the tag check.

I've run the benchmarks with some smaller setups and observed about ~90% slow down in buffer deep strict benchmarks, ~50% slow down in deep strict typed array benchmarks. Other benchmarks (don't involve typedarray/buffers or are deepEqual benchmarks) don't show significant impacts. Primitive comparisons even have performance improvements(vary from 1%-8%). Will post more numbers when I've found the time to run the whole thing..

Member

joyeecheung commented Feb 1, 2017

Did some benchmarking work per @addaleax's suggestion. Opened another PR for benchmarks (#11092) because I don't feel those should be blocked by this..

Also reorganized the commits and separated the two different parts described in #10282 (comment). The first commit being the not-so-breaking refactor+bugfix patch, the second being the tag check.

I've run the benchmarks with some smaller setups and observed about ~90% slow down in buffer deep strict benchmarks, ~50% slow down in deep strict typed array benchmarks. Other benchmarks (don't involve typedarray/buffers or are deepEqual benchmarks) don't show significant impacts. Primitive comparisons even have performance improvements(vary from 1%-8%). Will post more numbers when I've found the time to run the whole thing..

MylesBorins added a commit that referenced this pull request Feb 1, 2017

tools: forbid template literals in assert.throws
Extend the assert-throws-arguments custom ESLint rule to also check for
the use of template literals as a second argument to assert.throws.

PR-URL: #10301
Ref: #10282 (comment)
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Italo A. Casas <me@italoacasas.com>

@Trott Trott added ctc-agenda and removed ctc-agenda labels Feb 1, 2017

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Feb 1, 2017

Member

Benchmarks are taken from #11092, run against this PR'second commit and the master. The results changed after I updated the benchmarks to address the reviews though..

Results
                                                                                                  improvement confidence      p.value
 assert/deepequal-buffer.js method="nonstrict" len=100 n=1000                                        -92.15 %        *** 5.592045e-07
 assert/deepequal-buffer.js method="strict" len=100 n=1000                                           -87.91 %        *** 1.481929e-10
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="array"          1.54 %            3.813086e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="boolean"        0.08 %            9.540203e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="new-array"      2.27 %            5.220313e-02
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="null"           0.26 %            8.642667e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="number"         0.73 %            4.837192e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="object"        -0.27 %            7.277261e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="string"        -0.78 %            3.996062e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="undefined"      3.12 %          * 3.893927e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="array"            -2.53 %            5.028944e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="boolean"          -3.07 %         ** 6.539822e-03
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="new-array"        -1.14 %            3.776449e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="null"             -3.47 %            5.452339e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="number"            0.30 %            8.308053e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="object"           -1.31 %          * 4.744264e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="string"           -1.51 %            1.445681e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="undefined"         0.61 %            8.530695e-01
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="array"                 2.80 %            2.401182e-01
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="boolean"               7.29 %         ** 3.027695e-03
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="new-array"             3.89 %            1.033384e-01
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="null"                  6.39 %          * 4.844864e-02
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="number"                8.26 %          * 3.295566e-02
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="object"                7.04 %          * 1.246946e-02
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="string"                7.29 %          * 4.308442e-02
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="undefined"             5.05 %            8.801488e-02
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="array"                    7.63 %         ** 6.295852e-03
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="boolean"                  9.38 %        *** 3.859246e-04
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="new-array"                5.19 %            9.868693e-02
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="null"                     6.96 %         ** 3.754126e-03
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="number"                   8.75 %         ** 9.927209e-03
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="object"                   9.90 %        *** 8.087247e-04
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="string"                   7.00 %         ** 7.527566e-03
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="undefined"               12.38 %        *** 8.321948e-06
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Float32Array"                0.05 %            9.780129e-01
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Float64Array"                1.63 %          * 3.978530e-02
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Int16Array"                -98.85 %        *** 4.075302e-10
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Int32Array"                -97.98 %        *** 5.272991e-11
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Int8Array"                 -99.33 %        *** 1.400483e-12
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint16Array"               -98.92 %        *** 8.256519e-11
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint32Array"               -98.05 %        *** 3.837230e-12
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint8Array"                -99.30 %        *** 1.832656e-09
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint8ClampedArray"         -99.29 %        *** 1.861473e-09
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Float32Array"                  -1.03 %            4.781549e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Float64Array"                   1.46 %            1.871156e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Int16Array"                    -8.69 %          * 2.676116e-02
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Int32Array"                    -2.51 %            5.762043e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Int8Array"                     -8.23 %            1.700721e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint16Array"                   -3.40 %            3.097808e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint32Array"                    1.62 %            6.970420e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint8Array"                    -1.38 %            7.340172e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint8ClampedArray"             -9.24 %            5.709597e-02
Member

joyeecheung commented Feb 1, 2017

Benchmarks are taken from #11092, run against this PR'second commit and the master. The results changed after I updated the benchmarks to address the reviews though..

Results
                                                                                                  improvement confidence      p.value
 assert/deepequal-buffer.js method="nonstrict" len=100 n=1000                                        -92.15 %        *** 5.592045e-07
 assert/deepequal-buffer.js method="strict" len=100 n=1000                                           -87.91 %        *** 1.481929e-10
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="array"          1.54 %            3.813086e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="boolean"        0.08 %            9.540203e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="new-array"      2.27 %            5.220313e-02
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="null"           0.26 %            8.642667e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="number"         0.73 %            4.837192e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="object"        -0.27 %            7.277261e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="string"        -0.78 %            3.996062e-01
 assert/deepequal-prims-and-objs-big-array.js method="nonstrict" len=100000 n=25 prim="undefined"      3.12 %          * 3.893927e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="array"            -2.53 %            5.028944e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="boolean"          -3.07 %         ** 6.539822e-03
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="new-array"        -1.14 %            3.776449e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="null"             -3.47 %            5.452339e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="number"            0.30 %            8.308053e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="object"           -1.31 %          * 4.744264e-02
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="string"           -1.51 %            1.445681e-01
 assert/deepequal-prims-and-objs-big-array.js method="strict" len=100000 n=25 prim="undefined"         0.61 %            8.530695e-01
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="array"                 2.80 %            2.401182e-01
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="boolean"               7.29 %         ** 3.027695e-03
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="new-array"             3.89 %            1.033384e-01
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="null"                  6.39 %          * 4.844864e-02
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="number"                8.26 %          * 3.295566e-02
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="object"                7.04 %          * 1.246946e-02
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="string"                7.29 %          * 4.308442e-02
 assert/deepequal-prims-and-objs-big-loop.js method="nonstrict" n=1000000 prim="undefined"             5.05 %            8.801488e-02
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="array"                    7.63 %         ** 6.295852e-03
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="boolean"                  9.38 %        *** 3.859246e-04
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="new-array"                5.19 %            9.868693e-02
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="null"                     6.96 %         ** 3.754126e-03
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="number"                   8.75 %         ** 9.927209e-03
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="object"                   9.90 %        *** 8.087247e-04
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="string"                   7.00 %         ** 7.527566e-03
 assert/deepequal-prims-and-objs-big-loop.js method="strict" n=1000000 prim="undefined"               12.38 %        *** 8.321948e-06
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Float32Array"                0.05 %            9.780129e-01
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Float64Array"                1.63 %          * 3.978530e-02
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Int16Array"                -98.85 %        *** 4.075302e-10
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Int32Array"                -97.98 %        *** 5.272991e-11
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Int8Array"                 -99.33 %        *** 1.400483e-12
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint16Array"               -98.92 %        *** 8.256519e-11
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint32Array"               -98.05 %        *** 3.837230e-12
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint8Array"                -99.30 %        *** 1.832656e-09
 assert/deepequal-typedarrays.js len=1000000 method="nonstrict" n=1 type="Uint8ClampedArray"         -99.29 %        *** 1.861473e-09
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Float32Array"                  -1.03 %            4.781549e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Float64Array"                   1.46 %            1.871156e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Int16Array"                    -8.69 %          * 2.676116e-02
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Int32Array"                    -2.51 %            5.762043e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Int8Array"                     -8.23 %            1.700721e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint16Array"                   -3.40 %            3.097808e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint32Array"                    1.62 %            6.970420e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint8Array"                    -1.38 %            7.340172e-01
 assert/deepequal-typedarrays.js len=1000000 method="strict" n=1 type="Uint8ClampedArray"             -9.24 %            5.709597e-02

@Trott Trott removed the ctc-agenda label Feb 1, 2017

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Feb 2, 2017

Member

After reading the meeting notes I think we can land the first commit for a start, this only refactors the code and fixes the premature conclusion bugs, and doesn't need to change the docs. I can open another PR for the second commit, which is more intrusive and needs to introduce a doc change about the tag checks?

EDIT: If you think is the direction to go then I'll delete the second commit from this PR and run the CI/CITGM/benchmarks again. @Trott @addaleax @jasnell

EEDIT: Or open another PR with the first commit, then rebase this one.

Member

joyeecheung commented Feb 2, 2017

After reading the meeting notes I think we can land the first commit for a start, this only refactors the code and fixes the premature conclusion bugs, and doesn't need to change the docs. I can open another PR for the second commit, which is more intrusive and needs to introduce a doc change about the tag checks?

EDIT: If you think is the direction to go then I'll delete the second commit from this PR and run the CI/CITGM/benchmarks again. @Trott @addaleax @jasnell

EEDIT: Or open another PR with the first commit, then rebase this one.

@jasnell

This comment has been minimized.

Show comment
Hide comment
@jasnell

jasnell Feb 2, 2017

Member

SGTM

Member

jasnell commented Feb 2, 2017

SGTM

@joyeecheung joyeecheung referenced this pull request Feb 2, 2017

Closed

assert: fix _deepEqual and improve assert.md #11128

4 of 4 tasks complete
@Trott

This comment has been minimized.

Show comment
Hide comment
@Trott

Trott Feb 2, 2017

Member

I think that works for me.

Member

Trott commented Feb 2, 2017

I think that works for me.

Show outdated Hide outdated lib/assert.js
return true;
}
// Notes: Type tags are [[Class]] properties returned by
// obj->class_name() in C++ or Object.prototype.toString.call(obj) in JS

This comment has been minimized.

@TimothyGu

TimothyGu Feb 2, 2017

Member

[[Class]] is gone in ES6, and obj->class_name() doesn't seem to be part of the public V8 API. I don't think we really need to mention them.

@TimothyGu

TimothyGu Feb 2, 2017

Member

[[Class]] is gone in ES6, and obj->class_name() doesn't seem to be part of the public V8 API. I don't think we really need to mention them.

This comment has been minimized.

@joyeecheung

joyeecheung Feb 2, 2017

Member

I mentioned obj->class_name() because that looks like it's what util.isDate() (Value::IsDate) and alike come down to in a macro. Also it's why process and a lot of other objects created in the C++ land has their own tags, although after a quick search looks like they actually use FunctionTemplate::SetClassName() to set this, and never use the getter, so probably we can just mention FunctionTemplate::SetClassName() would alter this.

[[Class]] is described as "historical" in another PR, just as it is in the spec note.

@joyeecheung

joyeecheung Feb 2, 2017

Member

I mentioned obj->class_name() because that looks like it's what util.isDate() (Value::IsDate) and alike come down to in a macro. Also it's why process and a lot of other objects created in the C++ land has their own tags, although after a quick search looks like they actually use FunctionTemplate::SetClassName() to set this, and never use the getter, so probably we can just mention FunctionTemplate::SetClassName() would alter this.

[[Class]] is described as "historical" in another PR, just as it is in the spec note.

@ljharb

I've left a few comments, but in general, it'd be awesome if new code in node core was robust against user modification of the language builtins.

Show outdated Hide outdated lib/assert.js
}
function isArguments(tag) {
return tag == '[object Arguments]';

This comment has been minimized.

@ljharb

ljharb Feb 6, 2017

why is this == and a few lines above, ===? I assume this should be ===?

@ljharb

ljharb Feb 6, 2017

why is this == and a few lines above, ===? I assume this should be ===?

This comment has been minimized.

@joyeecheung

joyeecheung Feb 6, 2017

Member

Oops, it's mistake, thanks for catching that.

@joyeecheung

joyeecheung Feb 6, 2017

Member

Oops, it's mistake, thanks for catching that.

Show outdated Hide outdated lib/assert.js
// See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
// for a list of tags pre-defined in the spec.
// There are some unspecified tags in the wild too(e.g. typed array tags).
const actualTag = Object.prototype.toString.call(actual);

This comment has been minimized.

@ljharb

ljharb Feb 6, 2017

For the sake of robustness, please cache Object.prototype.toString at module level, and don't rely on nobody having monkeyed with Object.prototype at runtime :-)

@ljharb

ljharb Feb 6, 2017

For the sake of robustness, please cache Object.prototype.toString at module level, and don't rely on nobody having monkeyed with Object.prototype at runtime :-)

Show outdated Hide outdated lib/assert.js
// If both values are Date objects,
// check if the time underneath are equal first.
if (util.isDate(actual) && util.isDate(expected)) {
if (actual.getTime() !== expected.getTime()) {

This comment has been minimized.

@ljharb

ljharb Feb 6, 2017

It's safer to cache Date.prototype.getTime at module level, and .call it here - rather than relying both on .getTime not being shadowed on these two objects, and on Date.prototype being unbroken.

@ljharb

ljharb Feb 6, 2017

It's safer to cache Date.prototype.getTime at module level, and .call it here - rather than relying both on .getTime not being shadowed on these two objects, and on Date.prototype being unbroken.

Show outdated Hide outdated lib/assert.js
// Here compare returns true, so actual.length === expected.length
// if they both only contain numeric keys,
// we don't need to exam further
if (Object.keys(actual).length === actual.length &&

This comment has been minimized.

@ljharb

ljharb Feb 6, 2017

Similarly, Object.keys should be cached at module level, not runtime-looked-up on Object

@ljharb

ljharb Feb 6, 2017

Similarly, Object.keys should be cached at module level, not runtime-looked-up on Object

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Feb 17, 2017

Member

This is blocked by #11128

Member

joyeecheung commented Feb 17, 2017

This is blocked by #11128

@joyeecheung joyeecheung referenced this pull request Feb 18, 2017

Closed

util: eliminate unecessary internal/util export #11455

2 of 2 tasks complete

joyeecheung added a commit to joyeecheung/node that referenced this pull request Feb 25, 2017

assert: fix premature deep strict comparison
Refactors _deepEqual and fixes a few code paths that lead to
behaviors contradicting what the doc says. Before this commit
certain types of objects (Buffers, Dates, etc.) are not checked
properly, and can get away with different prototypes AND different
enumerable owned properties because _deepEqual would jump to
premature conclusion for them.

Since we no longer follow CommonJS unit testing spec,
the checks for primitives and object prototypes are moved
forward for faster failure.

Improve regexp and float* array checks:

* Don't compare lastIndex of regexps, because they are not
  enumerable, so according to the docs they should not be compared
* Compare flags of regexps instead of separate properties
* Use built-in tags to test for float* arrays instead of using
  instanceof

Use full link to the archived GitHub repository.

Use util.objectToString for future improvements to that function
that makes sure the call won't be tampered with.

Refs: nodejs#10282 (comment)
Refs: nodejs#10258 (comment)

joyeecheung added a commit that referenced this pull request Feb 27, 2017

assert: fix premature deep strict comparison
Refactors _deepEqual and fixes a few code paths that lead to
behaviors contradicting what the doc says. Before this commit
certain types of objects (Buffers, Dates, etc.) are not checked
properly, and can get away with different prototypes AND different
enumerable owned properties because _deepEqual would jump to
premature conclusion for them.

Since we no longer follow CommonJS unit testing spec,
the checks for primitives and object prototypes are moved
forward for faster failure.

Improve regexp and float* array checks:

* Don't compare lastIndex of regexps, because they are not
  enumerable, so according to the docs they should not be compared
* Compare flags of regexps instead of separate properties
* Use built-in tags to test for float* arrays instead of using
  instanceof

Use full link to the archived GitHub repository.

Use util.objectToString for future improvements to that function
that makes sure the call won't be tampered with.

PR-URL: #11128
Refs: #10282 (comment)
Refs: #10258 (comment)
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@ChALkeR

This comment has been minimized.

Show comment
Hide comment
@ChALkeR

ChALkeR Mar 6, 2017

Member

Added the blocked label until the "Locked API" issue is sorted out.

assert was unlocked in #11304, removing blocked label.

This is blocked by #11128

That one landed too.

Member

ChALkeR commented Mar 6, 2017

Added the blocked label until the "Locked API" issue is sorted out.

assert was unlocked in #11304, removing blocked label.

This is blocked by #11128

That one landed too.

@ChALkeR ChALkeR removed the blocked label Mar 6, 2017

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Mar 7, 2017

Member

@ChALkeR Yeah this is not blocked anymore. Thanks!

Did a rebase locally, haven't decided about #10282 (comment), I'll push it later.

Member

joyeecheung commented Mar 7, 2017

@ChALkeR Yeah this is not blocked anymore. Thanks!

Did a rebase locally, haven't decided about #10282 (comment), I'll push it later.

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Mar 11, 2017

Member

Rebased with documentation and a few more test cases (for faked global and process)

Member

joyeecheung commented Mar 11, 2017

Rebased with documentation and a few more test cases (for faked global and process)

assert: enforce type check in deepStrictEqual
Add checks for the built-in type tags to catch objects
with faked prototypes.

See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
for a partial list of built-in tags.

Fixes: #10258
@addaleax

Still LGTM :)

1. Primitive values are compared using the [Strict Equality Comparison][]
( `===` ).
2. [`[[Prototype]]`][prototype-spec] of objects are compared using
the [Strict Equality Comparison][] too.
3. [Type tags][Object.prototype.toString()] of objects should be the same.

This comment has been minimized.

@addaleax

addaleax Mar 11, 2017

Member

I can’t find the definition of [Object.prototype.toString()] … am I missing something?

@addaleax

addaleax Mar 11, 2017

Member

I can’t find the definition of [Object.prototype.toString()] … am I missing something?

This comment has been minimized.

@joyeecheung

joyeecheung Mar 12, 2017

Member

Uh, forgot to put the reference link below :P

@joyeecheung

joyeecheung Mar 12, 2017

Member

Uh, forgot to put the reference link below :P

Show outdated Hide outdated doc/api/assert.md
@@ -141,6 +142,25 @@ assert.deepEqual({a: 1}, {a: '1'});
assert.deepStrictEqual({a: 1}, {a: '1'});
// AssertionError: { a: 1 } deepStrictEqual { a: '1' }
// because 1 !== '1' using strict equality
// The following objects don't have owned properties

This comment has been minimized.

@addaleax

addaleax Mar 11, 2017

Member

typo: own properties?

@addaleax

addaleax Mar 11, 2017

Member

typo: own properties?

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Mar 12, 2017

Member

@addaleax Thanks for the review, fixed the typo and the missing link.

CI: https://ci.nodejs.org/job/node-test-pull-request/6804/

Member

joyeecheung commented Mar 12, 2017

@addaleax Thanks for the review, fixed the typo and the missing link.

CI: https://ci.nodejs.org/job/node-test-pull-request/6804/

@addaleax

This comment has been minimized.

Show comment
Hide comment
@addaleax

addaleax Mar 12, 2017

Member

The last CITGM run is also a bit old, so:

CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/641/

Member

addaleax commented Mar 12, 2017

The last CITGM run is also a bit old, so:

CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/641/

@addaleax

This comment has been minimized.

Show comment
Hide comment
@addaleax

addaleax Mar 12, 2017

Member

Went ahead and landed this in efec14a :)

Member

addaleax commented Mar 12, 2017

Went ahead and landed this in efec14a :)

@addaleax addaleax closed this Mar 12, 2017

addaleax added a commit that referenced this pull request Mar 12, 2017

assert: enforce type check in deepStrictEqual
Add checks for the built-in type tags to catch objects
with faked prototypes.

See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
for a partial list of built-in tags.

Fixes: #10258
PR-URL: #10282
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>

jungx098 added a commit to jungx098/node that referenced this pull request Mar 21, 2017

assert: enforce type check in deepStrictEqual
Add checks for the built-in type tags to catch objects
with faked prototypes.

See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
for a partial list of built-in tags.

Fixes: nodejs#10258
PR-URL: nodejs#10282
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>

@jasnell jasnell referenced this pull request Apr 4, 2017

Closed

8.0.0 Release Proposal #12220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment