Skip to content

Conversation

@illume
Copy link

@illume illume commented Apr 29, 2025

My tests were failing with the way mentioned in the docs.

This was the error:

1) [chromium]  headlamp.spec.ts:38:5  service page should have headlamp service ────────────────
    Error: expect(received).toBe(expected) // Object.is equality
    If it should pass with deep equality, replace "toBe" with "toStrictEqual"
    Expected: []
    Received: serializes to the same string
       at headlampPage.ts:18
      16 |       console.error(JSON.stringify(accessibilityResults.violations));
      17 |     }
    > 18 |     expect(accessibilityResults.violations).toBe([]);
         |                                             ^
      19 |   }
      20 |
      21 |   async authenticate(token?: string) {
        at HeadlampPage.a11y (/home/runner/work/headlamp/headlamp/e2e-tests/tests/headlampPage.ts:18:45)
        at /home/runner/work/headlamp/headlamp/e2e-tests/tests/headlamp.spec.ts:44:3

toStrictEqual() works, so I made changes to the docs to use that.

My tests were failing with the old way. Now they are not.

Signed-off-by: René Dudfield <renesd@gmail.com>
@dgozman
Copy link
Contributor

dgozman commented May 1, 2025

@illume I don't see any toBe() in the guide, and this PR does not seem to correct any toBe() calls. What exactly was failing for you? I think toEqual() is perfectly fine.

@mxschmitt
Copy link
Contributor

Closing as per above. Feel free to start with an issue if you think there is a bug in our docs. Thanks!

@mxschmitt mxschmitt closed this May 9, 2025
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.

3 participants