question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

expect().to.be.ordered.members() throw an error "TypeError: Cannot read property 'members' of undefined"

See original GitHub issue

Current behavior:

Whenever I try to compare array (order matters) with the command expect(...).to.be.ordered.members(...), Cypress always throw an error.

expect(...).ordered(...) as shown here also failed. https://docs.cypress.io/guides/references/assertions.html#BDD-Assertions

Desired behavior:

It should works.

Steps to reproduce: (app code and test code)

This code failed.

describe("First Test", () => {
    it.only("This will failed", () => {
        expect([0, 1]).to.be.ordered.members([0, 1]);
    });
});

Versions

Cypress version: 3.2.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
westhomascommented, Sep 4, 2019

@jennifer-shehane ordered is shown in the docs here: https://docs.cypress.io/guides/references/assertions.html#Chai

I’m guessing that’s automatic. But it’s also confusing 😦

3reactions
jennifer-shehanecommented, Apr 23, 2019

The ordered flag was added in chai version 4.x.x. Cypress is currently using chai version 3.5.0. Upgrading to 4.0 is part of our Cypress 4.0 release, so will be supported when that is released.

Closing this issue as duplicate of https://github.com/cypress-io/cypress/issues/2529

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'members' of undefined
I was getting this error message when creating a new library. It turned out that in public_api.ts of that library, I was importing...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Expect / Should - Chai Assertion Library
expect (function () {}).to.not.throw(); expect({a: ... By default, strict ( === ) equality is used to compare array members and object properties.
Read more >
Object.defineProperty() - JavaScript - MDN Web Docs
A TypeError is thrown when attempts are made to change non-configurable property attributes (except value and writable , if permitted), except ...
Read more >
Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found