Hi there,
are there any plans to support multiple expects in one test (similar to what jasmine offers)?
When:
it('foo', function () {
expect(3==2).to.be.true;
expect(4==3).to.be.true;
expect(4==2).to.be.true;
});
Then:
The test run should results in s.th. like:
AssertionError: expected false to be true
...
AssertionError: expected false to be true
...
AssertionError: expected false to be true
...
instead of just one AssertionError.
Regards, Leif
:+1: That would be a great feature!
Though I am not familiar with the specifics of how Jasmine accomplishes this, my assumption is that they invoke some handler that does not close the loop on the currently running test (instead of throw new AssertionError('...')). Since Chai strives to be runner agnostic, this is the best default behavior.
That being said, if you have a test runner that approaches detecting failures the same way as Jasmine, Chai's Assertion.prototype.assert [ref] method could be overwritten via our Plugin API to invoke that handler instead.
You should start by getting your test runner to implement this functionality, then implement it on the Chai side of things as a plugin. Please keep us updated on your progress and if you run into any issues with Chai's implementation feel free to open another issue referencing the runner's API.
Thanks for the pointers.
Usually I use the & (and) to concatenate the expects that is only one.
expect(3==2).to.be.true &&
expect(4==3).to.be.true &&
expect(4==2).to.be.true;
Also you can use the || (or) too. I hope this help you.
Most helpful comment
Usually I use the & (and) to concatenate the expects that is only one.
expect(3==2).to.be.true &&
expect(4==3).to.be.true &&
expect(4==2).to.be.true;
Also you can use the || (or) too. I hope this help you.