Skip to content
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

assertObjectMatch error message diff prints arrays as objects #3472

Closed
vwkd opened this issue Jun 30, 2023 · 1 comment · Fixed by #5503
Closed

assertObjectMatch error message diff prints arrays as objects #3472

vwkd opened this issue Jun 30, 2023 · 1 comment · Fixed by #5503
Labels
bug Something isn't working needs triage

Comments

@vwkd
Copy link
Contributor

vwkd commented Jun 30, 2023

Describe the bug

The error message diff in assertObjectMatch prints arrays as objects.

This happens if the value has potentially nested property with an array or if the value itself is an array.

Steps to Reproduce

import { assertObjectMatch } from "https://deno.land/std@0.191.0/testing/asserts.ts";

Deno.test("foo", () => {
  const act = { foo: [] };

  const exp = {
    foo: [
      "bar",
    ],
  };

  assertObjectMatch(act, exp);
});

Expected behavior

    [Diff] Actual / Expected


    {
+     foo: [
+       "bar",
+     ],
-     foo: [],
    }

Actual behavior

    [Diff] Actual / Expected


    {
+     foo: {
+       "0": "bar",
+     },
-     foo: {},
    }

Environment

  • OS: macOS 12.6.6
  • deno version: deno 1.34.1
  • std version: 0.191.0
@vwkd vwkd added bug Something isn't working needs triage labels Jun 30, 2023
@vwkd vwkd changed the title assertObjectMatch error message prints arrays as objects assertObjectMatch error message diff prints arrays as objects Jun 30, 2023
@hasundue
Copy link
Contributor

hasundue commented Sep 3, 2023

Happened to me too.

deno 1.36.0 (release, x86_64-unknown-linux-gnu)
v8 11.6.189.12
typescript 5.1.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
2 participants