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

fix: object diff when assertion failed #562

Merged
merged 1 commit into from
Jul 9, 2024
Merged

fix: object diff when assertion failed #562

merged 1 commit into from
Jul 9, 2024

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Jul 9, 2024

Expose Deno.inspect as Zinnia.inspect.

Fix the error message printed by assertion functions to describe object properties.

Before this fix:

error: Uncaught AssertionError: Values are not equal.

    [Diff] Actual / Expected

    "[object Object]"

    at assertEquals (ext:zinnia_runtime/vendored/asserts.bundle.js:479:11)

After the fix:

error: Uncaught AssertionError: Values are not equal.

    [Diff] Actual / Expected

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

    at assertEquals (ext:zinnia_runtime/vendored/asserts.bundle.js:495:11)

I noticed the problem while working on filecoin-station/spark#46

Expose `Deno.inspect` as `Zinnia.inspect`.

Fix the error message printed by assertion functions to describe object
properties.

Before this fix:

```
error: Uncaught AssertionError: Values are not equal.

    [Diff] Actual / Expected

    "[object Object]"

    at assertEquals (ext:zinnia_runtime/vendored/asserts.bundle.js:479:11)
```

After the fix:

```
error: Uncaught AssertionError: Values are not equal.

    [Diff] Actual / Expected

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

    at assertEquals (ext:zinnia_runtime/vendored/asserts.bundle.js:495:11)
```

Signed-off-by: Miroslav Bajtoš <[email protected]>
@bajtos bajtos requested a review from juliangruber July 9, 2024 08:32
Copy link
Member

@juliangruber juliangruber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@bajtos bajtos enabled auto-merge (squash) July 9, 2024 08:42
@bajtos bajtos merged commit 365a87e into main Jul 9, 2024
13 checks passed
@bajtos bajtos deleted the fix-assert-inspect branch July 9, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants