Sergey Sannikov
6b28d8870f
assert: fix TypeError on deepStrictEqual with null Map key or Set member
...
deepStrictEqual() and util.isDeepStrictEqual() threw "Cannot read
properties of null (reading 'constructor')" instead of comparing when
a Map key or Set member was null/undefined (or another primitive) and
lined up against object-only keys/members in the other collection with
an equal count. The primitive/null handling was gated behind an
optimization that is skipped when the counts match, letting such keys
reach objectComparisonStart, which dereferences `.constructor`.
Resolve primitive and null keys/members directly in every case.
Signed-off-by: semx <7532921+semx@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/64449
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-09-12 19:30:04 +00:00
Antoine du Hamel
6a3d80fb49
test: ensure assertions are reached on all tests
...
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/64716
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Aviv Keller <me@aviv.sh >
2026-07-27 19:04:04 +02:00
Paul Bouchon
9df0e9b4d4
assert,util: fix TypeError on Maps with null keys
...
`assert.deepStrictEqual`, `assert.notDeepStrictEqual`, and
`util.isDeepStrictEqual` threw a `TypeError` instead of returning a
result when one Map had a `null` key with an object value, the other
had an object key with a deeply-equal value but no `null` key, and
both maps were the same size.
In that case `mapObjectEquiv` skipped its primitive and `null` key
handling, which was gated on `array.length !== a.size`, and passed
the `null` key (which is `typeof 'object'`) to the object comparator.
That comparator reads `key.constructor` without a null guard, so it
threw. Handle primitive and `null` keys unconditionally, resolving
them directly against the other map.
Fixes: https://github.com/nodejs/node/issues/64433
Signed-off-by: Paul Bouchon <mail@bitpshr.net >
PR-URL: https://github.com/nodejs/node/pull/64441
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Aviv Keller <me@aviv.sh >
2026-07-18 16:38:07 +00:00
Ruben Bridgewater
8db9d43c45
assert,util: fix stale nested cycle memo entries
...
Temporary nested cycle-tracking entries could remain in the memory set
after a successful comparison. If a later sibling comparison reused one
of those objects, deepStrictEqual could incorrectly fail for equivalent
structures.
This cleans up the temporary nested entries after the nested
comparison returns.
Fixes: https://github.com/nodejs/node/issues/62422
PR-URL: https://github.com/nodejs/node/pull/62509
Fixes: https://github.com/nodejs/node/issues/62422
Reviewed-By: Jordan Harband <ljharb@gmail.com >
2026-04-09 16:48:25 +00:00
Ruben Bridgewater
27a7bbc624
assert: fix loose deepEqual arrays with undefined and null failing
...
The comparison has to accept these as identical.
Fixes: https://github.com/nodejs/node/issues/61583
PR-URL: https://github.com/nodejs/node/pull/61587
Reviewed-By: Jithil P Ponnan <jithil@outlook.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2026-02-01 13:00:17 +00:00
Ruben Bridgewater
955d347884
assert,util: fix deep comparison for sets and maps with mixed types
...
When comparing a Set or a Map and they contain primitives as keys
as well as objects, the primitives would always be skipped. That
is not correct, since that may only be skipped in case all keys
are objects.
Fixes: https://github.com/nodejs/node/issues/61386
PR-URL: https://github.com/nodejs/node/pull/61388
Reviewed-By: Aviv Keller <me@aviv.sh >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jordan Harband <ljharb@gmail.com >
2026-01-17 01:12:45 +00:00
Ruben Bridgewater
fc1d6d6b4c
assert,util: fix deep comparing invalid dates skipping properties
...
The property comparison of invalid dates regressed when starting
to handle invalid dates as being equal.
PR-URL: https://github.com/nodejs/node/pull/61076
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-12-22 19:30:35 +00:00
Ruben Bridgewater
dc97b507d0
util: mark proxied objects as such when inspecting them
...
Fixes: https://github.com/nodejs/node/issues/60964
PR-URL: https://github.com/nodejs/node/pull/61029
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2025-12-20 17:02:17 +00:00
Antoine du Hamel
e72761fe5e
test: ensure assertions are reached on more tests
...
PR-URL: https://github.com/nodejs/node/pull/60485
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-11-06 09:47:01 +01:00
Ruben Bridgewater
7c9fbc15bc
assert,util: fail promise comparison in deep equal checks
...
It is impossible to look into the content of a promise and its
state. This aligns the comparison with WeakMaps and WeakSets.
Only reference equal promises will pass the check in the future.
Fixes https://github.com/nodejs/node/issues/55198
PR-URL: https://github.com/nodejs/node/pull/59448
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2025-08-19 10:22:35 +00:00
Ruben Bridgewater
11222f1a27
assert,util: handle invalid dates as equal in deep comparison
...
Invalid dates are now handled as equal in all deep comparisons.
PR-URL: https://github.com/nodejs/node/pull/57627
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2025-06-21 04:00:23 +00:00
Ruben Bridgewater
733e0fc2c4
assert,util: fix constructor lookup in deep equal comparison
...
The latest performance optimization did not take into account that
an object may have a property called constructor. This is addressed
in this PR by adding a new fast path and using fallbacks.
PR-URL: https://github.com/nodejs/node/pull/57876
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-04-19 11:10:40 +00:00
Ruben Bridgewater
e739559e46
assert,util: improve deep object comparison performance
...
This improves the performance for almost all objects when comparing
them deeply.
PR-URL: https://github.com/nodejs/node/pull/57648
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: Bryan English <bryan@bryanenglish.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-04-05 08:53:31 +00:00
Ruben Bridgewater
4abad0763e
Revert "assert,util: revert recursive breaking change"
...
This reverts commit 575784b4cf .
PR-URL: https://github.com/nodejs/node/pull/57622
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2025-04-02 23:37:44 +00:00
Ruben Bridgewater
f1b0812754
assert: improve partialDeepStrictEqual
...
This significantly improves the assert.partialDeepStrictEqual
implementation by reusing the already existing algorithm.
It is significantly faster and handles edge cases like symbols
identical as the deepStrictEqual algorithm. This is crucial to
remove the experimental status from the implementation.
PR-URL: https://github.com/nodejs/node/pull/57370
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2025-03-12 18:26:13 +00:00
Giovanni Bucci
10cce655ca
assert: fix the string length check for printing the simple diff
...
PR-URL: https://github.com/nodejs/node/pull/55474
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2024-11-02 15:12:12 +00:00
Giovanni Bucci and Pietro Marchini
4d6d7d644b
assert: make assertion_error use Myers diff algorithm
...
Fixes: https://github.com/nodejs/node/issues/51733
Co-Authored-By: Pietro Marchini <pietro.marchini94@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54862
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-10-17 16:02:54 +00:00
Xuguang Mei
ac49b20c75
assert: fix deepEqual always return true on URL
...
PR-URL: https://github.com/nodejs/node/pull/50853
Fixes: https://github.com/nodejs/node/issues/50836
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2024-10-13 14:01:47 +00:00
James M Snell
9cbef482df
test: update multiple assert tests to use node:test
...
PR-URL: https://github.com/nodejs/node/pull/54585
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2024-08-29 11:40:53 -07:00
Cristian Barlutiu
764b13d75c
assert,util: change WeakMap and WeakSet comparison handling
...
PR-URL: https://github.com/nodejs/node/pull/53495
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2024-06-28 07:28:55 +00:00
Daniel Lemire and Chris Harvey
ee5c6b6604
assert,util: correct comparison when both contain same reference
...
Co-authored-by: Chris Harvey <1362083+chharvey@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/53431
Refs: https://github.com/nodejs/node/issues/53423
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-06-17 13:30:24 +00:00
Zhenwei Jin
c8a4f70265
assert: add deep equal check for more Error type
...
PR-URL: https://github.com/nodejs/node/pull/51805
Fixes: https://github.com/nodejs/node/issues/51793
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2024-05-12 19:46:13 +00:00
Filip Skokan
0afe731d35
assert,crypto: make KeyObject and CryptoKey testable for equality
...
PR-URL: https://github.com/nodejs/node/pull/50897
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-12-17 12:55:38 +00:00
Ruben Bridgewater
575784b4cf
assert,util: revert recursive breaking change
...
This commit is there to be reverted after merging. It makes it easy
to backport the overall PR and allows easy forward fixing.
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/46593
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-02-20 15:47:08 +01:00
Ruben Bridgewater
449e9f4489
assert,util: improve deep equal comparison performance
...
This is mainly a performance improvement for a lot of simple cases.
Diverging elements are detected earlier and equal entries are
partially also detected faster.
A small correctness patch is also included where recursions now
stop as soon as either side has a circular structure. Before, both
sides had to have a circular structure at the specific comparison
which could have caused more checks that likely fail at a later
point.
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/46593
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-02-20 15:47:06 +01:00
Jordan Harband
757c104147
tools: add prefer-proto rule
...
fixup: add support for `Object.create(null)`
fixup: extend to any 1-argument Object.create call
fixup: add tests
PR-URL: https://github.com/nodejs/node/pull/46083
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-01-10 05:38:36 +00:00
Rich Trott
dcc368f4be
tools,lib,test: enable ESLint no-regex-spaces rule
...
PR-URL: https://github.com/nodejs/node/pull/41463
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2022-01-13 17:12:05 -08:00
Rich Trott
9bfe60fc20
tools: enable ESLint no-sparse-arrays rule
...
PR-URL: https://github.com/nodejs/node/pull/41463
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2022-01-13 17:11:13 -08:00
Ruben Bridgewater
dab8ab2837
assert,util: compare RegExp.lastIndex while using deep equal checks
...
Compare the `lastIndex` property of regular expressions next to the
flags and source property.
Fixes: https://github.com/nodejs/node/issues/28766
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/41020
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2021-12-02 08:01:40 +00:00
Tobias Nießen
dd52c05046
test: avoid deep comparisons with literals
...
Comparing any value to any non-RegExp literal or undefined using
strictEqual (or notStrictEqual) passes if and only if deepStrictEqual
(or notDeepStrictEqual, respectively) passes.
Unnecessarily using deep comparisons adds confusion.
This patch adds an ESLint rule that forbids the use of deepStrictEqual
and notDeepStrictEqual when the expected value (i.e., the second
argument) is a non-RegExp literal or undefined.
For reference, an ESTree literal is defined as follows.
extend interface Literal <: Expression {
type: "Literal";
value: string | boolean | null | number | RegExp | bigint;
}
The value `undefined` is an `Identifier` with `name: 'undefined'`.
PR-URL: https://github.com/nodejs/node/pull/40634
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com >
2021-11-02 10:11:49 +00:00
Rich Trott
330f25ef82
test: prepare for consistent comma-dangle lint rule
...
Make changes so that tests will pass when the comma-dangle settings
applied to the rest of the code base are also applied to tests.
PR-URL: https://github.com/nodejs/node/pull/37930
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is >
2021-04-01 23:14:29 -07:00
Ruben Bridgewater
5ff2e582cd
assert,util: fix commutativity edge case
...
Verify that both objects property keys are enumerable.
Fixes: https://github.com/nodejs/node/issues/37710
PR-URL: https://github.com/nodejs/node/pull/37711
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-03-13 13:44:06 +01:00
Ruben Bridgewater
9de08f773e
lib: update TODO comments
...
This removes one TODO comment and adds another that indicates that
readline is currently not able to trigger specific escape sequences.
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/33361
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2020-05-20 17:05:06 +02:00
Ruben Bridgewater
489e77c119
util: add (typed) array length to the default output
...
Align the inspect output with the one used in the Chrome dev tools.
A recent survey outlined that most users prefer to see the number
of set and map entries. This should count as well for array sizes.
The size is only added to regular arrays in case the constructor is
not the default constructor.
Typed arrays always indicate their size.
PR-URL: https://github.com/nodejs/node/pull/31027
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2019-12-25 11:19:43 +01:00
Ruben Bridgewater
ab59989861
util: add Set and map size to inspect output
...
This adds the size of a set and map to the output. This aligns the
output with the one from Chromium.
PR-URL: https://github.com/nodejs/node/pull/30225
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-15 14:58:58 +01:00
Jordan Harband
916cc82b45
test: assert: fix deepStrictEqual comparing a real array and fake array
...
PR-URL: https://github.com/nodejs/node/pull/30743
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-12-11 16:32:43 -06:00
Ruben Bridgewater
5360dd151d
assert: handle (deep) equal(NaN, NaN) as being identical
...
This aligns the `equal` and `deepEqual()` implementations with the
strict versions by accepting `NaN` as being identical in case both
sides are NaN.
Refs: https://github.com/nodejs/node/issues/30350#issuecomment-552191641
PR-URL: https://github.com/nodejs/node/pull/30766
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-07 00:43:51 +01:00
Ruben Bridgewater
b5f2942fb5
test: run more assert tests
...
This makes sure the assertion does not depend on the argument order.
It also removes comments that do not apply anymore and verifies the
behavior for the loose and strict implementation.
PR-URL: https://github.com/nodejs/node/pull/30764
Refs: https://github.com/nodejs/node/pull/30743
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-07 00:40:53 +01:00
Ruben Bridgewater
b4d48c0516
assert,util: stricter type comparison using deep equal comparisons
...
This veryfies that both input arguments are always of the identical
type. It was possible to miss a few cases before. This change applies
to all deep equal assert functions (e.g., `assert.deepStrictEqual()`)
and to `util.isDeepStrictEqual()`.
PR-URL: https://github.com/nodejs/node/pull/30764
Refs: https://github.com/nodejs/node/pull/30743
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-07 00:40:53 +01:00
Jordan Harband
e079f6c93e
test: assert: add failing deepEqual test for faked boxed primitives
...
PR-URL: https://github.com/nodejs/node/pull/29029
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-09 10:29:56 -05:00
Ruben Bridgewater
81496567e7
assert: print more lines in the error diff
...
So far consequitive identical lines were collapsed if there were at
least three. Now they are only collapsed from five identical lines on.
This also simplifies the implementation a tiny bit by abstracting some
logic.
PR-URL: https://github.com/nodejs/node/pull/28058
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-06-12 19:50:03 -07:00
Ruben Bridgewater
e4ec4f2656
assert: fix error diff
...
In some edge cases an identical line could be printed twice. This is
now fixed by changing the algorithm a bit. It will now verify how
many lines were identical before the current one.
PR-URL: https://github.com/nodejs/node/pull/28058
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-06-12 19:49:59 -07:00
Ruben Bridgewater
3aff26428b
assert: loose deep equal should not compare symbol properties
...
This is the way it's currently documented and that seems appropriate
for loose equal assertions. The change was not intentional.
Fixes: https://github.com/nodejs/node/issues/27652
PR-URL: https://github.com/nodejs/node/pull/27653
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2019-05-13 16:17:00 -07:00
Ruben Bridgewater
0cd602879c
assert: refine assertion message
...
This makes sure that the error message is more appropriate than
before by checking closer what operator is used and which is not.
It also increases the total number of lines printed to the user.
PR-URL: https://github.com/nodejs/node/pull/27525
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-05-05 14:44:19 -07:00
Ruben Bridgewater
b08a867d60
benchmark,doc,lib: capitalize more comments
...
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
2019-03-27 17:20:06 +01:00
Ruben Bridgewater
1ed3c54ecb
errors: update error name
...
This updates all Node.js errors by removing the `code` being part
of the `name` property. Instead, the name is just changed once on
instantiation, the stack is accessed to create the stack as expected
and then the `name` property is set back to it's original form.
PR-URL: https://github.com/nodejs/node/pull/26738
Fixes: https://github.com/nodejs/node/issues/26669
Fixes: https://github.com/nodejs/node/issues/20253
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-03-23 02:55:54 +01:00
Ruben Bridgewater
f8763bb077
benchmark,doc,lib,test: capitalize comments
...
PR-URL: https://github.com/nodejs/node/pull/26483
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-10 00:44:40 +01:00
Rich Trott
8e68dc53b3
test: increase coverage for assertion_error.js
...
Add a test for long strings and assert.notDeepEqual() to cover code that
truncates output when it is longer than 1024 characters.
PR-URL: https://github.com/nodejs/node/pull/26065
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2019-02-14 19:28:38 -08:00
Ruben Bridgewater
7493db21b6
assert: adjust loose assertions
...
This changes the loose deep equal comparison by using the same logic
as done in the strict deep equal comparison besides comparing
primitives loosely, not comparing symbol properties and not comparing
the prototype.
`assert.deepEqual` is still commenly used and this is likely the
biggest pitfall.
Most changes are only minor and won't have a big impact besides
likely fixing user expectations.
PR-URL: https://github.com/nodejs/node/pull/25008
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2019-01-27 03:34:25 +01:00
Anto Aravinth
81b25eac21
util: add null prototype support for date
...
PR-URL: https://github.com/nodejs/node/pull/25144
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-01-10 03:24:31 +01:00