Skip to content

doc: assert.deepStrictEqual() description inaccurate #5365

Description

@jmm

deepStrictEqual() description currently begins with:

Generally identical to assert.deepEqual() with the exception that primitive
values are compared using the strict equality operator ( === ).

But, deepStrictEqual() also compares prototype equality. Example (v5.6.0):

var assert = require("assert");

var a = [0];
var b = {0: 0};

["deepEqual", "deepStrictEqual"].forEach(function (meth) {
  assert[meth](a, b, "not " + meth);
});
// AssertionError: not deepStrictEqual

Metadata

Metadata

Assignees

No one assigned

    Labels

    assertIssues and PRs related to the assert subsystem.docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions