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

Not compatible with chai v4 #12

Open
nunof07 opened this issue Nov 11, 2017 · 5 comments
Open

Not compatible with chai v4 #12

nunof07 opened this issue Nov 11, 2017 · 5 comments

Comments

@nunof07
Copy link

nunof07 commented Nov 11, 2017

This code:

import chai = require("chai");
import { expect } from 'chai';
import chaiIterator = require("chai-iterator");

chai.use(chaiIterator);

expect([2, 3, 5]).to.iterate.for.lengthOf(3);

Throws the following error.

AssertionError: expected undefined to be iterable

Here is a repo with reproduction: https://github.com/nunof07/chai-iterator-test

Can't quite figure out is going wrong. _obj is undefined in Assertion.addProperty.

@nunof07
Copy link
Author

nunof07 commented Nov 12, 2017

After some testing I think it's because I'm using chai v4.

This plugin doesn't seem compatible with the latest chai version.

I've updated the title of the issue to reflect that.

@nunof07 nunof07 changed the title undefined error when using in TypeScript Not compatible with chai v4 Nov 12, 2017
@harrysarson
Copy link

I have looked a bit into this, something breaks in chai when the to property is accessed but it only breaks when using the plugin. Here is an example:

https://runkit.com/harrysarson/chai-to-does-not-work-with-chai-iterator

Will look into this a bit more in a bit.

@harrysarson
Copy link

The problem is that the chainable method lengthOf is overwritten using overwriteMethod instead of overwriteChainableMethod.

I will make a pr.

@harrysarson
Copy link

@mcmath Could you review #17? I would like to be able to upgrade chai to v4.

@harrysarson
Copy link

ping @mcmath

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

No branches or pull requests

2 participants