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() not working in Chrome #13

Closed
quartzmo opened this issue Feb 10, 2012 · 3 comments
Closed

expect().to.be() not working in Chrome #13

quartzmo opened this issue Feb 10, 2012 · 3 comments

Comments

@quartzmo
Copy link

This works with expect.js:

expect(true).to.be(true);

But with chai.js in the browser (Chrome), I get:

TypeError: Property 'be' of object #<Assertion> is not a function
@logicalparadox
Copy link
Member

Chai's be implementation is more like the should.js implementation... be is a language chain. The equivalent for be in chai is equal. Your alternatives are as follows...

expect(true).to.be.true;
expect(true).to.equal(true);

Your welcome to keep this thread for any other differences you find, but this is one I cannot change.

@logicalparadox
Copy link
Member

The other difference you will likely find is an. In expect.js an is an alias for a, where in chai an is also a language chain. Your alternatives for that particular scenario are as follows...

expect([ 'hello', 'universe' ]).to.be.an.instanceof(Array);
expect({ hello: 'universe' }).to.be.a('object');

@quartzmo
Copy link
Author

This makes sense to me, thanks for the enlightenment. I just need to convert a few existing expect.js tests to the should/chai behavior. I think I can just close this issue.

koddsson pushed a commit to koddsson/chai that referenced this issue May 20, 2024
v1.1.0 assert style of test, rm jshint, add jscs eslint, better coverage, fixes chaijs#13
koddsson pushed a commit to koddsson/chai that referenced this issue May 20, 2024
v1.1.0 assert style of test, rm jshint, add jscs eslint, better coverage, fixes chaijs#13
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