-
Notifications
You must be signed in to change notification settings - Fork 108
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
assert's isFulfilled isRejected not working #216
Comments
+1, why test passes if there error in promise? Looks weird. |
@Cazra What versions of node, chai, chai-as-promised, and mocha are you using? What does your entire test file look like? I just performed a test using node 8.4.0, chai 4.1.2, chai-as-promised 7.1.1, mocha 3.5.0, and this code: const chai = require("chai");
const chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
const assert = chai.assert;
describe('test', () => {
it('This should fail.', () => {
return assert.isFulfilled(Promise.reject());
});
it('This should fail.', () => {
return assert.isRejected(Promise.resolve());
});
}); And the output was:
|
I have the exact same issue.
Node 8.7.0 |
Solved it by adding await
|
I think the docs should be updated to include an example of this? |
I'm having trouble with isFulfilled and isRejected always passing. I'm using chai-as-promised with asserts in Mocha.
isFulfilled example:
This passes, but prints the following to the console:
isRejected example:
This also passes, but prints the following to the console:
I've confirmed that this isn't just something wrong with Mocha. When I do a test like the following:
the test fails as expected.
The text was updated successfully, but these errors were encountered: