-
Notifications
You must be signed in to change notification settings - Fork 109
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
Using expect for notify? #203
Comments
Few things:
const chai = require("chai");
const chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
const expect = chai.expect;
it("meow", () => {
let promise = Promise.resolve();
return expect(promise).to.be.fulfilled.then(() => {
expect(42).to.equal(42);
});
}); |
@meeber I'm really not sure what's going on. I've got this at the top of my code, but I'm still getting errors saying to.be.fulfilled is not a function import chai, { expect } from 'chai'
import chaiAsPromised from 'chai-as-promised'
chai.use(chaiAsPromised)``` |
Thanks for the return tip. That seems to work, but not with to.be.fulfilled. I've had to do this instead: it("meow", (done) => {
let promise = Promise.resolve(42);
return promise.then(result => {
expect(result).to.equal(42);
done()
});
}); It'd be great if I could get to.be.fulfilled working though... |
I've just noticed the following when I run UNMET PEER DEPENDENCY chai@4.0.2
npm ERR! peer dep missing: chai@>= 2.1.2 < 4, required by chai-as-promised@6.0.0 I have chai 4.0.2 installed but chai-as-promised thinks it's missing? |
chai-as-promised doesn't support Chai 4 yet (see #157). You can use chai@3.5 instead. |
@meeber Ahh, thank you! |
Is it possible to use the below code snippet with the expect syntax?
All of my tests have been using expect so far, so I'd prefer not to change it if possible. I get the error
TypeError: (0 , _chai.expect)(...).to.be.fulfilled.then is not a function
if I try to use the expect syntax. My code:So I tried to use the should syntax instead but I get the error
TypeError: promise.should.be.fulfilled.then is not a function
The text was updated successfully, but these errors were encountered: