Skip to content

@std/assert/equals considers Object.create(null) and {} to be equal #6334

Open
@lilnasy

Description

@lilnasy

Describe the bug

  • Since fix(assert): check property equality up the prototype chain (#6151) #6153, assertEquals checks object prototypes. However, it makes certain exceptions to keep existing tests within the repo from failing.
  • Other assertion libraries have more correct checks: "node:assert/strict", "ava", and "uvu" all make a distinction between null-prototype object and plain objects. "node:assert" and "chai" don't.

Steps to Reproduce
The following assertion passes:

import { assertEquals } from "@std/assert"
assertEquals(Object.create(Object.prototype), Object.create(null))

Expected behavior
The assertion fails.

Environment
Not applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions