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

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

Closed
Bigdragon13th opened this issue Apr 23, 2019 · 10 comments

Comments

@Bigdragon13th
Copy link

Bigdragon13th commented Apr 23, 2019

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

@jennifer-shehane
Copy link
Member

jennifer-shehane commented 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 #2529

@jennifer-shehane jennifer-shehane added type: duplicate This issue or pull request already exists and removed stage: work in progress labels Apr 23, 2019
@Bigdragon13th
Copy link
Author

Yeah, I'm aware of the duplicated old issue, thought it got fixed already because it was closed, guess I was wrong.

@jennifer-shehane
Copy link
Member

Issues are closed when the PR has been merged into develop, but not necessarily released. These issues have a pending release tag and a comment in the issue noting this.

@Bigdragon13th
Copy link
Author

I didn't see any pending release tag or comments in your given issues, where should I look for to see when the feature will possibly be released?

@jennifer-shehane
Copy link
Member

@Bigdragon13th 😅This is true. We've automated the process of tagging and commenting recently, so more recently closed issues should do this. Looks like we overlooked this one.

@westhomas
Copy link

@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 :-(

@Neurrone
Copy link
Contributor

Hi, can we please have this misleading entry removed from the docs until 4.0 is released? Wasted an hour trying to figure out what was going on until stumbling upon this issue.

@Dan503
Copy link

Dan503 commented Dec 18, 2019

FYI, if you are looking for a work around solution, I managed to get the test working by doing this instead:

it("test array matches (order matters)", () => {
    expect([0, 1]).to.deep.equal([0, 1]);
});

I was testing that a regular expression was returning the expected result values. I needed to destructure the result for that to work.

it('a b test', () => {
    expect([.../(a)(b)/.exec('ab')]).to.deep.equal(['ab', 'a', 'b'])
})

@jennifer-shehane jennifer-shehane added stage: pending release and removed type: duplicate This issue or pull request already exists labels Jan 29, 2020
@jennifer-shehane
Copy link
Member

I've confirmed this is working in upcoming 4.0 release. The code for this is done, but this has yet to be released. We'll update this issue and reference the changelog when it's released.

3.8.3

Screen Shot 2020-01-29 at 3 49 42 PM

4.0.0

Screen Shot 2020-01-29 at 3 49 49 PM

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 6, 2020

Released in 4.0.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.0.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Feb 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants