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

Boolean support is brittle #42

Open
kasperlewau opened this issue May 31, 2016 · 4 comments
Open

Boolean support is brittle #42

kasperlewau opened this issue May 31, 2016 · 4 comments

Comments

@kasperlewau
Copy link

I have two use cases that will not pass with the following versions: chai@^3.5.0, chai-things@^0.2.0 and mocha@^2.4.5.

Expect all array items to be of type boolean.

Possible duplicate of #16

const bools = [false, true, false];
expect(bools).to.all.be.a('boolean');

// ERROR: expected false to be a boolean

Workaround:

expect(bools).to.all.satisfy(bool => typeof bool === 'boolean');

Expect all array items to be true (or, false).

const truths = [true, true, true];
expect(truths).to.all.be.true;

// ERROR: expected true to be true

Workaround:

expect(truths.includes(!true)).to.be.true;

If I can find the time on my hands to get a PR rolling for this, I'd be more than happy to. If for whatever reason I can't, I'd ❤️ whomever does find the time and energy to do so!

@meeber
Copy link

meeber commented May 31, 2016

@kasperlewau Thanks for the issue. I took a glance at the code earlier and I believe the problem is that the all and something functionality is only added to Chai's regular assertion methods, not its chainable assertion methods, which includes an. If this is indeed the case, then this issue is actually responsible for #14, #16, and #25.

@meeber
Copy link

meeber commented Jul 24, 2016

@keithamus This one needs a "PR Wanted" also.

@keithamus
Copy link
Member

@meeber added. Are you not able to create labels?

@meeber
Copy link

meeber commented Jul 25, 2016

@keithamus Nope. Need to be added to the chai-things team I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants