-
Notifications
You must be signed in to change notification settings - Fork 662
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
@std/assert/equals - assertEquals() always throws when any property or sub-property of its input objects is a function, even if they are otherwise identical. The error message contains no hints or highlighting of the functions at all, making it fairly confusing to figure out what went wrong, especially if the inputs have deeply nested objects.
Steps to Reproduce
import { assertEquals } from "jsr:@std/assert";
Deno.test("Example test", () => assertEquals(
{ x: 1, y: () => console.log(2) },
{ x: 1, y: () => console.log(2) }
));Output (deno test):
error: AssertionError: Values are not equal.
[Diff] Actual / Expected
{
x: 1,
y: [Function: y],
}
Expected behavior
Either (or both) of:
- The error message indicates that functions cannot be compared
- Function is highlighted in output with an indicator that it can't be compared
Alternatively, an assertEqualsWithoutFunctions() function treating all functions as equal would be welcome too.
Environment
- OS: Windows 11 using WSL (Ubuntu 24.04 LTS)
- deno version: 2.5.6
- std version:
@std/assert@1.0.16
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
